Setup Currents Actions

Setting up Current Actions for your Playwright Project

Requirements

  • Only available for Playwright

  • Requires @currents/playwright v1.9.0+

Overview

Setting up the Currents Actions consists of 3 steps:

  1. Setting up the project

  2. Configuring Playwright fixtures

  3. Updating the tests code

Setting up the Currents Reporter

Install and configure Currents reporter following Your First Playwright Run guide.

Add Playwright Fixtures

@currents/playwright provides a Playwright fixture that must be installed to enable Currents fixtures.

It is a good practice to extend the default Playwright test method, for example to enable Page Object Model, sharing a state between multiple tests etc. See Currents Fixtures for Playwright for more information.

base.ts
 import {
   CurrentsFixtures,
   CurrentsWorkerFixtures,
   fixtures,
 } from "@currents/playwright";
 import { test as base } from "@playwright/test";
 
 export const test = base.extend<CurrentsFixtures, CurrentsWorkerFixtures>({
   ...fixtures.baseFixtures,
   ...fixtures.actionFixtures,
 });

Update Tests

Import and use the extended test for every test case to enable the rules engine for that test.

import { expect } from "@playwright/test";
import { test } from "./base.ts";

Optional: conditionally enable fixtures only on CI

After extending the test method, many Currents fixtures are enabled by default. If you wish to only conditionally enable them (such as only in CI) you can use the currentsFixturesEnabled property in your playwright.config.ts file.

playwright.config.ts
// ...
use: {
  ...
  currentsFixturesEnabled: !!process.env.CI,
},

Last updated