feat(web): clear selected cookies without resetting app storage

Merged
RU
18d ago
+175-6
  • Adds browser.clearCookies({ name?, domain?, path? }) for login/logout tests that drop some cookies but keep the rest of the app state. Wraps Playwright's context.clearCookies(options).
  • Filters combine; a string matches exactly, a RegExp matches the field. No options clears every cookie. Local and session storage stay.
  • Unknown keys or non string/RegExp values throw INVALID_ARGUMENT before anything is cleared.
  • Exports CookieFilter; docs/reference/web.mdx, the Playwright migration table and the writing-tests skill list it.
await browser.clearCookies({ name: /^session/, path: '/' });

Verified

Ran it locally: yes

  • packages/web/tests/integration/clear-cookies.test.ts against real Chromium: combined filters, exact string vs RegExp, HttpOnly by domain, clear-all keeping storage, invalid input refused with nothing cleared. The 4 filter cases fail when the options are not passed to context.clearCookies.
  • packages/web/tests/types/clear-cookies.ts pins the filter types.