docs(auth): use abs path, difference between storage locations
Reference: https://github.com/microsoft/playwright/issues/31987
This commit is contained in:
parent
d0c840f639
commit
77395fa70d
|
|
@ -29,6 +29,8 @@ New-Item -ItemType Directory -Force -Path playwright\.auth
|
||||||
Add-Content -path .gitignore "`r`nplaywright/.auth"
|
Add-Content -path .gitignore "`r`nplaywright/.auth"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that you need to delete the stored state when it expires. If you don't need to keep the state between test runs, write the browser state under [`property: TestProject.outputDir`], which is automatically cleaned up before every test run.
|
||||||
|
|
||||||
## Basic: shared account in all tests
|
## Basic: shared account in all tests
|
||||||
* langs: js
|
* langs: js
|
||||||
|
|
||||||
|
|
@ -47,8 +49,9 @@ Create `tests/auth.setup.ts` that will prepare authenticated browser state for a
|
||||||
|
|
||||||
```js title="tests/auth.setup.ts"
|
```js title="tests/auth.setup.ts"
|
||||||
import { test as setup, expect } from '@playwright/test';
|
import { test as setup, expect } from '@playwright/test';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
const authFile = 'playwright/.auth/user.json';
|
const authFile = path.join(__dirname, '../playwright/.auth/user.json');
|
||||||
|
|
||||||
setup('authenticate', async ({ page }) => {
|
setup('authenticate', async ({ page }) => {
|
||||||
// Perform authentication steps. Replace these actions with your own.
|
// Perform authentication steps. Replace these actions with your own.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue