feat(web): clear selected cookies without resetting app storage
Merged
RU
18d ago+175+175+012345678901234567890123456789-6-6-0123456789
- Adds
browser.clearCookies({ name?, domain?, path? })for login/logout tests that drop some cookies but keep the rest of the app state. Wraps Playwright'scontext.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_ARGUMENTbefore 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.tsagainst 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 tocontext.clearCookies.packages/web/tests/types/clear-cookies.tspins the filter types.