Skip to content

Commit

Permalink
test(vercel#39807): add a failed test case
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Aug 23, 2022
1 parent 31bcd04 commit 77cca28
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
4 changes: 4 additions & 0 deletions test/integration/image-future/default/pages/static-img.js
Expand Up @@ -36,6 +36,10 @@ const Page = () => {
<Image id="static-gif" src={testGIF} />
<Image id="static-bmp" src={testBMP} />
<Image id="static-ico" src={testICO} />
<Image id="static-svg-fill" src={testSVG} fill />
<Image id="static-gif-fill" src={testGIF} fill />
<Image id="static-bmp-fill" src={testBMP} fill />
<Image id="static-ico-fill" src={testICO} fill />
<br />
<Image id="static-unoptimized" src={testJPG} unoptimized />
</div>
Expand Down
38 changes: 29 additions & 9 deletions test/integration/image-future/default/test/static.test.ts
Expand Up @@ -6,6 +6,7 @@ import {
renderViaHTTP,
File,
waitFor,
launchApp,
} from 'next-test-utils'
import webdriver from 'next-webdriver'
import { join } from 'path'
Expand All @@ -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 () => {
Expand Down Expand Up @@ -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()
})

0 comments on commit 77cca28

Please sign in to comment.