0.0.4 • Published 1 month ago

testable-playwright-test v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Introduction

A Playwright test fixture for running your tests against the Testable cloud.

This fixture works for both remote and fully hosted tests:

  1. Remote tests - Execute your playwright tests yourself and use Testable Cloud as an infinitely scalable browser grid that also generates detailed, customizable, and shareable reports for your test runs.

  2. Fully hosted tests - For tests that you upload and run on a Testable test runner.

Alternatively you can use Testable as a remote Selenium grid without using this fixture at all.

Getting Started

Remote Tests

You can continue running your tests on your own infrastructure but point them at Testable Cloud's browser grid.

import { createFixture as createTestableFixture } from 'testable-playwright-test';

const test = createTestableFixture({
  // mandatory api key (found under Org Management => API Keys)
  key: [your-api-key],
  // see https://a.testable.io/remote-configurator for all other options available
  screenResolution: '1920x1080',
  region: 'aws-us-east-1',
  testCaseName: 'Project Demo 2',
  reportId: `test-${Date.now()}`
});

test('has title', async ({ page }) => {
  await page.goto('https://playwright.dev/');

  // Expect a title "to contain" a substring.
  await expect(page).toHaveTitle(/Playwright/);
});

Fully Hosted Tests

You can upload your project or link to source control and have Testable run your tests on our test runners as per your test configuration. In this case you don't need to provide any settings, as the test runner will pass in everything.

If you run the below test locally it'll work exactly the same as if you were not using the Testable fixture and launch local browsers.

import { createFixture as createTestableFixture } from 'testable-playwright-test';

const test = createTestableFixture();

test('has title', async ({ page }) => {
  await page.goto('https://playwright.dev/');

  // Expect a title "to contain" a substring.
  await expect(page).toHaveTitle(/Playwright/);
});

Testable Selenium Grid

For chromium only you can also point your tests against the Testable remote Selenium endpoint. For each session you will see a test result on Testable. This does not require the Testable fixture.

See more details on all the options you can pass under https://a.testable.io/remote-configurator.

SELENIUM_REMOTE_URL=https://selenium.testable.io/wd/hub SELENIUM_REMOTE_CAPABILITIES='{ "testable:options": { "region": "aws-us-east-1", "seleniumVersion": "4.x" } }' SELENIUM_REMOTE_HEADERS='{"Authorization":"Basic [base-64-encoded...username:api-key]"}' npx playwright test

For the authorization header the username can be anything you want (it'll get logged with the test) and the API key can be found under Org Management => API Keys when you login to Testable.

0.0.4

1 month ago

0.0.3

5 months ago

0.0.2

10 months ago

0.0.1

10 months ago