-
Notifications
You must be signed in to change notification settings - Fork 453
Expand file tree
/
Copy pathprefetch-ui.test.ts
More file actions
32 lines (25 loc) · 1.08 KB
/
prefetch-ui.test.ts
File metadata and controls
32 lines (25 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { expect, test } from '@playwright/test';
import type { Application } from '../models/application';
import { appConfigs } from '../presets';
test.describe('prefetchUI disabled @nextjs', () => {
test.describe.configure({ mode: 'serial' });
let app: Application;
test.beforeAll(async () => {
app = await appConfigs.next.appRouter.clone().commit();
await app.setup();
// Use withEmailCodes but disable the UI prefetching
const env = appConfigs.envs.withEmailCodes.clone().setEnvVariable('public', 'CLERK_PREFETCH_UI_DISABLED', 'true');
await app.withEnv(env);
await app.dev();
});
test.afterAll(async () => {
await app.teardown();
});
test('does not inject clerk-ui script when prefetchUI is disabled', async ({ page }) => {
await page.goto(app.serverUrl);
// Wait for clerk-js script to be present (ensures page has loaded)
await expect(page.locator('script[data-clerk-js-script]')).toBeAttached();
// clerk-ui script should NOT be present
await expect(page.locator('script[data-clerk-ui-script]')).not.toBeAttached();
});
});