From 5303406cb244582e28914ffe7daf94597185fd00 Mon Sep 17 00:00:00 2001 From: wangyaqi Date: Fri, 1 Mar 2024 15:42:32 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E8=B0=83=E6=95=B4web=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request-payment/reqeust-payment.test.js | 8 ++- .../general-event/transition-event.test.js | 6 -- .../list-view/list-view-multiplex.test.js | 8 +-- pages/component/list-view/list-view.test.js | 57 +++++++++---------- pages/component/text/text-props.test.js | 4 ++ 5 files changed, 40 insertions(+), 43 deletions(-) diff --git a/pages/API/request-payment/reqeust-payment.test.js b/pages/API/request-payment/reqeust-payment.test.js index 6e73699a..f4edc656 100644 --- a/pages/API/request-payment/reqeust-payment.test.js +++ b/pages/API/request-payment/reqeust-payment.test.js @@ -1,7 +1,13 @@ const PAGE_PATH = "/pages/API/request-payment/request-payment"; -describe("payment", () => { +describe("payment", () => { + if (process.env.uniTestPlatformInfo.indexOf('web') > -1) { + it('web', () => { + expect(1).toBe(1) + }) + return + } beforeAll(async () => { page = await program.reLaunch(PAGE_PATH) await page.waitFor(600) diff --git a/pages/component/general-event/transition-event.test.js b/pages/component/general-event/transition-event.test.js index 2f29bc8d..0d3453bf 100644 --- a/pages/component/general-event/transition-event.test.js +++ b/pages/component/general-event/transition-event.test.js @@ -1,12 +1,6 @@ // uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ describe('transition event', () => { - if (process.env.uniTestPlatformInfo.indexOf('web') > -1) { - it('dummyTest', () => { - expect(1).toBe(1) - }) - return - } let page; beforeAll(async () => { page = await program.reLaunch('/pages/component/general-event/transition-event') diff --git a/pages/component/list-view/list-view-multiplex.test.js b/pages/component/list-view/list-view-multiplex.test.js index e6e3b129..dc065795 100644 --- a/pages/component/list-view/list-view-multiplex.test.js +++ b/pages/component/list-view/list-view-multiplex.test.js @@ -1,10 +1,4 @@ -describe('component-native-list-view', () => { - if (process.env.uniTestPlatformInfo.startsWith('web')) { - it('dummyTest', async () => { - expect(1).toBe(1) - }) - return - } +describe('component-native-list-view', () => { let page beforeAll(async () => { //打开list-view-multiplex测试页 diff --git a/pages/component/list-view/list-view.test.js b/pages/component/list-view/list-view.test.js index 317ed304..1f36e693 100644 --- a/pages/component/list-view/list-view.test.js +++ b/pages/component/list-view/list-view.test.js @@ -1,10 +1,4 @@ -describe('component-native-list-view', () => { - if (process.env.uniTestPlatformInfo.startsWith('web')) { - it('dummyTest', async () => { - expect(1).toBe(1) - }) - return - } +describe('component-native-list-view', () => { let page beforeAll(async () => { //打开list-view测试页 @@ -31,26 +25,20 @@ describe('component-native-list-view', () => { expect(scrollTop-600).toBeGreaterThanOrEqual(0) }) - //检测竖向scroll_into_view属性赋值 - it('check_scroll_into_view_top', async () => { - await page.callMethod('item_change_size_enum', 3) + + //检测横向scrollLeft属性赋值 + it('check_scroll_left', async () => { + await page.callMethod('confirm_scroll_left_input', 600) await page.waitFor(600) const listElement = await page.$('#listview') - const scrollTop = await listElement.attribute("scrollTop") - console.log("check_scroll_into_view_top--"+scrollTop) - await page.callMethod('item_change_size_enum', 0) - expect(scrollTop-690).toBeGreaterThanOrEqual(0) + const scrollLeft = await listElement.attribute("scrollLeft") + console.log("check_scroll_left---"+scrollLeft) + expect(scrollLeft-600).toBeGreaterThanOrEqual(0) }) - //检测下拉刷新 - it('check_refresher', async () => { - await page.setData({ - refresher_enabled_boolean: true, - refresher_triggered_boolean: true - }) - await page.waitFor(2000) - expect(await page.data('refresherrefresh')).toBe(true) - }) + if (process.env.uniTestPlatformInfo.indexOf('web') > -1) { + return + } //检测横向可滚动区域 it('check_scroll_width', async () => { @@ -61,14 +49,25 @@ describe('component-native-list-view', () => { expect(value).toBe(true) }) - //检测横向scrollLeft属性赋值 - it('check_scroll_left', async () => { - await page.callMethod('confirm_scroll_left_input', 600) + //检测下拉刷新 + it('check_refresher', async () => { + await page.setData({ + refresher_enabled_boolean: true, + refresher_triggered_boolean: true + }) + await page.waitFor(2000) + expect(await page.data('refresherrefresh')).toBe(true) + }) + + //检测竖向scroll_into_view属性赋值 + it('check_scroll_into_view_top', async () => { + await page.callMethod('item_change_size_enum', 3) await page.waitFor(600) const listElement = await page.$('#listview') - const scrollLeft = await listElement.attribute("scrollLeft") - console.log("check_scroll_left---"+scrollLeft) - expect(scrollLeft-600).toBeGreaterThanOrEqual(0) + const scrollTop = await listElement.attribute("scrollTop") + console.log("check_scroll_into_view_top--"+scrollTop) + await page.callMethod('item_change_size_enum', 0) + expect(scrollTop-690).toBeGreaterThanOrEqual(0) }) //检测横向scroll_into_view属性赋值 diff --git a/pages/component/text/text-props.test.js b/pages/component/text/text-props.test.js index 727975f2..8c60a266 100644 --- a/pages/component/text/text-props.test.js +++ b/pages/component/text/text-props.test.js @@ -21,6 +21,10 @@ describe('text-props', () => { } }) + if (process.env.uniTestPlatformInfo.indexOf('web') > -1) { + return + } + it('text nested', async () => { page.callMethod("setTextNested") const element = await page.$('#text-nested') -- GitLab