Unverified Commit 0c70a7c3 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

test: Fix service worker error test (#95548)

- One of them tests that an error is thrown. Don't run the deployment
test there
- The other tests are still broken when deployed, but we will fix that
separately
parent 3e11c728
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils' import { retry } from 'next-test-utils'
describe('app dir - service worker (multiple registrations error)', () => { // Compiling `navigator.serviceWorker.register(new URL(...))` is a Turbopack-only feature.
const { next, isTurbopack, isNextDev } = nextTestSetup({ ;(process.env.IS_TURBOPACK_TEST ? describe : describe.skip)(
'app dir - service worker (multiple registrations error)',
() => {
const { next, skipped, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipStart: true, skipStart: true,
skipDeployment: true,
}) })
if (!isTurbopack) { if (skipped) {
// Compiling `navigator.serviceWorker.register(new URL(...))` is a
// Turbopack-only feature.
it('skips on webpack', () => {})
return return
} }
...@@ -28,4 +29,5 @@ describe('app dir - service worker (multiple registrations error)', () => { ...@@ -28,4 +29,5 @@ describe('app dir - service worker (multiple registrations error)', () => {
) )
}) })
}) })
}) }
)
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils' import { retry } from 'next-test-utils'
describe('app dir - service worker (one worker per scope)', () => { // Compiling `navigator.serviceWorker.register(new URL(...))` is a
const { next, isTurbopack } = nextTestSetup({ // Turbopack-only feature.
;(process.env.IS_TURBOPACK_TEST ? describe : describe.skip)(
'app dir - service worker (one worker per scope)',
() => {
const { next } = nextTestSetup({
files: __dirname, files: __dirname,
}) })
if (!isTurbopack) {
it('skips on webpack', () => {})
return
}
it('serves one worker per scope at scope-derived file names', async () => { it('serves one worker per scope at scope-derived file names', async () => {
const browser = await next.browser('/') const browser = await next.browser('/')
...@@ -43,4 +42,5 @@ describe('app dir - service worker (one worker per scope)', () => { ...@@ -43,4 +42,5 @@ describe('app dir - service worker (one worker per scope)', () => {
expect(offline.headers.get('cache-control')).toContain('max-age=0') expect(offline.headers.get('cache-control')).toContain('max-age=0')
expect(offline.headers.get('cache-control')).not.toContain('immutable') expect(offline.headers.get('cache-control')).not.toContain('immutable')
}) })
}) }
)
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils' import { retry } from 'next-test-utils'
describe('app dir - service worker register', () => { // Compiling `navigator.serviceWorker.register(new URL(...))` is a
const { next, isTurbopack } = nextTestSetup({ // Turbopack-only feature.
;(process.env.IS_TURBOPACK_TEST ? describe : describe.skip)(
'app dir - service worker register',
() => {
const { next } = nextTestSetup({
files: __dirname, files: __dirname,
}) })
if (!isTurbopack) {
// Compiling `navigator.serviceWorker.register(new URL(...))` is a
// Turbopack-only feature.
it('skips on webpack', () => {})
return
}
it('registers the service worker and controls the page at scope "/"', async () => { it('registers the service worker and controls the page at scope "/"', async () => {
const browser = await next.browser('/') const browser = await next.browser('/')
...@@ -77,4 +74,5 @@ describe('app dir - service worker register', () => { ...@@ -77,4 +74,5 @@ describe('app dir - service worker register', () => {
) )
}) })
}) })
}) }
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment