Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
jfgreffier committed Oct 21, 2024
1 parent 2257b21 commit 7e69420
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

Adds [Playwright Test](https://playwright.dev/) to your Angular project

## Add Playwright to your Angular project
## Installation

Run the following to add Playwright to your Angular project
```bash
ng add playwright-ng-schematics
```
Expand All @@ -16,8 +17,11 @@ Once installed, you can run the tests
npm run e2e
```

## Run tests
You can also use `ng` to run your tests
## Usage

### Run tests

You can also use the Angular CLI `ng` to run your tests
```bash
ng e2e
```
Expand All @@ -29,8 +33,9 @@ ng e2e --ui

For a list of accepted arguments, use `ng e2e --help`. If you need more options and control on the CLI, the best solution is to use `npx playwright test` directly.

### Run an Angular dev server
If a `devServerTarget` option is specified, the builder will launch an Angular server and will set `PLAYWRIGHT_TEST_BASE_URL` environment variable automatically.
### Start an Angular development server

If a `devServerTarget` option is specified, the builder will launch an Angular server and will automatically set the `PLAYWRIGHT_TEST_BASE_URL` environment variable.

```json title="angular.json"
"e2e": {
Expand All @@ -48,7 +53,7 @@ If a `devServerTarget` option is specified, the builder will launch an Angular s
```

You still can make use of Playwright's `baseURL` option and mix it with `PLAYWRIGHT_TEST_BASE_URL` env variable.
The example below has projects using `PLAYWRIGHT_TEST_BASE_URL` (set by `devServerTarget`) or other base URL.
The example below shows projects using `PLAYWRIGHT_TEST_BASE_URL` (set by `devServerTarget`) or another base URL.

```ts title="playwright.config.ts"
// ...
Expand All @@ -65,7 +70,7 @@ The example below has projects using `PLAYWRIGHT_TEST_BASE_URL` (set by `devServ
]
```

## Create a test file
### Create a test file

Create a new empty test
```bash
Expand All @@ -74,12 +79,13 @@ ng generate playwright-ng-schematics:e2e "<TestName>"

## Migrate from Protractor

Read the [Migrating from Protractor](https://playwright.dev/docs/protractor) guide from Playwright official website.
Read the [Migrating from Protractor](https://playwright.dev/docs/protractor) guide on the official Playwright website.

## Contribute

- Small, incremental changes are easier to review.
- Conventional Commits. NO EMOJI

## License

This project is licensed under an Apache-2.0 license.

0 comments on commit 7e69420

Please sign in to comment.