arrow-left Back to topicQuizAuthenticationCheck yourself1.What does Playwright's storageState save?Only session cookiesCookies, localStorage and sessionStorageThe full browser cache including images2.You have 60 tests. Most just read data, but 5 create new records. What's the best auth strategy?Log in at the start of every testShared auth file for all testsSeparate auth per parallel worker3.Where should the playwright/.auth directory be added to avoid committing session tokens to the repository?.npmignore.gitignore.dockerignoreplaywright.config.ts excludes field4.How do you tell a test project in playwright.config.ts to start every browser context already authenticated?Set authFile: 'playwright/.auth/user.json' in the project use blockSet storageState: 'playwright/.auth/user.json' in the project use blockImport the JSON file and pass it to page.context().addCookies()Set sessionFile: 'playwright/.auth/user.json' in the global use block5.In playwright.config.ts, which property on a test project ensures the setup project runs before it?requires: ['setup']before: ['setup']dependencies: ['setup']runAfter: ['setup']6.Why is authenticating via an API endpoint faster than driving the login form through the browser UI?The API skips TLS handshake so the connection is fasterAPI auth avoids launching a browser page, loading assets, and simulating user interactions — it's a single HTTP requestPlaywright caches API responses so subsequent runs skip the request entirelyAPI auth uses a different browser process that starts faster7.Your app has admin and regular user roles. How do you handle multiple auth files in playwright.config.ts?Use one storageState file and switch roles inside each test using page.evaluate()Create a separate test project per role, each with its own storageState path pointing to a different auth fileStore all roles in one JSON file and pick the role with an environment variablePass a roles array to the storageState option8.What testMatch pattern is typically used on the setup project to match only auth setup files?/.*\.spec\.ts//.*\.setup\.ts//.*\.before\.ts/'**/*.config.ts'Submit answersarrow-left PreviousAPI testingIsolationNext arrow-right