Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Currents Automation Rules with Playwright
# Currents Actions with Playwright

Playwright [Automation Rules](https://docs.currents.dev/guides/automation-rules) for Currents.
[Currents Actions](https://docs.currents.dev/guides/currents-actions) for Playwright.

This is a simple example Playwright test project, that shows the different ways to configure the Currents Playwright fixtures to apply Rule Automation.
This is a simple example Playwright test project, that shows the different ways to configure the Currents Playwright fixtures to apply Actions.


## Setup
Expand All @@ -11,20 +11,20 @@ This is a simple example Playwright test project, that shows the different ways
- Update `playwright.config.ts` with Currents [record key](https://docs.currents.dev/guides/record-key) and [project id](https://docs.currents.dev/dashboard/projects/project-settings)
- Run `npm run test` for running tests, behind the scenes:
- runs playwright tests
- applied automation rules during the run
- applied Currents Actions during the run
- sends results to the Currents dashboard

## Rules Creation
## Actions Creation

Rules are created in the Currents Dashboard (see https://docs.currents.dev/guides/automation-rules#creating-rules-in-currents for more info)
Actions are created in the Currents Dashboard (see https://docs.currents.dev/guides/automation-rules#creating-rules-in-currents for more info)

<img width="1306" alt="Screenshot 2024-12-10 at 3 22 45 PM" src="https://github.com/user-attachments/assets/d150c645-7b6d-448c-b1a8-31934cf0b460" />

<img width="873" alt="Screenshot 2024-12-10 at 3 27 00 PM" src="https://github.com/user-attachments/assets/75e1165c-f973-4d73-8056-db9dc2a1da4f" />

## Examples

- Run `npm run test:reporter` for using [`playwight test`](https://docs.currents.dev/getting-started/playwright/you-first-playwright-run#using-reporter-configuration) command with Currents loaded as a reporter
- Run `npm run test` for using [`playwight test`](https://docs.currents.dev/getting-started/playwright/you-first-playwright-run#using-reporter-configuration) command with Currents loaded as a reporter
- Run `npm run test:pwc` for using [`pwc`](https://docs.currents.dev/getting-started/playwright/you-first-playwright-run#using-the-cli) command
- Run `npm run test:pwc-p` for [orchestrated](https://docs.currents.dev/guides/parallelization-guide/pw-parallelization/playwright-orchestration) runs

Expand Down
26 changes: 13 additions & 13 deletions basic/rules.spec.ts → basic/actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import { expect } from "@playwright/test";
import { test } from "./test";

/**
* All tests in this file are matched with a Currents Quarantine Rule based on filename.
* See the `rules` fixture in `base.ts` to see how the rules fixtures were configured,
* and the docs for more information on how to configure rules: https://docs.currents.dev/guides/automation-rules
* All tests in this file are matched with a Currents Quarantine Action based on filename.
* See the `action` fixture in `base.ts` to see how the action fixtures were configured,
* and the docs for more information on how to configure actions: https://docs.currents.dev/guides/currents-actions
*
*/

/**
* This is a failing test that will be quarantined by the file based rule
*
* | field | operation | value | - | action |
* | ----- | --------- | --------------- | --- | ---------- |
* | File | is | 8-rules.spec.ts | -> | Quarantine |
* | field | operation | value | - | action |
* | ----- | --------- | ----------------- | --- | ---------- |
* | File | is | actions.spec.ts | -> | Quarantine |
*/
test("rules quarantine test", async ({ page }) => {
test("action quarantine test", async ({ page }) => {
await page.goto("https://demo.playwright.dev/todomvc");

// Use locators to represent a selector and re-use them
Expand All @@ -28,14 +28,14 @@ test("rules quarantine test", async ({ page }) => {
});

/**
* This tests will be completely skipped by a rule that matches fileName + test name
* This tests will be completely skipped by an Action that matches fileName + test name
*
* | field | operation | value | - | action |
* | ----- | --------- | --------------- | ---- | ---------- |
* | File | is | 8-rules.spec.ts | And | |
* | Title | is | rules skip test | -> | Skip |
* | field | operation | value | - | action |
* | ----- | --------- | ----------------- | ---- | ---------- |
* | File | is | actions.spec.ts | And | |
* | Title | is | action skip test | -> | Skip |
*/
test("rules skip test", async ({ page }) => {
test("action skip test", async ({ page }) => {
await page.goto("https://demo.playwright.dev/todomvc");

// Use locators to represent a selector and re-use them
Expand Down
2 changes: 1 addition & 1 deletion basic/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import { test as base } from "@playwright/test";

export const test = base.extend<CurrentsFixtures, CurrentsWorkerFixtures>({
...fixtures.baseFixtures,
...fixtures.rulesFixtures,
...fixtures.actionFixtures,
});
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
"description": "An example repository on how to setup Currents Rules with Playwright Fixtures",
"main": "index.js",
"scripts": {
"test": "playwright test",
"test:pwc" : "pwc",
"test:pwp" : "pwc-p",
"test:reporter" : "playwright test -c playwright.config.reporter.ts",
"test": "playwright test -c playwright.config.reporter.ts",
"test:pwc": "pwc",
"test:pwp": "pwc-p",
"lint": "eslint ./basic"
},
"author": "",
"license": "MIT",
"devDependencies": {
"@currents/playwright": "^1.9.0-beta.1",
"@currents/playwright": "^1.9.0-beta.2",
"@eslint/js": "^9.16.0",
"@playwright/test": "^1.49.1",
"@types/node": "^22.10.2",
Expand Down
Loading