From f5380920b7a132c901e7e1f53e06644d30277ada Mon Sep 17 00:00:00 2001 From: yinjiacheng Date: Mon, 20 Nov 2023 13:47:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=A1=B5=E9=9D=A2=E6=88=AA?= =?UTF-8?q?=E5=9B=BE=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.test.js | 16 ++++++++++++++++ pages/pages.test.js | 14 ++------------ pages/template/list-news/list-news.test.js | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 pages/CSS/text/font-family.test.js create mode 100644 pages/template/list-news/list-news.test.js diff --git a/pages/CSS/text/font-family.test.js b/pages/CSS/text/font-family.test.js new file mode 100644 index 00000000..34eee55e --- /dev/null +++ b/pages/CSS/text/font-family.test.js @@ -0,0 +1,16 @@ +// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ + +describe('css-font-family', () => { + let page; + beforeAll(async () => { + page = await program.reLaunch('/pages/CSS/text/font-family'); + await page.waitFor(3000); + }); + + it('screenshot', async () => { + const image = await program.screenshot({ + fullPage: true + }) + expect(image).toMatchImageSnapshot() + }); +}); diff --git a/pages/pages.test.js b/pages/pages.test.js index 0b5d1268..c51c99af 100755 --- a/pages/pages.test.js +++ b/pages/pages.test.js @@ -84,7 +84,7 @@ const pages = [ '/pages/CSS/padding/padding-top', '/pages/CSS/padding/padding', '/pages/CSS/text/color', - '/pages/CSS/text/font-family', + // '/pages/CSS/text/font-family', // 网络资源加载 '/pages/CSS/text/font-size', '/pages/CSS/text/font-style', '/pages/CSS/text/font-weight', @@ -110,8 +110,7 @@ const pages = [ '/pages/template/custom-tab-bar/custom-tab-bar', // '/pages/template/drop-card/drop-card', '/pages/template/half-screen/half-screen', - '/pages/template/list-news/list-news', - '/pages/template/list-news/detail/detail', + // '/pages/template/list-news/list-news', // 网络资源加载 // '/pages/template/long-list/long-list', // 动态内容 '/pages/template/navbar-lite/navbar-lite', '/pages/template/pull-zoom-image/pull-zoom-image', @@ -125,12 +124,6 @@ const pages = [ '/pages/API/element-draw/element-draw', ] -const needDelayPages = [ - "/pages/CSS/text/font-family", // load network font - "/pages/template/list-news/list-news", // load network image - "/pages/component/list-view/list-view", // delay wait scroll to disappear -]; - let page; describe("page screenshot test", () => { beforeAll(async () => { @@ -138,9 +131,6 @@ describe("page screenshot test", () => { }); beforeEach(async () => { page = await program.reLaunch(pages[pageIndex]); - if (needDelayPages.includes(pages[pageIndex])) { - await page.waitFor(2000); - } await page.waitFor(1000); }); afterEach(() => { diff --git a/pages/template/list-news/list-news.test.js b/pages/template/list-news/list-news.test.js new file mode 100644 index 00000000..78f6d5f5 --- /dev/null +++ b/pages/template/list-news/list-news.test.js @@ -0,0 +1,16 @@ +// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ + +describe('template-list-news', () => { + let page; + beforeAll(async () => { + page = await program.reLaunch('/pages/template/list-news/list-news'); + await page.waitFor(3000); + }); + + it('screenshot', async () => { + const image = await program.screenshot({ + fullPage: true + }) + expect(image).toMatchImageSnapshot() + }); +}); -- GitLab