Skip to content

Playwright Testing Last-Minute Revision

Quickly revise the questions you picked. Add questions from the interview-questions lists with Save to → Last-Minute Revision.

30 quick revision notes for Playwright Testing

  1. Playwright auto-waits for elements to be attached, visible, stable, enabled and receiving events before performing actions like click.
  2. Prefer locators in this order: getByRole, getByLabel, getByPlaceholder, getByText, getByTestId, and use CSS or XPath only as a last resort.
  3. Locators are strict: an action fails with a strict mode violation if the locator matches more than one element.
  4. Web-first assertions like await expect(locator).toBeVisible() retry until they pass or the timeout, which is 5 seconds by default.
  5. toHaveText checks the full text while toContainText passes when the expected text appears anywhere inside the element.
  6. expect.poll retries a function returning a value; expect(...).toPass retries a whole block of actions and assertions.
  7. A browser context is an isolated session with its own cookies and storage, and every test gets a fresh one by default.
  8. Browser, context and page form a hierarchy: one browser has many contexts, and one context has many pages or tabs.
  9. Fixtures set up a resource before await use() and tear it down after, even when the test fails.
  10. Test-scoped fixtures run for every test, worker-scoped fixtures run once per worker process and are shared by its tests.
  11. beforeAll runs once per worker, not once per whole run, so use a setup project for true one-time setup.
  12. Save login with storageState in a setup project and reuse it with use: { storageState } to avoid logging in every test.
  13. page.route intercepts matching requests; route.fulfill fakes a response, route.continue passes it on, route.abort fails it.
  14. Start page.waitForResponse before the action that triggers the request, otherwise the response may be missed.
  15. routeFromHAR replays recorded network traffic from a HAR file, and update: true records a fresh version.
  16. Set serviceWorkers: 'block' when mocking, because service workers can answer requests before page.route sees them.
  17. The request fixture is an APIRequestContext that uses baseURL and extraHTTPHeaders from the config.
  18. API calls do not throw on 4xx or 5xx by default; check status yourself or set failOnStatusCode: true.
  19. 401 means not authenticated, 403 means authenticated but not allowed; test both for protected endpoints.
  20. trace: 'on-first-retry' records traces only on retries, keeping normal runs fast while capturing flaky failures.
  21. Open traces with npx playwright show-trace trace.zip or at trace.playwright.dev; open reports with npx playwright show-report.
  22. Use npx playwright test --debug or page.pause() to open the Inspector and step through actions.
  23. UI mode, opened with --ui, lets you run, watch and time-travel through tests with a trace-like timeline.
  24. --repeat-each with several workers and retries set to zero is the quickest way to reproduce a flaky test locally.
  25. fullyParallel: true runs tests inside a file in parallel; by default only different files run in parallel.
  26. Shard large suites with --shard=1/4 and combine results with the blob reporter and npx playwright merge-reports.
  27. forbidOnly: !!process.env.CI makes the CI run fail if someone accidentally commits a test.only call to the repository.
  28. In CI install browsers with npx playwright install --with-deps or use the official Docker image of the same version.
  29. A missing await on a Playwright call causes flaky or silently passing tests; the no-floating-promises lint rule catches it.
  30. Use for...of with await instead of forEach with an async callback, because forEach does not wait for promises.

Night-before checklist

  • Revise your saved questions on this page once, aloud.
  • Read the quick notes and mark any you cannot explain in one line.
  • Rehearse a two-minute self-introduction and two project stories.
  • Keep CV, ID, laptop charger and interview link ready; sleep on time.

Frequently asked questions

How does Last-Minute Revision work?

On any question page, open Save to → Last-Minute Revision. Saved questions appear here with their answers, so the night before an interview you revise only what you found hard.

Is my list saved?

Yes, in this browser. Guests can save 5 questions; free accounts can save 20 for revision and 100 for the 7-day plan.

What should I revise last before a Playwright Testing interview?

Your saved misses first, then the quick notes on this page, then one or two project stories. Avoid learning brand-new topics the night before.