Debian Codegraph @

tests/functional/redirects.spec.ts

raw
1 import { test } from '@playwright/test';
2
3 import { expectToBeAt } from '../support/commands.js';
4 import { expectSwupToHaveCacheEntries, navigateWithSwup } from '../support/swup.js';
5
6 test.describe('redirects', () => {
7 test.beforeEach(async ({ page }) => {
8 // The redirects are handled by the server in tests/config/serve.json
9 await page.goto('/redirect-1.html');
10 });
11
12 test('follows redirects', async ({ page }) => {
13 await navigateWithSwup(page, '/redirect-2.html');
14 await expectToBeAt(page, '/redirect-3.html', 'Redirect 3');
15 });
16
17 test('does not cache redirects', async ({ page }) => {
18 await navigateWithSwup(page, '/redirect-2.html');
19 await expectToBeAt(page, '/redirect-3.html', 'Redirect 3');
20 await expectSwupToHaveCacheEntries(page, []);
21 });
22 });