From 27f83eec7dfcc373021a8e00d5903797bda08385 Mon Sep 17 00:00:00 2001 From: yurj26 <1816387074@qq.com> Date: Thu, 26 Oct 2023 19:44:17 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E4=BC=98=E5=8C=96waitfor=20=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/button/button.test.js | 9 ++------- pages/component/checkbox/checkbox.test.js | 5 +---- pages/component/picker-view/picker-view.test.js | 10 ++++------ pages/component/progress/progress.test.js | 17 ++++++----------- pages/component/radio/radio.test.js | 5 +---- 5 files changed, 14 insertions(+), 32 deletions(-) diff --git a/pages/component/button/button.test.js b/pages/component/button/button.test.js index 76cb4fcf..7fb1a908 100644 --- a/pages/component/button/button.test.js +++ b/pages/component/button/button.test.js @@ -4,7 +4,7 @@ describe('Button.uvue', () => { let page beforeAll(async () => { page = await program.reLaunch(PAGE_PATH) - await page.waitFor(500) + await page.waitFor('view') }) it('click', async () => { // TODO 待测试框架支持text的dispatchEvent @@ -41,12 +41,10 @@ describe('Button.uvue', () => { await page.setData({ type_enum_current: 1, }) - await page.waitFor(500) expect(await btn.property('type')).toBe('primary') await page.setData({ type_enum_current: 2, }) - await page.waitFor(500) expect(await btn.property('type')).toBe('warn') }) it('size', async () => { @@ -55,7 +53,6 @@ describe('Button.uvue', () => { await page.setData({ size_enum_current: 1, }) - await page.waitFor(500) expect(await btn.property('size')).toBe('mini') }) it('plain', async () => { @@ -64,7 +61,6 @@ describe('Button.uvue', () => { await page.setData({ plain_boolean: true, }) - await page.waitFor(500) expect(await btn.property('plain')).toBe(true) }) it('disabled', async () => { @@ -73,7 +69,6 @@ describe('Button.uvue', () => { await page.setData({ disabled_boolean: true, }) - await page.waitFor(500) expect(await btn.property('disabled')).toBe(true) }) -}) \ No newline at end of file +}) diff --git a/pages/component/checkbox/checkbox.test.js b/pages/component/checkbox/checkbox.test.js index c3a31094..103e48bd 100644 --- a/pages/component/checkbox/checkbox.test.js +++ b/pages/component/checkbox/checkbox.test.js @@ -8,7 +8,7 @@ function getData(key = '') { let page beforeAll(async () => { page = await program.reLaunch('/pages/component/checkbox/checkbox') - await page.waitFor(1000) + await page.waitFor('view') }) describe('Checkbox.uvue', () => { @@ -46,7 +46,6 @@ describe('Checkbox.uvue', () => { await page.setData({ checked: false, }) - await page.waitFor(500) expect(await cb.property('checked')).toBe(false) }) it('color', async () => { @@ -55,7 +54,6 @@ describe('Checkbox.uvue', () => { await page.setData({ color: '#63acfc', }) - await page.waitFor(500) expect(await cb.property('color')).toBe('#63acfc') }) it('disabled', async () => { @@ -64,7 +62,6 @@ describe('Checkbox.uvue', () => { await page.setData({ disabled: false, }) - await page.waitFor(500) expect(await cb.property('disabled')).toBe(false) }) }) diff --git a/pages/component/picker-view/picker-view.test.js b/pages/component/picker-view/picker-view.test.js index da7cb110..a4e515bf 100644 --- a/pages/component/picker-view/picker-view.test.js +++ b/pages/component/picker-view/picker-view.test.js @@ -8,18 +8,18 @@ function getData(key = '') { let page beforeAll(async () => { page = await program.reLaunch('/pages/component/picker-view/picker-view') - await page.waitFor(1000) + await page.waitFor('view') }) describe('PickerView.uvue', () => { it('value', async () => { const el = await page.$('.picker-view') - await page.callMethod('setValue') + await page.callMethod('setValue') await page.waitFor(1000) expect(await el.property('value')).toEqual([0, 0, 0]) expect(await getData('result')).toEqual([0, 0, 0]) - await page.callMethod('setValue1') + await page.callMethod('setValue1') await page.waitFor(1000) expect(await el.property('value')).toEqual([10, 10, 10]) expect(await getData('result')).toEqual([10, 10, 10]) @@ -35,7 +35,7 @@ describe('PickerView.uvue', () => { const el = await page.$('.picker-view') await page.setData({ indicatorStyle: 'height: 100px;', - }) + }) await page.waitFor(500) expect(await el.property('indicatorStyle')).toBe('height: 100px;') }) @@ -44,7 +44,6 @@ describe('PickerView.uvue', () => { await page.setData({ maskTopStyle: 'background: #ffffff;', }) - await page.waitFor(500) expect(await el.property('mask-top-style')).toBe('background: #ffffff;') }) it('mask-bottom-style', async () => { @@ -52,7 +51,6 @@ describe('PickerView.uvue', () => { await page.setData({ maskBottomStyle: 'background: #ffffff;', }) - await page.waitFor(500) expect(await el.property('mask-bottom-style')).toBe('background: #ffffff;') }) }) diff --git a/pages/component/progress/progress.test.js b/pages/component/progress/progress.test.js index de652ae7..b53b99bc 100644 --- a/pages/component/progress/progress.test.js +++ b/pages/component/progress/progress.test.js @@ -8,7 +8,7 @@ function getData(key = '') { let page beforeAll(async () => { page = await program.reLaunch('/pages/component/progress/progress') - await page.waitFor(1000) + await page.waitFor('view') }) describe('Progress.uvue', () => { @@ -17,15 +17,15 @@ describe('Progress.uvue', () => { const p1 = await page.$('.p1') const p2 = await page.$('.p2') const p3 = await page.$('.p3') - page.callMethod('setProgress') - await page.waitFor(1000) + page.callMethod('setProgress') + await page.waitFor(500) expect(await p.property('percent')).toEqual(20) expect(await p1.property('percent')).toEqual(40) expect(await p2.property('percent')).toEqual(60) expect(await p3.property('percent')).toEqual(80) expect(await getData('curPercent')).toEqual(20) - page.callMethod('clearProgress') - await page.waitFor(1000) + page.callMethod('clearProgress') + await page.waitFor(500) expect(await p.property('percent')).toEqual(0) expect(await p1.property('percent')).toEqual(0) expect(await p2.property('percent')).toEqual(0) @@ -42,7 +42,6 @@ describe('Progress.uvue', () => { await page.setData({ showInfo: false }) - await page.waitFor(500) expect(await el.property('show-info')).toEqual(false) }) it('border-radius', async () => { @@ -51,7 +50,6 @@ describe('Progress.uvue', () => { await page.setData({ borderRadius: 5 }) - await page.waitFor(500) expect(await el.property('border-radius')).toEqual(5) }) it('font-size', async () => { @@ -60,7 +58,6 @@ describe('Progress.uvue', () => { await page.setData({ fontSize: 18 }) - await page.waitFor(500) expect(await el.property('font-size')).toEqual(18) }) it('stroke-width', async () => { @@ -69,7 +66,6 @@ describe('Progress.uvue', () => { await page.setData({ strokeWidth: 6 }) - await page.waitFor(500) expect(await el.property('stroke-width')).toEqual(6) }) it('backgroundColor', async () => { @@ -78,7 +74,6 @@ describe('Progress.uvue', () => { await page.setData({ backgroundColor: "#007aff" }) - await page.waitFor(500) expect(await el.property('background-color')).toEqual('#007aff') }) -}) \ No newline at end of file +}) diff --git a/pages/component/radio/radio.test.js b/pages/component/radio/radio.test.js index e5e175f1..b0642430 100644 --- a/pages/component/radio/radio.test.js +++ b/pages/component/radio/radio.test.js @@ -8,7 +8,7 @@ function getData(key = '') { let page beforeAll(async () => { page = await program.reLaunch('/pages/component/radio/radio') - await page.waitFor(1000) + await page.waitFor('view') }) describe('Radio.uvue', () => { @@ -44,7 +44,6 @@ describe('Radio.uvue', () => { await page.setData({ checked: false, }) - await page.waitFor(500) expect(await radio.property('checked')).toBe(false) }) it('color', async () => { @@ -53,7 +52,6 @@ describe('Radio.uvue', () => { await page.setData({ color: '#63acfc', }) - await page.waitFor(500) expect(await radio.property('color')).toBe('#63acfc') }) it('disabled', async () => { @@ -62,7 +60,6 @@ describe('Radio.uvue', () => { await page.setData({ disabled: false, }) - await page.waitFor(500) expect(await radio.property('disabled')).toBe(false) }) }) -- GitLab