From 5c7a95547de36b8dd0ccffdfa54a59aa67c3fa5f Mon Sep 17 00:00:00 2001 From: anne-xml Date: Thu, 12 Dec 2024 16:49:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4element-get-attribute?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../element-get-attribute.test.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pages/API/element-get-attribute/element-get-attribute.test.js b/pages/API/element-get-attribute/element-get-attribute.test.js index 1fc25191..885d5c58 100644 --- a/pages/API/element-get-attribute/element-get-attribute.test.js +++ b/pages/API/element-get-attribute/element-get-attribute.test.js @@ -1,7 +1,12 @@ jest.setTimeout(30000); describe('test element-get-attribute', () => { - let page,platform,attrStyle,propertyValue; - platform = process.env.UNI_PLATFORM + let page; + const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase() + const isAndroid = platformInfo.startsWith('android') + const isIos = platformInfo.startsWith('ios') + const isApp = isAndroid || isIos + const isWeb = platformInfo.startsWith('web') + const isMP = platformInfo.startsWith('mp') beforeAll(async () => { page = await program.reLaunch('/pages/API/element-get-attribute/element-get-attribute') await page.waitFor(3000); @@ -12,19 +17,19 @@ describe('test element-get-attribute', () => { }); it('check setStyle getAttributeStyle', async () => { await page.callMethod('setStyle') - if(platform != 'app-plus'){ + if(isWeb||isMP){ await page.callMethod('getAttributeStyle') console.log('attrStyle:',await page.data('attrStyle')) - attrStyle = platform == 'mp-weixin'?'background-color:#FFF000;':'padding: 0.625rem; background-color: rgb(255, 240, 0);' + const attrStyle = isMP?'background-color:#FFF000;':'padding: 0.625rem; background-color: rgb(255, 240, 0);' expect(await page.data('attrStyle')).toEqual(attrStyle); } }); it('check getPropertyValue', async () => { await page.callMethod('getPropertyValue') - propertyValue = platform == 'h5'?'rgb(255, 240, 0)':'#FFF000' + const propertyValue = isWeb?'rgb(255, 240, 0)':'#FFF000' expect(await page.data('propertyValue')).toEqual(propertyValue); }); - if(platform != 'h5'){ + if(isApp||isMP){ it('check scrollTo', async () => { await page.callMethod('scrollTo') await page.waitFor(100); -- GitLab