Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
agoldis committed Jan 24, 2024
1 parent 8cc1a1e commit d3840dd
Show file tree
Hide file tree
Showing 5 changed files with 1,971 additions and 328 deletions.
127 changes: 83 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,83 @@
# playwright-bdd-example

Example project that uses [playwright-bdd](https://github.com/vitalets/playwright-bdd) to run BDD tests.

## How to run it locally

1. Clone repo
```
git clone https://github.com/vitalets/playwright-bdd-example.git
```

2. CD into directory
```
cd playwright-bdd-example
```

2. Install dependencies
```
npm install
```

3. Install browsers
```
npx playwright install
```

4. Run tests
```
npm test
```
Output:
```
Running 2 tests using 1 worker
2 passed (2.3s)
```

5. Check out the report
```
npm run report
```
<details>
<summary>Report</summary>
<img src="https://github.com/vitalets/playwright-bdd/assets/1473072/4e2e4803-118a-40bd-a583-7dbe93b9ffd2"/>
</details>
# Playwright + Currents + playwright-bdd (Cucumber)

This repository showcases running[Playwright](https://playwright.dev) + [Currents](https://currents.dev) + [playwright-bdd](https://github.com/vitalets/playwright-bdd) to run BDD tests, while using [Currents](https://currents.dev) as the reporting dashboard.

<p align="center">
<img width="830" src="https://static.currents.dev/currents-playwright-banner-gh.png" />
</p>

## Why?

`cucumber-js` is a mature and popular test runner, however, it is different from the native Playwright test runner - those are not compatible. To utilize the native Playwright test runner with BDD it is suggested to use [playwright-bdd](https://github.com/vitalets/playwright-bdd).

Read more at: https://www.cy2pw.com/cucumber.

## Documentation

The repo contains a few BDD tests with one test that always fails (intentionally):

- [features/homepage.feature](features/homepage.feature) - has intentionally failing test
- [features/todopage.feature](features/todopage.feature)

To reproduce the setup:

- Create an organization, get your **Record Key** and **Project Id** at https://app.currents.dev

- Clone repo

```sh
git clone https://github.com/vitalets/playwright-bdd-example.git
```

- CD into directory

```sh
cd playwright-bdd-example
```

- Install dependencies

```sh
npm install
```

- Install browsers

```sh
npx playwright install
```

- Run tests

```sh
npm test
```

Output:

```sh
Running 2 tests using 1 worker
2 passed (2.3s)
```

Additional resources:

- Playwright Features on Currents: https://currents.dev/playwright
- Integration Documentation: https://currents.dev/readme/integration-with-playwright/currents-playwright
- CI Build ID Guide: https://currents.dev/readme/guides/cypress-ci-build-id

## Results

The results are being reported to Currents for more efficient troubleshooting, and monitoring test suite flakiness and performance.

Currents will collect the following information:

- console output
- screenshots
- videos
- trace files
- timing
- outcomes
- flaky tests
- error details
- tags for more convenient management of the tests
2 changes: 1 addition & 1 deletion features/homepage.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ Feature: Playwright Home Page
Examples:
| link | title |
| Get started | Installation |
| API reference | Library |
| API reference | Oh no! |
Loading

0 comments on commit d3840dd

Please sign in to comment.