From 7f60f284c65d6790c5a025a6b47235f0adf033bf Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Tue, 6 Aug 2024 11:36:49 -0700 Subject: [PATCH] docs(auth): use abs path, difference between storage locations (#32037) Reference: https://github.com/microsoft/playwright/issues/31987 --- docs/src/auth.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/src/auth.md b/docs/src/auth.md index 1224292775..a070d2d395 100644 --- a/docs/src/auth.md +++ b/docs/src/auth.md @@ -47,8 +47,9 @@ Create `tests/auth.setup.ts` that will prepare authenticated browser state for a ```js title="tests/auth.setup.ts" 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 }) => { // Perform authentication steps. Replace these actions with your own. @@ -113,6 +114,8 @@ test('test', async ({ page }) => { }); ``` +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. + ### Authenticating in UI mode * langs: js