From 279cb01c59885c2386f682b80615e21c17c99cc7 Mon Sep 17 00:00:00 2001 From: yinjiacheng Date: Thu, 5 Dec 2024 19:22:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0font-family=E7=A4=BA=E4=BE=8B?= =?UTF-8?q?=E5=92=8C=E8=87=AA=E5=8A=A8=E5=8C=96=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/CSS/text/font-family-icon.test.js | 35 +++++++++++++++++++++++++ pages/CSS/text/font-family-icon.uvue | 14 ++++++++-- pages/pages.test.js | 3 +-- 3 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 pages/CSS/text/font-family-icon.test.js diff --git a/pages/CSS/text/font-family-icon.test.js b/pages/CSS/text/font-family-icon.test.js new file mode 100644 index 00000000..dbd1caaa --- /dev/null +++ b/pages/CSS/text/font-family-icon.test.js @@ -0,0 +1,35 @@ +// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ +describe('css-font-family-icon', () => { + const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase(); + const isMP = platformInfo.startsWith('mp'); + const isWeb = platformInfo.startsWith('web'); + let page; + + if (isWeb || isMP || process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true') { + it('other platform', () => { + expect(1).toBe(1); + }); + return; + } + + beforeAll(async () => { + page = await program.reLaunch('/pages/CSS/text/font-family-icon'); + await page.waitFor(1000); + }); + + it('screenshot', async () => { + const image = await program.screenshot({ + fullPage: true + }); + expect(image).toSaveImageSnapshot(); + }); + + it('screenshot after changeStyle', async () => { + await page.callMethod('changeStyle'); + await page.waitFor(500); + const image = await program.screenshot({ + fullPage: true + }); + expect(image).toSaveImageSnapshot(); + }); +}); diff --git a/pages/CSS/text/font-family-icon.uvue b/pages/CSS/text/font-family-icon.uvue index 2a422d5e..6cbbd767 100644 --- a/pages/CSS/text/font-family-icon.uvue +++ b/pages/CSS/text/font-family-icon.uvue @@ -5,7 +5,7 @@ - {{String.fromCharCode(parseInt(item.code,16))}} + {{String.fromCharCode(parseInt(item.code,16))}} \u{{item.code}} {{item.name}} @@ -106,8 +106,18 @@ 'name':'search', 'code':'EA23', } - ] as Icon[], + ] as Icon[], + // 自动化测试 + fontWeight: 'normal', + fontStyle: 'normal' } + }, + methods: { + // 自动化测试 + changeStyle() { + this.fontWeight = 'bold'; + this.fontStyle = 'italic'; + } } } diff --git a/pages/pages.test.js b/pages/pages.test.js index 92cf0651..96e1e67f 100755 --- a/pages/pages.test.js +++ b/pages/pages.test.js @@ -307,8 +307,7 @@ if (isApp && !isAppWebview) { '/pages/API/request-payment/request-payment', '/pages/API/theme-change/theme-change', '/pages/API/share-with-system/share-with-system', - '/pages/template/scroll-sticky/scroll-sticky', - '/pages/CSS/text/font-family-icon', + '/pages/template/scroll-sticky/scroll-sticky' ) } -- GitLab