From 77cca286af16112016c50d90855ecd725d5bfa93 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Tue, 23 Aug 2022 14:01:11 +0800 Subject: [PATCH] test(#39807): add a failed test case --- .../image-future/default/pages/static-img.js | 4 ++ .../image-future/default/test/static.test.ts | 38 ++++++++++++++----- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/test/integration/image-future/default/pages/static-img.js b/test/integration/image-future/default/pages/static-img.js index d5ce76c1289809b..6b6b4cfd5739e33 100644 --- a/test/integration/image-future/default/pages/static-img.js +++ b/test/integration/image-future/default/pages/static-img.js @@ -36,6 +36,10 @@ const Page = () => { + + + +
diff --git a/test/integration/image-future/default/test/static.test.ts b/test/integration/image-future/default/test/static.test.ts index 7e02bf407b2b8d0..b2d08bc857a1389 100644 --- a/test/integration/image-future/default/test/static.test.ts +++ b/test/integration/image-future/default/test/static.test.ts @@ -6,6 +6,7 @@ import { renderViaHTTP, File, waitFor, + launchApp, } from 'next-test-utils' import webdriver from 'next-webdriver' import { join } from 'path' @@ -29,6 +30,10 @@ const runTests = () => { expect(await browser.elementById('static-gif')).toBeTruthy() expect(await browser.elementById('static-bmp')).toBeTruthy() expect(await browser.elementById('static-ico')).toBeTruthy() + expect(await browser.elementById('static-svg-fill')).toBeTruthy() + expect(await browser.elementById('static-gif-fill')).toBeTruthy() + expect(await browser.elementById('static-bmp-fill')).toBeTruthy() + expect(await browser.elementById('static-ico-fill')).toBeTruthy() expect(await browser.elementById('static-unoptimized')).toBeTruthy() }) it('Should use immutable cache-control header for static import', async () => { @@ -90,15 +95,30 @@ describe('Build Error Tests', () => { }) }) describe('Future Static Image Component Tests', () => { - beforeAll(async () => { - await nextBuild(appDir) - appPort = await findPort() - app = await nextStart(appDir, appPort) - html = await renderViaHTTP(appPort, '/static-img') - browser = await webdriver(appPort, '/static-img') + describe('production mode', () => { + beforeAll(async () => { + await nextBuild(appDir) + appPort = await findPort() + app = await nextStart(appDir, appPort) + html = await renderViaHTTP(appPort, '/static-img') + browser = await webdriver(appPort, '/static-img') + }) + afterAll(() => { + killApp(app) + }) + runTests() }) - afterAll(() => { - killApp(app) + + describe('dev mode', () => { + beforeAll(async () => { + appPort = await findPort() + app = await launchApp(appDir, appPort) + html = await renderViaHTTP(appPort, '/static-img') + browser = await webdriver(appPort, '/static-img') + }) + afterAll(() => { + killApp(app) + }) + runTests() }) - runTests() })