Skip to content

Commit 89ed45a

Browse files
Wait for redirect to set cookies
1 parent 3b9bff9 commit 89ed45a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

test/integration/auth.setup.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { test as setup } from '@playwright/test';
22
import path from 'path';
3-
import { BASE_URL } from './utils';
43

54
const authFile = path.join(__dirname, './.auth/user.json');
65

@@ -9,9 +8,11 @@ setup.describe('setup', () => {
98
await page.goto('/wp-login.php');
109
await page.fill('#user_login', 'admin');
1110
await page.fill('#user_pass', 'password');
12-
await page.getByRole('button', { name: 'Log In' }).click();
1311

14-
await page.waitForURL(`${BASE_URL}/wp-admin`);
12+
await Promise.all([
13+
page.waitForURL('**/wp-admin/**', { timeout: 15000 }),
14+
page.getByRole('button', { name: 'Log In' }).click(),
15+
]);
1516

1617
await page.context().storageState({ path: authFile });
1718
});

0 commit comments

Comments
 (0)