提交 2f1b6627 编写于 作者: DCloud-yinjiacheng's avatar DCloud-yinjiacheng

更新web-view自动化测试用例

上级 a0c5164a
...@@ -44,43 +44,23 @@ describe('component-native-web-view', () => { ...@@ -44,43 +44,23 @@ describe('component-native-web-view', () => {
x: 1, x: 1,
y: info.statusBarHeight + 44 + 1 y: info.statusBarHeight + 44 + 1
}); });
start = Date.now(); await page.waitFor(500);
await page.waitFor(async () => {
return (await page.data('eventTouchstart')) && (await page.data('eventTap')) || (Date.now() - start > 500);
});
if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios') == false) { if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios') == false) {
expect(await page.data('eventTouchstart')).toEqual({ expect(await page.data('isTouchEnable')).toBe(true);
clientX: 1,
clientY: 1
});
expect(await page.data('eventTap')).toEqual({
clientX: 1,
clientY: 1
});
} }
await page.setData({ await page.setData({
pointerEvents: 'none' pointerEvents: 'none',
isTouchEnable: false
}); });
await page.waitFor(100); await page.waitFor(100);
await program.tap({ await program.tap({
x: 10, x: 10,
y: info.statusBarHeight + 44 + 10 y: info.statusBarHeight + 44 + 10
}); });
start = Date.now(); await page.waitFor(500);
await page.waitFor(async () => {
return (await page.data('eventTouchstart')) && (await page.data('eventTap')) || (Date.now() - start > 500);
});
if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios') == false) { if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios') == false) {
expect(await page.data('eventTouchstart')).toEqual({ expect(await page.data('isTouchEnable')).toBe(false);
clientX: 1,
clientY: 1
});
expect(await page.data('eventTap')).toEqual({
clientX: 1,
clientY: 1
});
} }
await page.setData({ await page.setData({
pointerEvents: 'auto' pointerEvents: 'auto'
......
...@@ -71,9 +71,8 @@ ...@@ -71,9 +71,8 @@
eventLoading: null as UTSJSONObject | null, eventLoading: null as UTSJSONObject | null,
eventLoad: null as UTSJSONObject | null, eventLoad: null as UTSJSONObject | null,
eventError: null as UTSJSONObject | null, eventError: null as UTSJSONObject | null,
eventTouchstart: null as UTSJSONObject | null, pointerEvents: 'auto',
eventTap: null as UTSJSONObject | null, isTouchEnable: false
pointerEvents: 'auto'
} }
}, },
onReady() { onReady() {
...@@ -183,18 +182,12 @@ ...@@ -183,18 +182,12 @@
// 自动化测试 // 自动化测试
touchstart(event : UniTouchEvent) { touchstart(event : UniTouchEvent) {
if (this.autoTest) { if (this.autoTest) {
this.eventTouchstart = { isTouchEnable = event.touches[0].clientX > 0 && event.touches[0].clientY > 0;
clientX: Math.ceil(event.touches[0].clientX),
clientY: Math.ceil(event.touches[0].clientY)
};
} }
}, },
tap(event : UniPointerEvent) { tap(event : UniPointerEvent) {
if (this.autoTest) { if (this.autoTest) {
this.eventTap = { isTouchEnable = event.clientX > 0 && event.clientY > 0;
clientX: Math.ceil(event.clientX),
clientY: Math.ceil(event.clientY)
};
} }
}, },
getWindowInfo() : GetWindowInfoResult { getWindowInfo() : GetWindowInfoResult {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册