Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f4b59b6 commit 2b133ffCopy full SHA for 2b133ff
tests/utils/playwright-helpers.ts
@@ -14,6 +14,7 @@ const makeE2EFixture = (
14
15
export const test = base.extend<
16
{
17
+ ensureStaticAssetsHaveImmutableCacheControl: void
18
takeScreenshot: void
19
pollUntilHeadersMatch: (
20
url: string,
@@ -91,4 +92,19 @@ export const test = base.extend<
91
92
},
93
{ auto: true },
94
],
95
+ ensureStaticAssetsHaveImmutableCacheControl: [
96
+ async ({ page }, use) => {
97
+ page.on('response', (response) => {
98
+ if (response.url().includes('/_next/static/')) {
99
+ expect(
100
+ response.headers()['cache-control'],
101
+ '_next/static assets should have immutable cache control',
102
+ ).toContain('public,max-age=31536000,immutable')
103
+ }
104
+ })
105
+
106
+ await use()
107
+ },
108
+ { auto: true },
109
+ ],
110
})
0 commit comments