You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Explains how to add playwright API methods.
4
+
---
5
+
6
+
# API
7
+
8
+
## Adding and modifying APIs
9
+
- 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.
10
+
- Define (or update) API in `docs/api/class-xxx.md`. For the new methods, params and options use the version from package.json (without -next).
11
+
- Watch will kick in and re-generate types for the API
12
+
- Implement the new API in `packages/playwright/src/client/xxx.ts`
13
+
- Define (or update) channel for the API in `packages/protocol/src/protocol.yml` as needed
14
+
- Watch will kick in and re-generate types for protocol channels
15
+
- Implement dispatcher handler in `packages/playwright/src/server/dispatchers/xxxDispatcher.ts` as needed
16
+
- Handler should just route the call into the corresponding method in `packages/playwright-core/src/server/xxx.ts`
17
+
- Place new tests in `tests/page/xxx.spec.ts` or create new test file if needed
18
+
19
+
# Build
20
+
- Assume watch is running and everything is up to date.
21
+
22
+
# Test
23
+
- If your tests are only using page, prefer to place them in `tests/page/xxx.spec.ts` and use page fixture. If you need to use browser context, place them in `tests/library/xxx.spec.ts`.
0 commit comments