Spaces:
Paused
Paused
Pavel Feldman commited on
chore: point to monorepo for the source code (#995)
Browse files- CONTRIBUTING.md +137 -0
- src/README.md +3 -0
CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Contributing
|
| 2 |
+
|
| 3 |
+
## Choose an issue
|
| 4 |
+
|
| 5 |
+
Playwright MCP **requires an issue** for every contribution, except for minor documentation updates.
|
| 6 |
+
|
| 7 |
+
If you are passionate about a bug/feature, but cannot find an issue describing it, **file an issue first**. This will
|
| 8 |
+
facilitate the discussion, and you might get some early feedback from project maintainers before spending your time on
|
| 9 |
+
creating a pull request.
|
| 10 |
+
|
| 11 |
+
## Make a change
|
| 12 |
+
|
| 13 |
+
> [!WARNING]
|
| 14 |
+
> The core of the Playwright MCP was moved to the [Playwright monorepo](https://github.com/microsoft/playwright).
|
| 15 |
+
|
| 16 |
+
Clone the Playwright repository. If you plan to send a pull request, it might be better to [fork the repository](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo) first.
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
```bash
|
| 20 |
+
git clone https://github.com/microsoft/playwright
|
| 21 |
+
cd playwright
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
Install dependencies and run the build in watch mode.
|
| 25 |
+
```bash
|
| 26 |
+
# install deps and run watch
|
| 27 |
+
npm ci
|
| 28 |
+
npm run watch
|
| 29 |
+
npx playwright install
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
Source code for Playwright MCP is located at [packages/playwright/src/mcp](https://github.com/microsoft/playwright/blob/main/packages/playwright/src/mcp).
|
| 33 |
+
|
| 34 |
+
```bash
|
| 35 |
+
# list source files
|
| 36 |
+
ls -la packages/playwright/src/mcp
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
Coding style is fully defined in [eslint.config.mjs](https://github.com/microsoft/playwright/blob/main/eslint.config.mjs). Before creating a pull request, or at any moment during development, run linter to check all kinds of things:
|
| 40 |
+
```bash
|
| 41 |
+
# lint the source base before sending PR
|
| 42 |
+
npm run flint
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
Comments should have an explicit purpose and should improve readability rather than hinder it. If the code would not be understood without comments, consider re-writing the code to make it self-explanatory.
|
| 46 |
+
|
| 47 |
+
## Add a test
|
| 48 |
+
|
| 49 |
+
Playwright requires a test for the new or modified functionality. An exception would be a pure refactoring, but chances are you are doing more than that.
|
| 50 |
+
|
| 51 |
+
There are multiple [test suites](https://github.com/microsoft/playwright/blob/main/tests) in Playwright that will be executed on the CI. Tests for Playwright MCP are located at [tests/mcp](https://github.com/microsoft/playwright/blob/main/tests/mcp).
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
# list test files
|
| 55 |
+
ls -la tests/mcp
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
To run the mcp tests, use
|
| 59 |
+
|
| 60 |
+
```bash
|
| 61 |
+
# fast path runs all MCP tests in Chromium
|
| 62 |
+
npm run mcp-ctest
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
```bash
|
| 66 |
+
# slow path runs all tests in three browsers
|
| 67 |
+
npm run mcp-test
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
Since Playwright tests are using Playwright under the hood, everything from our documentation applies, for example [this guide on running and debugging tests](https://playwright.dev/docs/running-tests#running-tests).
|
| 71 |
+
|
| 72 |
+
Note that tests should be *hermetic*, and not depend on external services. Tests should work on all three platforms: macOS, Linux and Windows.
|
| 73 |
+
|
| 74 |
+
## Write a commit message
|
| 75 |
+
|
| 76 |
+
Commit messages should follow the [Semantic Commit Messages](https://www.conventionalcommits.org/en/v1.0.0/) format:
|
| 77 |
+
|
| 78 |
+
```
|
| 79 |
+
label(namespace): title
|
| 80 |
+
|
| 81 |
+
description
|
| 82 |
+
|
| 83 |
+
footer
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
1. *label* is one of the following:
|
| 87 |
+
- `fix` - bug fixes
|
| 88 |
+
- `feat` - new features
|
| 89 |
+
- `docs` - documentation-only changes
|
| 90 |
+
- `test` - test-only changes
|
| 91 |
+
- `devops` - changes to the CI or build
|
| 92 |
+
- `chore` - everything that doesn't fall under previous categories
|
| 93 |
+
2. *namespace* is put in parentheses after label and is optional. Must be lowercase.
|
| 94 |
+
3. *title* is a brief summary of changes.
|
| 95 |
+
4. *description* is **optional**, new-line separated from title and is in present tense.
|
| 96 |
+
5. *footer* is **optional**, new-line separated from *description* and contains "fixes" / "references" attribution to GitHub issues.
|
| 97 |
+
|
| 98 |
+
Example:
|
| 99 |
+
|
| 100 |
+
```
|
| 101 |
+
feat(trace viewer): network panel filtering
|
| 102 |
+
|
| 103 |
+
This patch adds a filtering toolbar to the network panel.
|
| 104 |
+
<link to a screenshot>
|
| 105 |
+
|
| 106 |
+
Fixes #123, references #234.
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
## Send a pull request
|
| 110 |
+
|
| 111 |
+
All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose.
|
| 112 |
+
Make sure to keep your PR (diff) small and readable. If necessary, split your contribution into multiple PRs.
|
| 113 |
+
Consult [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more information on using pull requests.
|
| 114 |
+
|
| 115 |
+
After a successful code review, one of the maintainers will merge your pull request. Congratulations!
|
| 116 |
+
|
| 117 |
+
## More details
|
| 118 |
+
|
| 119 |
+
**No new dependencies**
|
| 120 |
+
|
| 121 |
+
There is a very high bar for new dependencies, including updating to a new version of an existing dependency. We recommend to explicitly discuss this in an issue and get a green light from a maintainer, before creating a pull request that updates dependencies.
|
| 122 |
+
|
| 123 |
+
## Contributor License Agreement
|
| 124 |
+
|
| 125 |
+
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
| 126 |
+
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
| 127 |
+
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
|
| 128 |
+
|
| 129 |
+
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
|
| 130 |
+
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
|
| 131 |
+
provided by the bot. You will only need to do this once across all repos using our CLA.
|
| 132 |
+
|
| 133 |
+
### Code of Conduct
|
| 134 |
+
|
| 135 |
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
| 136 |
+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
| 137 |
+
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
src/README.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Where is the source?
|
| 2 |
+
|
| 3 |
+
Playwright MCP source code is located in the Playwright monorepo. Please refer to the contributor's guide in [CONTRIBUTING.md](../CONTRIBUTING.md) for more details.
|