Skip to content

Commit

Permalink
docs: add currents
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalets committed Feb 19, 2025
1 parent cb7fd3b commit d8c99ab
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
- [Component tests](guides/component-tests.md)
- [IDE integration](guides/ide-integration.md)
- [Usage with Nx](guides/usage-with-nx.md)
- [Usage with Currents](guides/usage-with-currents.md)
- [Usage with SauceLabs](guides/usage-with-saucelabs.md)
- [Usage with BrowserStack](guides/usage-with-browserstack.md)

Expand Down
Binary file added docs/guides/_media/currents.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions docs/guides/usage-with-currents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Usage with Currents

You can integrate Playwright-BDD tests with [Currents](https://currents.dev/) dashboard.

#### 1. [Sign-up](https://app.currents.dev/signup) to Currents and create a new project
Refer to [Playwright setup instruction](https://docs.currents.dev/getting-started/playwright/you-first-playwright-run) in case of any issues.

#### 2. Install dependencies
Run the following command to install Currents + Playwright reporter:
```sh
npm i -D @currents/playwright
```
Install [dotenv](https://www.npmjs.com/package/dotenv) for managing Currents credentials:
```sh
npm i -D dotenv
```

#### 3. Setup credentials
Create the `.env` file with the following variables:
```
CURRENTS_RECORD_KEY=YOUR_RECORD_KEY # the record key from https://app.currents.dev
CURRENTS_PROJECT_ID=YOUR_PROJECT_ID # the projectId from https://app.currents.dev
```

#### 4. Adjust Playwright configuration

In the Playwright config file `playwright.config.ts` setup Currents reporter:

```ts
import 'dotenv/config';
import { defineConfig, devices } from '@playwright/test';
import { defineBddConfig } from 'playwright-bdd';
import { CurrentsConfig, currentsReporter } from '@currents/playwright';

const currentsConfig: CurrentsConfig = {
recordKey: process.env.CURRENTS_RECORD_KEY || '',
projectId: process.env.CURRENTS_PROJECT_ID || '',
};

const testDir = defineBddConfig({
features: 'features/*.feature',
steps: 'features/steps/*.ts',
});

export default defineConfig({
testDir,
reporter: [currentsReporter(currentsConfig)],
use: {
screenshot: 'on',
trace: 'on',
},
});
```

#### 5. Run tests
```
npx bddgen && npx playwright test
```

Check out the results in [Currents dashboard](https://app.currents.dev/):

![Currents dashboard](./_media/currents.png)

> Here is the [fully working example with Currents](https://github.com/vitalets/playwright-bdd-example/tree/currents).

0 comments on commit d8c99ab

Please sign in to comment.