提交 27f83eec 编写于 作者: Y yurj26

test: 优化waitfor 时间

上级 9a487ea3
...@@ -4,7 +4,7 @@ describe('Button.uvue', () => { ...@@ -4,7 +4,7 @@ describe('Button.uvue', () => {
let page let page
beforeAll(async () => { beforeAll(async () => {
page = await program.reLaunch(PAGE_PATH) page = await program.reLaunch(PAGE_PATH)
await page.waitFor(500) await page.waitFor('view')
}) })
it('click', async () => { it('click', async () => {
// TODO 待测试框架支持text的dispatchEvent // TODO 待测试框架支持text的dispatchEvent
...@@ -41,12 +41,10 @@ describe('Button.uvue', () => { ...@@ -41,12 +41,10 @@ describe('Button.uvue', () => {
await page.setData({ await page.setData({
type_enum_current: 1, type_enum_current: 1,
}) })
await page.waitFor(500)
expect(await btn.property('type')).toBe('primary') expect(await btn.property('type')).toBe('primary')
await page.setData({ await page.setData({
type_enum_current: 2, type_enum_current: 2,
}) })
await page.waitFor(500)
expect(await btn.property('type')).toBe('warn') expect(await btn.property('type')).toBe('warn')
}) })
it('size', async () => { it('size', async () => {
...@@ -55,7 +53,6 @@ describe('Button.uvue', () => { ...@@ -55,7 +53,6 @@ describe('Button.uvue', () => {
await page.setData({ await page.setData({
size_enum_current: 1, size_enum_current: 1,
}) })
await page.waitFor(500)
expect(await btn.property('size')).toBe('mini') expect(await btn.property('size')).toBe('mini')
}) })
it('plain', async () => { it('plain', async () => {
...@@ -64,7 +61,6 @@ describe('Button.uvue', () => { ...@@ -64,7 +61,6 @@ describe('Button.uvue', () => {
await page.setData({ await page.setData({
plain_boolean: true, plain_boolean: true,
}) })
await page.waitFor(500)
expect(await btn.property('plain')).toBe(true) expect(await btn.property('plain')).toBe(true)
}) })
it('disabled', async () => { it('disabled', async () => {
...@@ -73,7 +69,6 @@ describe('Button.uvue', () => { ...@@ -73,7 +69,6 @@ describe('Button.uvue', () => {
await page.setData({ await page.setData({
disabled_boolean: true, disabled_boolean: true,
}) })
await page.waitFor(500)
expect(await btn.property('disabled')).toBe(true) expect(await btn.property('disabled')).toBe(true)
}) })
}) })
\ No newline at end of file
...@@ -8,7 +8,7 @@ function getData(key = '') { ...@@ -8,7 +8,7 @@ function getData(key = '') {
let page let page
beforeAll(async () => { beforeAll(async () => {
page = await program.reLaunch('/pages/component/checkbox/checkbox') page = await program.reLaunch('/pages/component/checkbox/checkbox')
await page.waitFor(1000) await page.waitFor('view')
}) })
describe('Checkbox.uvue', () => { describe('Checkbox.uvue', () => {
...@@ -46,7 +46,6 @@ describe('Checkbox.uvue', () => { ...@@ -46,7 +46,6 @@ describe('Checkbox.uvue', () => {
await page.setData({ await page.setData({
checked: false, checked: false,
}) })
await page.waitFor(500)
expect(await cb.property('checked')).toBe(false) expect(await cb.property('checked')).toBe(false)
}) })
it('color', async () => { it('color', async () => {
...@@ -55,7 +54,6 @@ describe('Checkbox.uvue', () => { ...@@ -55,7 +54,6 @@ describe('Checkbox.uvue', () => {
await page.setData({ await page.setData({
color: '#63acfc', color: '#63acfc',
}) })
await page.waitFor(500)
expect(await cb.property('color')).toBe('#63acfc') expect(await cb.property('color')).toBe('#63acfc')
}) })
it('disabled', async () => { it('disabled', async () => {
...@@ -64,7 +62,6 @@ describe('Checkbox.uvue', () => { ...@@ -64,7 +62,6 @@ describe('Checkbox.uvue', () => {
await page.setData({ await page.setData({
disabled: false, disabled: false,
}) })
await page.waitFor(500)
expect(await cb.property('disabled')).toBe(false) expect(await cb.property('disabled')).toBe(false)
}) })
}) })
...@@ -8,18 +8,18 @@ function getData(key = '') { ...@@ -8,18 +8,18 @@ function getData(key = '') {
let page let page
beforeAll(async () => { beforeAll(async () => {
page = await program.reLaunch('/pages/component/picker-view/picker-view') page = await program.reLaunch('/pages/component/picker-view/picker-view')
await page.waitFor(1000) await page.waitFor('view')
}) })
describe('PickerView.uvue', () => { describe('PickerView.uvue', () => {
it('value', async () => { it('value', async () => {
const el = await page.$('.picker-view') const el = await page.$('.picker-view')
await page.callMethod('setValue') await page.callMethod('setValue')
await page.waitFor(1000) await page.waitFor(1000)
expect(await el.property('value')).toEqual([0, 0, 0]) expect(await el.property('value')).toEqual([0, 0, 0])
expect(await getData('result')).toEqual([0, 0, 0]) expect(await getData('result')).toEqual([0, 0, 0])
await page.callMethod('setValue1') await page.callMethod('setValue1')
await page.waitFor(1000) await page.waitFor(1000)
expect(await el.property('value')).toEqual([10, 10, 10]) expect(await el.property('value')).toEqual([10, 10, 10])
expect(await getData('result')).toEqual([10, 10, 10]) expect(await getData('result')).toEqual([10, 10, 10])
...@@ -35,7 +35,7 @@ describe('PickerView.uvue', () => { ...@@ -35,7 +35,7 @@ describe('PickerView.uvue', () => {
const el = await page.$('.picker-view') const el = await page.$('.picker-view')
await page.setData({ await page.setData({
indicatorStyle: 'height: 100px;', indicatorStyle: 'height: 100px;',
}) })
await page.waitFor(500) await page.waitFor(500)
expect(await el.property('indicatorStyle')).toBe('height: 100px;') expect(await el.property('indicatorStyle')).toBe('height: 100px;')
}) })
...@@ -44,7 +44,6 @@ describe('PickerView.uvue', () => { ...@@ -44,7 +44,6 @@ describe('PickerView.uvue', () => {
await page.setData({ await page.setData({
maskTopStyle: 'background: #ffffff;', maskTopStyle: 'background: #ffffff;',
}) })
await page.waitFor(500)
expect(await el.property('mask-top-style')).toBe('background: #ffffff;') expect(await el.property('mask-top-style')).toBe('background: #ffffff;')
}) })
it('mask-bottom-style', async () => { it('mask-bottom-style', async () => {
...@@ -52,7 +51,6 @@ describe('PickerView.uvue', () => { ...@@ -52,7 +51,6 @@ describe('PickerView.uvue', () => {
await page.setData({ await page.setData({
maskBottomStyle: 'background: #ffffff;', maskBottomStyle: 'background: #ffffff;',
}) })
await page.waitFor(500)
expect(await el.property('mask-bottom-style')).toBe('background: #ffffff;') expect(await el.property('mask-bottom-style')).toBe('background: #ffffff;')
}) })
}) })
...@@ -8,7 +8,7 @@ function getData(key = '') { ...@@ -8,7 +8,7 @@ function getData(key = '') {
let page let page
beforeAll(async () => { beforeAll(async () => {
page = await program.reLaunch('/pages/component/progress/progress') page = await program.reLaunch('/pages/component/progress/progress')
await page.waitFor(1000) await page.waitFor('view')
}) })
describe('Progress.uvue', () => { describe('Progress.uvue', () => {
...@@ -17,15 +17,15 @@ describe('Progress.uvue', () => { ...@@ -17,15 +17,15 @@ describe('Progress.uvue', () => {
const p1 = await page.$('.p1') const p1 = await page.$('.p1')
const p2 = await page.$('.p2') const p2 = await page.$('.p2')
const p3 = await page.$('.p3') const p3 = await page.$('.p3')
page.callMethod('setProgress') page.callMethod('setProgress')
await page.waitFor(1000) await page.waitFor(500)
expect(await p.property('percent')).toEqual(20) expect(await p.property('percent')).toEqual(20)
expect(await p1.property('percent')).toEqual(40) expect(await p1.property('percent')).toEqual(40)
expect(await p2.property('percent')).toEqual(60) expect(await p2.property('percent')).toEqual(60)
expect(await p3.property('percent')).toEqual(80) expect(await p3.property('percent')).toEqual(80)
expect(await getData('curPercent')).toEqual(20) expect(await getData('curPercent')).toEqual(20)
page.callMethod('clearProgress') page.callMethod('clearProgress')
await page.waitFor(1000) await page.waitFor(500)
expect(await p.property('percent')).toEqual(0) expect(await p.property('percent')).toEqual(0)
expect(await p1.property('percent')).toEqual(0) expect(await p1.property('percent')).toEqual(0)
expect(await p2.property('percent')).toEqual(0) expect(await p2.property('percent')).toEqual(0)
...@@ -42,7 +42,6 @@ describe('Progress.uvue', () => { ...@@ -42,7 +42,6 @@ describe('Progress.uvue', () => {
await page.setData({ await page.setData({
showInfo: false showInfo: false
}) })
await page.waitFor(500)
expect(await el.property('show-info')).toEqual(false) expect(await el.property('show-info')).toEqual(false)
}) })
it('border-radius', async () => { it('border-radius', async () => {
...@@ -51,7 +50,6 @@ describe('Progress.uvue', () => { ...@@ -51,7 +50,6 @@ describe('Progress.uvue', () => {
await page.setData({ await page.setData({
borderRadius: 5 borderRadius: 5
}) })
await page.waitFor(500)
expect(await el.property('border-radius')).toEqual(5) expect(await el.property('border-radius')).toEqual(5)
}) })
it('font-size', async () => { it('font-size', async () => {
...@@ -60,7 +58,6 @@ describe('Progress.uvue', () => { ...@@ -60,7 +58,6 @@ describe('Progress.uvue', () => {
await page.setData({ await page.setData({
fontSize: 18 fontSize: 18
}) })
await page.waitFor(500)
expect(await el.property('font-size')).toEqual(18) expect(await el.property('font-size')).toEqual(18)
}) })
it('stroke-width', async () => { it('stroke-width', async () => {
...@@ -69,7 +66,6 @@ describe('Progress.uvue', () => { ...@@ -69,7 +66,6 @@ describe('Progress.uvue', () => {
await page.setData({ await page.setData({
strokeWidth: 6 strokeWidth: 6
}) })
await page.waitFor(500)
expect(await el.property('stroke-width')).toEqual(6) expect(await el.property('stroke-width')).toEqual(6)
}) })
it('backgroundColor', async () => { it('backgroundColor', async () => {
...@@ -78,7 +74,6 @@ describe('Progress.uvue', () => { ...@@ -78,7 +74,6 @@ describe('Progress.uvue', () => {
await page.setData({ await page.setData({
backgroundColor: "#007aff" backgroundColor: "#007aff"
}) })
await page.waitFor(500)
expect(await el.property('background-color')).toEqual('#007aff') expect(await el.property('background-color')).toEqual('#007aff')
}) })
}) })
\ No newline at end of file
...@@ -8,7 +8,7 @@ function getData(key = '') { ...@@ -8,7 +8,7 @@ function getData(key = '') {
let page let page
beforeAll(async () => { beforeAll(async () => {
page = await program.reLaunch('/pages/component/radio/radio') page = await program.reLaunch('/pages/component/radio/radio')
await page.waitFor(1000) await page.waitFor('view')
}) })
describe('Radio.uvue', () => { describe('Radio.uvue', () => {
...@@ -44,7 +44,6 @@ describe('Radio.uvue', () => { ...@@ -44,7 +44,6 @@ describe('Radio.uvue', () => {
await page.setData({ await page.setData({
checked: false, checked: false,
}) })
await page.waitFor(500)
expect(await radio.property('checked')).toBe(false) expect(await radio.property('checked')).toBe(false)
}) })
it('color', async () => { it('color', async () => {
...@@ -53,7 +52,6 @@ describe('Radio.uvue', () => { ...@@ -53,7 +52,6 @@ describe('Radio.uvue', () => {
await page.setData({ await page.setData({
color: '#63acfc', color: '#63acfc',
}) })
await page.waitFor(500)
expect(await radio.property('color')).toBe('#63acfc') expect(await radio.property('color')).toBe('#63acfc')
}) })
it('disabled', async () => { it('disabled', async () => {
...@@ -62,7 +60,6 @@ describe('Radio.uvue', () => { ...@@ -62,7 +60,6 @@ describe('Radio.uvue', () => {
await page.setData({ await page.setData({
disabled: false, disabled: false,
}) })
await page.waitFor(500)
expect(await radio.property('disabled')).toBe(false) expect(await radio.property('disabled')).toBe(false)
}) })
}) })
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册