From e86ab2307913054d994eab422c0f1b07ced2e720 Mon Sep 17 00:00:00 2001 From: yinjiacheng Date: Fri, 1 Mar 2024 19:23:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0image=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/image/image.test.js | 17 +++++++++++++++++ pages/component/image/image.uvue | 10 +++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/pages/component/image/image.test.js b/pages/component/image/image.test.js index c6294ba6..26fd38e5 100644 --- a/pages/component/image/image.test.js +++ b/pages/component/image/image.test.js @@ -30,6 +30,23 @@ describe('component-native-image', () => { expect(await page.data('loadError')).toBe(true) }) + it('check-cookie', async () => { + await page.setData({ + autoTest: true, + setCookieImage: 'https://cdn.dcloud.net.cn/img/shadow-grey.png' + }); + await page.waitFor(1000); + await page.setData({ + loadError: false, + verifyCookieImage: 'https://request.dcloud.net.cn/img/shadow-grey.png' + }); + await page.waitFor(1000); + expect(await page.data('loadError')).toBe(false); + await page.setData({ + autoTest: false + }); + }) + it('path-screenshot', async () => { const page = await program.navigateTo('/pages/component/image/image-path'); await page.waitFor(3000); diff --git a/pages/component/image/image.uvue b/pages/component/image/image.uvue index 64a5accb..42e9f4ca 100644 --- a/pages/component/image/image.uvue +++ b/pages/component/image/image.uvue @@ -17,6 +17,10 @@ + + + + @@ -26,7 +30,11 @@ return { title: 'image', imageSrc: "/static/test-image/logo.png" as string.ImageURIString, - loadError: false + loadError: false, + // 自动化测试 + autoTest: false, + setCookieImage: "", + verifyCookieImage: "" } }, methods: { -- GitLab