testRigor Playwright Plugin
|
|
testRigor Playwright Plugin is an open source npm package, it extends the Playwright driver to allow executing native testRigor commands in Playwright tests and utilize testRigor self healing for those tests.
GitHub link
npm package link
GitHub link
npm package link
Installation
Requires Node.js >= 18. playwright is a peer dependency, so install it alongside the plugin:
npm i @testrigor/playwright-plugin npx playwright install chromium
In order to use the driver, you must generate a PAT token and provide it when initializing testRigor driver. The token can be generated by following these steps.
Quick start
import { TestRigor } from '@testrigor/playwright-plugin';
const driver = await TestRigor.createBrowserPage(process.env.TESTRIGOR_API_TOKEN!);
driver.setTestContext('my_test');
await driver.get('https://example.com');
const button = await driver.findElement(TestRigor.byUserDescription('Sign in'));
await button.click();
await driver.quit();
Attach to an existing Playwright page:
import { TestRigor } from '@testrigor/playwright-plugin';
const driver = TestRigor.extendPage(page, apiToken);
driver.setTestContext('my_test');
Fluent commands
import { TestRigor } from '@testrigor/playwright-plugin';
const { actions, validations, queries } = TestRigor;
await actions(driver).openUrl('https://example.com').click('Empty Page').execute();
await validations(driver).checkPageContains('expected text').execute();
const value = await queries(driver).grabValue('Some field');



