diff --git a/pages/component/global-events/global-events.test.js b/pages/component/global-events/global-events.test.js index dbaa81217bfff35c3df01436720236fd81f0fea2..22e7d40663a317bac30c63beb602df4cd4f22e50 100644 --- a/pages/component/global-events/global-events.test.js +++ b/pages/component/global-events/global-events.test.js @@ -292,25 +292,20 @@ describe('event trigger', () => { page = await program.reLaunch(PAGE_PATH) await page.waitFor('view') - const el = await page.$('#longpress-target') - const size = await el.size() - const position = await el.offset() - // console.log('position', position) - // console.log('size', size); - const x = position.left + size.width / 2.0 - const y = position.top + size.height / 2.0 - const res = await uni.getWindowInfo(); - // console.log('res', res.statusBarHeight); - const baseStatusTextHeight = 44 - const baseTop = res.statusBarHeight ?? 0 + const [ + x, + y + ] = await page.callMethod('jest_getRect') + + expect(x > 0).toBe(true) + expect(y > 0).toBe(true) await program.tap({ x: x, - y: y + baseTop + baseStatusTextHeight, - duration: 100 + y: y }) - await page.waitFor(500) + await page.waitFor(200) const clickEventX = await page.$('#click-event-x') const StringX = await clickEventX.text() @@ -324,3 +319,4 @@ describe('event trigger', () => { } }) }) + diff --git a/pages/component/global-events/global-events.uvue b/pages/component/global-events/global-events.uvue index c89a6b2dba78fd79274ffa2ede3549713ad7e3f8..ffb2a22881101f7964827add72c9d6ab55ecd509 100644 --- a/pages/component/global-events/global-events.uvue +++ b/pages/component/global-events/global-events.uvue @@ -6,8 +6,7 @@ - - + touchStart Event: touches: