From bae0d6a720d31bf531cd46bee311239d7ab62934 Mon Sep 17 00:00:00 2001 From: hdx Date: Thu, 30 May 2024 14:49:43 +0800 Subject: [PATCH] =?UTF-8?q?test(switch):=20=E5=BD=93=E5=89=8D=E4=BB=85?= =?UTF-8?q?=E6=94=AF=E6=8C=81=20Android=20=E7=A8=8D=E5=90=8E=E8=A1=A5?= =?UTF-8?q?=E5=85=85=E5=85=B6=E4=BB=96=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/switch/switch.test.js | 28 ++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/pages/component/switch/switch.test.js b/pages/component/switch/switch.test.js index e771b425..a3400d0a 100644 --- a/pages/component/switch/switch.test.js +++ b/pages/component/switch/switch.test.js @@ -38,15 +38,29 @@ describe('switch', () => { expect(await switch_element.attribute('color')).toBe(color) }) it('click', async () => { + let switchElement // TODO 暂时通过获取组件内部的 class 触发模拟点击 - const switchElement = await page.$('.uni-switch-input') - await switchElement.tap() - await page.waitFor(200) + if (process.env.uniTestPlatformInfo.startsWith('android')) { + switchElement = await page.$('.uni-switch-input') + await switchElement.tap() + await page.waitFor(200) - const { - testVerifyEvent - } = await page.data() + const { + testVerifyEvent + } = await page.data() - expect(testVerifyEvent).toBe(true) + expect(testVerifyEvent).toBe(true) + } else { + // switchElement = await page.$('#testTap') + } + + // await switchElement.tap() + // await page.waitFor(200) + + // const { + // testVerifyEvent + // } = await page.data() + + // expect(testVerifyEvent).toBe(true) }) }) -- GitLab