fix: resolve remaining TypeScript errors in mobile testing~

This commit is contained in:
张翔
2026-03-05 16:42:16 +08:00
parent c4fcbb6059
commit 941e5170e1
3 changed files with 15 additions and 15 deletions
+12 -12
View File
@@ -37,7 +37,7 @@ export class GestureSimulator {
clientY: startY,
}];
await this.page.dispatchEvent('touchstart', { touches, changedTouches: touches, targetTouches: touches });
await this.page.dispatchEvent('touchstart', { touches, changedTouches: touches, targetTouches: touches } as any);
for (let i = 1; i <= steps; i++) {
const x = startX + (endX - startX) * (i / steps);
@@ -49,11 +49,11 @@ export class GestureSimulator {
clientY: y,
}];
await this.page.dispatchEvent('touchmove', { touches: moveTouches, changedTouches: moveTouches, targetTouches: moveTouches });
await this.page.dispatchEvent('touchmove', { touches: moveTouches, changedTouches: moveTouches, targetTouches: moveTouches } as any);
await this.page.waitForTimeout(stepDuration);
}
await this.page.dispatchEvent('touchend', { touches: [], changedTouches: [], targetTouches: [] });
await this.page.dispatchEvent('touchend', { touches: [], changedTouches: [], targetTouches: [] } as any);
}
async quickSwipeDown(): Promise<void> {
@@ -106,7 +106,7 @@ export class GestureSimulator {
},
];
await this.page.dispatchEvent('touchstart', { touches, changedTouches: touches, targetTouches: touches });
await this.page.dispatchEvent('touchstart', { touches, changedTouches: touches, targetTouches: touches } as any);
for (let i = 1; i <= steps; i++) {
const progress = i / steps;
@@ -126,11 +126,11 @@ export class GestureSimulator {
},
];
await this.page.dispatchEvent('touchmove', { touches: moveTouches, changedTouches: moveTouches, targetTouches: moveTouches });
await this.page.dispatchEvent('touchmove', { touches: moveTouches, changedTouches: moveTouches, targetTouches: moveTouches } as any);
await this.page.waitForTimeout(stepDuration);
}
await this.page.dispatchEvent('touchend', { touches: [], changedTouches: [], targetTouches: [] });
await this.page.dispatchEvent('touchend', { touches: [], changedTouches: [], targetTouches: [] } as any);
}
async longPress(element: Locator, duration: number = 1000): Promise<void> {
@@ -146,9 +146,9 @@ export class GestureSimulator {
clientY: y,
}];
await element.dispatchEvent('touchstart', { touches, changedTouches: touches, targetTouches: touches });
await element.dispatchEvent('touchstart', { touches, changedTouches: touches, targetTouches: touches } as any);
await this.page.waitForTimeout(duration);
await element.dispatchEvent('touchend', { touches: [], changedTouches: [], targetTouches: [] });
await element.dispatchEvent('touchend', { touches: [], changedTouches: [], targetTouches: [] } as any);
}
async doubleTap(element: Locator): Promise<void> {
@@ -164,11 +164,11 @@ export class GestureSimulator {
clientY: y,
}];
await element.dispatchEvent('touchstart', { touches, changedTouches: touches, targetTouches: touches });
await element.dispatchEvent('touchend', { touches: [], changedTouches: [], targetTouches: [] });
await element.dispatchEvent('touchstart', { touches, changedTouches: touches, targetTouches: touches } as any);
await element.dispatchEvent('touchend', { touches: [], changedTouches: [], targetTouches: [] } as any);
await this.page.waitForTimeout(100);
await element.dispatchEvent('touchstart', { touches, changedTouches: touches, targetTouches: touches });
await element.dispatchEvent('touchend', { touches: [], changedTouches: [], targetTouches: [] });
await element.dispatchEvent('touchstart', { touches, changedTouches: touches, targetTouches: touches } as any);
await element.dispatchEvent('touchend', { touches: [], changedTouches: [], targetTouches: [] } as any);
}
async drag(options: DragOptions): Promise<void> {