From 43956da47424f69aeccc8d96dfb612b780d558af Mon Sep 17 00:00:00 2001 From: shutao Date: Fri, 29 Mar 2024 12:50:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0background-image=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/CSS/background/background-image.test.js | 21 +++++++++++++++++++ pages/CSS/background/background-image.uvue | 9 +++++++- pages/pages.test.js | 1 - 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 pages/CSS/background/background-image.test.js diff --git a/pages/CSS/background/background-image.test.js b/pages/CSS/background/background-image.test.js new file mode 100644 index 00000000..2ed0a6c4 --- /dev/null +++ b/pages/CSS/background/background-image.test.js @@ -0,0 +1,21 @@ +describe('background-image-test', () => { + let page; + beforeAll(async () => { + page = await program.reLaunch('/pages/CSS/background/background-image'); + await page.waitFor(600); + }); + + + it('background-image-screenshot', async () => { + await page.waitFor(300); + const image = await program.screenshot(); + expect(image).toSaveImageSnapshot(); + }); + + it('background-image-select', async () => { + await page.callMethod('updateBackgroundSelect') + await page.waitFor(300); + const image = await program.screenshot(); + expect(image).toSaveImageSnapshot(); + }); +}); diff --git a/pages/CSS/background/background-image.uvue b/pages/CSS/background/background-image.uvue index bad58e8d..c2a2a785 100644 --- a/pages/CSS/background/background-image.uvue +++ b/pages/CSS/background/background-image.uvue @@ -6,7 +6,7 @@ 不支持背景图片,仅支持linear-gradient方法 background-image: linear-gradient({{direction}}, red, yellow) - + @@ -18,8 +18,15 @@ export default { data(){ return { + backgroundSelect : true, directionData: ['to right', 'to left', 'to bottom', 'to top', 'to bottom left', 'to bottom right', 'to top left', 'to top right'] } + }, + methods: { + //供自动化测试使用 + updateBackgroundSelect() { + this.backgroundSelect = !this.backgroundSelect + } } } diff --git a/pages/pages.test.js b/pages/pages.test.js index 1b1b1d75..563f1850 100755 --- a/pages/pages.test.js +++ b/pages/pages.test.js @@ -38,7 +38,6 @@ const pages = [ // CSS '/pages/CSS/background/background-color', - '/pages/CSS/background/background-image', '/pages/CSS/border/complex-border/complex-border', '/pages/CSS/border/border-bottom', '/pages/CSS/border/border-color', -- GitLab