Skip to content

Latest commit

 

History

History
117 lines (81 loc) · 4.18 KB

CONTRIBUTING.md

File metadata and controls

117 lines (81 loc) · 4.18 KB

Contributing

How to Contribute

Installing Developer Tools

Install git, Java JDK (version >= 8), Maven (tested with version 3.6.3), on Ubuntu 20.04 just run the following command:

sudo apt-get install git openjdk-11-jdk maven unzip

Getting the Code

  1. Clone this repository
git clone https://github.com/microsoft/playwright-java
cd playwright-java
  1. Run the following script to download Playwright driver for all platforms into driver-bundle/src/main/resources/driver/ directory (browser binaries for Chromium, Firefox and WebKit will be automatically downloaded later on first Playwright run).
scripts/download_driver.sh

Building and running the tests with Maven

mvn compile
mvn test
# Executing a single test
BROWSER=chromium mvn test --projects=playwright -Dtest=TestPageNetworkSizes#shouldHaveTheCorrectResponseBodySize
# Executing a single test class
BROWSER=chromium mvn test --projects=playwright -Dtest=TestPageNetworkSizes

Generating API

Public Java API is generated from api.json which is produced by print-api-json command of playwright CLI. To regenerate Java interfaces for the current driver run the following commands:

./scripts/download_driver.sh
./scripts/generate_api.sh

Updating driver version

Versions of published driver archives can be found in publish canary and publish release actions logs. To update the driver to a particular version run the following command:

scripts/roll_driver.sh [version]

Code Style

  • We try to follow Google Java Style Guide
  • Comments should be generally avoided. If the code would not be understood without comments, consider re-writing the code to make it self-explanatory.

Code reviews

All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult GitHub Help for more information on using pull requests.

Commit Messages

Commit messages should follow the Semantic Commit Messages format:

label(namespace): title

description

footer
  1. label is one of the following:
    • fix - playwright bug fixes.
    • feat - playwright features.
    • docs - changes to docs, e.g. docs(api.md): .. to change documentation.
    • test - changes to playwright tests infrastructure.
    • devops - build-related work, e.g. CI related patches and general changes to the browser build infrastructure
    • chore - everything that doesn't fall under previous categories
  2. namespace is put in parenthesis after label and is optional. Must be lowercase.
  3. title is a brief summary of changes.
  4. description is optional, new-line separated from title and is in present tense.
  5. footer is optional, new-line separated from description and contains "fixes" / "references" attribution to github issues.

Example:

fix(firefox): make sure session cookies work

This patch fixes session cookies in firefox browser.

Fixes #123, fixes #234

Contributor License Agreement

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.