From 61dcbe5c2f1b4c3031cea04e41d8bea2c3aecc69 Mon Sep 17 00:00:00 2001 From: Anne_LXM Date: Thu, 26 Sep 2024 19:51:15 +0800 Subject: [PATCH] =?UTF-8?q?test(picker-view):=E6=9F=90=E4=BA=9B=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=BE=8B=E8=B7=B3=E8=BF=87APP=5FWEBVIEW=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/picker-view/picker-view.test.js | 76 +++++++++---------- 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/pages/component/picker-view/picker-view.test.js b/pages/component/picker-view/picker-view.test.js index efcd2f66..feba2b4d 100644 --- a/pages/component/picker-view/picker-view.test.js +++ b/pages/component/picker-view/picker-view.test.js @@ -85,49 +85,45 @@ describe('PickerView.uvue', () => { return } - if (process.env.UNI_AUTOMATOR_APP_WEBVIEW) { - it('platform APP WEBVIEW', () => { - expect(1).toBe(1) + if (process.env.UNI_AUTOMATOR_APP_WEBVIEW !== 'true') { + it('mask-top-bottom-style', async () => { + // App端动态设置mask-top-style、mask-bottom-style无效 + const linearToTop = "background-image: linear-gradient(to bottom, #f4ff73, rgba(216, 229, 255, 0));" + const linearToBottom = "background-image: linear-gradient(to top, #f4ff73, rgba(216, 229, 255, 0));" + await page.setData({ + maskTopStyle: linearToTop, + maskBottomStyle: linearToBottom, + }) + await page.waitFor(500) + expect(await pickerViewEl.attribute('mask-top-style')).toBe(linearToTop) + expect(await pickerViewEl.attribute('mask-bottom-style')).toBe(linearToBottom) + await page.waitFor(2000) + await toScreenshot('picker-view-app-mask-top-bottom-style') }) - return - } - it('mask-top-bottom-style', async () => { - // App端动态设置mask-top-style、mask-bottom-style无效 - const linearToTop = "background-image: linear-gradient(to bottom, #f4ff73, rgba(216, 229, 255, 0));" - const linearToBottom = "background-image: linear-gradient(to top, #f4ff73, rgba(216, 229, 255, 0));" - await page.setData({ - maskTopStyle: linearToTop, - maskBottomStyle: linearToBottom, + it('reopen-picker-view-page', async () => { + page = await program.switchTab('/pages/tabBar/component') + await page.waitFor(500) + page = await program.navigateTo(PAGE_PATH) + await page.waitFor(500) + const date = new Date() + const { + year, + month, + day + } = await page.data() + expect(year).toEqual(date.getFullYear()) + expect(month).toEqual(date.getMonth() + 1) + expect(day).toEqual(date.getDate()) }) - await page.waitFor(500) - expect(await pickerViewEl.attribute('mask-top-style')).toBe(linearToTop) - expect(await pickerViewEl.attribute('mask-bottom-style')).toBe(linearToBottom) - await page.waitFor(2000) - await toScreenshot('picker-view-app-mask-top-bottom-style') - }) - it('reopen-picker-view-page', async () => { - page = await program.switchTab('/pages/tabBar/component') - await page.waitFor(500) - page = await program.navigateTo(PAGE_PATH) - await page.waitFor(500) - const date = new Date() - const { - year, - month, - day - } = await page.data() - expect(year).toEqual(date.getFullYear()) - expect(month).toEqual(date.getMonth() + 1) - expect(day).toEqual(date.getDate()) - }) + it('trigger UniPickerViewChangeEvent', async () => { + await page.callMethod('setValue') + await page.waitFor(1500) + const eventCallbackNum = await page.callMethod('getEventCallbackNum') + // 3 times 3*3 + expect(eventCallbackNum).toBe(9) + }) + } - it('trigger UniPickerViewChangeEvent', async () => { - await page.callMethod('setValue') - await page.waitFor(1500) - const eventCallbackNum = await page.callMethod('getEventCallbackNum') - // 3 times 3*3 - expect(eventCallbackNum).toBe(9) - }) }) -- GitLab