playwright-webext
Playwright-webext is a set of Playwright fixtures and helpers that make testing browser extensions easier.
Features
- Access your extension’s APIs with the built-in extension fixture.
- Open and interact with the popup, options, and side panel pages.
- Read and write extension storage directly from test.
- Trigger actions by emulating browser events.
- Emulate clock in the service worker and extension pages with automatic alarms triggering.
- Check internationalization (i18n) without changing your system language.
- Verify data migration between upgrades.
- Inject a custom init script into the service worker and all extension pages.
- Install extension lazily to prepare browser state.
- Test the flow when extension is disabled or uninstalled.
See the complete example: a TypeScript extension tested with playwright-webext.
Motivation
Playwright's extension guide shows how to launch a browser with an extension, wait for its service worker, and find its ID. You then need to maintain that setup and write helpers for extension tasks.
Playwright-webext handles browser setup and extension installation, so you can focus on testing your extension's functionality using familiar Playwright pages, locators, and assertions.
Proceed to Getting started.