How it’s setup
In short terms:- The
@playwright/testdependency is installed at the root of the monorepo to provide a way of runningplaywright install-deps --with-depsto install the necessary browser binaries without having to change directories. - The
@playwright/testdependency is also installed in each of the applications. - Tests are written in an
e2edirectory in each application. - The
playwright.config.tsinside each of the applications is used to configure the tests. - To run the tests, you use turborepo and the
turbo test:e2ecommand. Filtering to a single application is done using the--filterflag followed by the application name such asturbo test:e2e --filter=@orbitkit/web. - To provide more flags to playwright while running it, you can do so by adding
-- --followed by the flags. For example,turbo test:e2e --filter=@orbitkit/web -- --headedwill run the tests in the web application in headed mode. - There is also a playwright specific eslint configuration in
packages/config/eslint/playwright.jsthat is used to lint the tests and is added onto the eslint configuration of each app that uses playwright usingorbitkit/playwrightin the extends array.
Writing tests
To write tests, you can create a new file in thee2e directory of the application you want to write the test for. The file should have a .spec.ts extension.
Here is an example of a test file:
CI setup
In CI, the tests are run per application in a separate job. Refer to the.github/workflows/pr-ci.yml file to see how the tests are run in CI.