From cab6810b290784437ba1aed73c55956635cae534 Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Thu, 6 Jun 2024 18:33:53 +0800 Subject: [PATCH] =?UTF-8?q?test(general=20event):=20=E8=A1=A5=E5=85=85=20a?= =?UTF-8?q?pp=20=E7=AB=AF=20longpress=20=E6=89=8B=E5=8A=BF=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../general-event/general-event.test.js | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/pages/component/general-event/general-event.test.js b/pages/component/general-event/general-event.test.js index ba6340f2..f7e87612 100644 --- a/pages/component/general-event/general-event.test.js +++ b/pages/component/general-event/general-event.test.js @@ -3,6 +3,7 @@ const PAGE_PATH = '/pages/component/general-event/general-event' describe('event trigger sequence', () => { const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase() const isAndroid = platformInfo.startsWith('android') + const isIos = platformInfo.startsWith('ios') let page beforeAll(async () => { page = await program.navigateTo(PAGE_PATH) @@ -218,6 +219,64 @@ describe('event trigger sequence', () => { expect(await longPressChangedTouchScreenX.text()).toBe(longPressTouchTargetValue) const longPressChangedTouchScreenY = await page.$('#long-press-changed-touch-screen-y') expect(await longPressChangedTouchScreenY.text()).toBe(longPressTouchTargetValue) + + if (isAndroid || isIos) { + if (isAndroid) { + await program.tap({ + x: 200, + y: 1000, + duration: 1000 + }) + } else if (isIos) { + await program.tap({ + x: 200, + y: 400, + duration: 1000 + }) + } + const longPressTouchIdentifierText = await longPressTouchIdentifier.text() + expect(longPressTouchIdentifierText).not.toBe(longPressTouchTargetIdentifier) + expect(longPressTouchIdentifierText).toBeTruthy() + const longPressTouchPageXText = await longPressTouchPageX.text() + expect(longPressTouchPageXText).not.toBe(longPressTouchTargetValue) + expect(longPressTouchPageXText).toBeTruthy() + const longPressTouchPageYText = await longPressTouchPageY.text() + expect(longPressTouchPageYText).not.toBe(longPressTouchTargetValue) + expect(longPressTouchPageYText).toBeTruthy() + const longPressTouchClientXText = await longPressTouchClientX.text() + expect(longPressTouchClientXText).not.toBe(longPressTouchTargetValue) + expect(longPressTouchClientXText).toBeTruthy() + const longPressTouchClientYText = await longPressTouchClientY.text() + expect(longPressTouchClientYText).not.toBe(longPressTouchTargetValue) + expect(longPressTouchClientYText).toBeTruthy() + const longPressTouchScreenXText = await longPressTouchScreenX.text() + expect(longPressTouchScreenXText).not.toBe(longPressTouchTargetValue) + expect(longPressTouchScreenXText).toBeTruthy() + const longPressTouchScreenYText = await longPressTouchScreenY.text() + expect(longPressTouchScreenYText).not.toBe(longPressTouchTargetValue) + expect(longPressTouchScreenYText).toBeTruthy() + const longPressChangedTouchIdentifierText = await longPressChangedTouchIdentifier.text() + expect(longPressChangedTouchIdentifierText).not.toBe(longPressTouchTargetIdentifier) + expect(longPressChangedTouchIdentifierText).toBeTruthy() + const longPressChangedTouchPageXText = await longPressChangedTouchPageX.text() + expect(longPressChangedTouchPageXText).not.toBe(longPressTouchTargetValue) + expect(longPressChangedTouchPageXText).toBeTruthy() + const longPressChangedTouchPageYText = await longPressChangedTouchPageY.text() + expect(longPressChangedTouchPageYText).not.toBe(longPressTouchTargetValue) + expect(longPressChangedTouchPageYText).toBeTruthy() + const longPressChangedTouchClientXText = await longPressChangedTouchClientX.text() + expect(longPressChangedTouchClientXText).not.toBe(longPressTouchTargetValue) + expect(longPressChangedTouchClientXText).toBeTruthy() + const longPressChangedTouchClientYText = await longPressChangedTouchClientY.text() + expect(longPressChangedTouchClientYText).not.toBe(longPressTouchTargetValue) + expect(longPressChangedTouchClientYText).toBeTruthy() + const longPressChangedTouchScreenXText = await longPressChangedTouchScreenX.text() + expect(longPressChangedTouchScreenXText).not.toBe(longPressTouchTargetValue) + expect(longPressChangedTouchScreenXText).toBeTruthy() + const longPressChangedTouchScreenYText = await longPressChangedTouchScreenY.text() + expect(longPressChangedTouchScreenYText).not.toBe(longPressTouchTargetValue) + expect(longPressChangedTouchScreenYText).toBeTruthy() + } } }) }) -- GitLab