playwright-api
Original:🇺🇸 English
Translated
Explains how to add playwright API methods.
7installs
Sourcemicrosoft/playwright
Added on
NPX Install
npx skill4agent add microsoft/playwright playwright-apiTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →API
Adding and modifying APIs
- Before performing the implementation, go over the steps to understand and plan the work ahead. It is important to follow the steps in order, as some of them are prerequisites for others.
- Define (or update) API in . For the new methods, params and options use the version from package.json (without -next).
docs/api/class-xxx.md - Watch will kick in and re-generate types for the API
- Implement the new API in
packages/playwright/src/client/xxx.ts - Define (or update) channel for the API in as needed
packages/protocol/src/protocol.yml - Watch will kick in and re-generate types for protocol channels
- Implement dispatcher handler in as needed
packages/playwright/src/server/dispatchers/xxxDispatcher.ts - Handler should just route the call into the corresponding method in
packages/playwright-core/src/server/xxx.ts - Place new tests in or create new test file if needed
tests/page/xxx.spec.ts
Build
- Assume watch is running and everything is up to date.
Test
- If your tests are only using page, prefer to place them in and use page fixture. If you need to use browser context, place them in
tests/page/xxx.spec.ts.tests/library/xxx.spec.ts - Run npm test as
npm run ctest <file>
Lint
- In the end lint via .
npm run flint