Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: import @playwright/test (#6880)
Pavel Feldmane41979a55126
diff --git a/docs/src/test-advanced.md b/docs/src/test-advanced.mdindex a4607b5cf8..4b5e79c6e2 100644--- a/docs/src/test-advanced.md+++ b/docs/src/test-advanced.md@@ -58,7 +58,7 @@ Consider an example where we run a new http server per worker process, and use ````js js-flavor=js// my-test.js-const base = require('playwright/test');+const base = require('@playwright/test');const http = require('http');// Note how we mark the fixture as { scope: 'worker' }.@@ -81,7 +81,7 @@ exports.test = base.test.extend<{}, { server: http.Server }>({```js js-flavor=ts// my-test.ts-import { test as base } from 'playwright/test';+import { test as base } from '@playwright/test';import * as http from 'http';// Note how we mark the fixture as { scope: 'worker' }.@@ -132,7 +132,7 @@ The following information is accessible after the test body has finished, in fixHere is an example test that saves some information:```js js-flavor=js// example.spec.js-const { test } = require('playwright/test');+const { test } = require('@playwright/test');test('my test needs a file', async ({ table }, testInfo) => {// Do something with the table...@@ -144,7 +144,7 @@ test('my test needs a file', async ({ table }, testInfo) => {```js js-flavor=ts// example.spec.ts-import { test } from 'playwright/test';+import { test } from '@playwright/test';test('my test needs a file', async ({ table }, testInfo) => {// Do something with the table...@@ -159,7 +159,7 @@ Here is an example fixture that automatically saves debug logs when the test fai// my-test.jsconst debug = require('debug');const fs = require('fs');-const base = require('playwright/test');+const base = require('@playwright/test');// Note how we mark the fixture as { auto: true }.// This way it is always instantiated, even if the test does not use it explicitly.@@ -181,7 +181,7 @@ exports.test = base.test.extend<{ saveLogs: void }>({// my-test.tsimport * as debug from 'debug';import * as fs from 'fs';-import { test as base } from 'playwright/test';+import { test as base } from '@playwright/test';// Note how we mark the fixture as { auto: true }.// This way it is always instantiated, even if the test does not use it explicitly.@@ -254,7 +254,7 @@ module.export = {```js js-flavor=ts// playwright.config.ts-import { PlaywrightTestConfig } from 'playwright/test';+import { PlaywrightTestConfig } from '@playwright/test';const config: PlaywrightTestConfig = {globalSetup: 'global-setup.ts',@@ -270,7 +270,7 @@ To make use of this feature, we will declare an "option fixture" for the backend```js js-flavor=js// my-test.js-const base = require('playwright/test');+const base = require('@playwright/test');const { startBackend } = require('./my-backend');exports.test = base.test.extend<{ version: string, backendUrl: string }>({@@ -288,7 +288,7 @@ exports.test = base.test.extend<{ version: string, backendUrl: string }>({```js js-flavor=ts// my-test.ts-import { test as base } from 'playwright/test';+import { test as base } from '@playwright/test';import { startBackend } from './my-backend';export const test = base.extend<{ version: string, backendUrl: string }>({@@ -359,7 +359,7 @@ module.exports = {```js js-flavor=ts// playwright.config.ts-import { PlaywrightTestConfig } from 'playwright/test';+import { PlaywrightTestConfig } from '@playwright/test';const config: PlaywrightTestConfig = {timeout: 20000,@@ -395,7 +395,7 @@ Playwright Test uses [`expect` library](https://jestjs.io/docs/expect) under theIn this example we add a custom `toBeWithinRange` function in the configuration file.```js js-flavor=js// playwright.config.js-const { expect } = require('playwright/test');+const { expect } = require('@playwright/test');expect.extend({toBeWithinRange(received: number, floor: number, ceiling: number) {@@ -419,7 +419,7 @@ module.exports = {};```js js-flavor=ts// playwright.config.ts-import { expect, PlaywrightTestConfig } from 'playwright/test';+import { expect, PlaywrightTestConfig } from '@playwright/test';expect.extend({toBeWithinRange(received: number, floor: number, ceiling: number) {@@ -445,7 +445,7 @@ export default config;Now we can use `toBeWithinRange` in the test.```js js-flavor=js// example.spec.js-const { test, expect } = require('playwright/test');+const { test, expect } = require('@playwright/test');test('numeric ranges', () => {expect(100).toBeWithinRange(90, 110);@@ -455,7 +455,7 @@ test('numeric ranges', () => {```js js-flavor=ts// example.spec.ts-import { test, expect } from 'playwright/test';+import { test, expect } from '@playwright/test';test('numeric ranges', () => {expect(100).toBeWithinRange(90, 110);diff --git a/docs/src/test-annotations.md b/docs/src/test-annotations.mdindex d7317c59c8..9e6d252f7b 100644--- a/docs/src/test-annotations.md+++ b/docs/src/test-annotations.md@@ -7,7 +7,7 @@ Sadly, tests do not always pass. Playwright Test supports test annotations to de```js js-flavor=js// example.spec.js-const { test, expect } = require('playwright/test');+const { test, expect } = require('@playwright/test');test('some feature', async ({ page, browserName }) => {test.skip(browserName !== 'webkit', 'This feature is iOS-only');@@ -22,7 +22,7 @@ test('another feature', async ({ page }) => {```js js-flavor=ts// example.spec.ts-import { test, expect } from 'playwright/test';+import { test, expect } from '@playwright/test';test('some feature', async ({ page, browserName }) => {test.skip(browserName !== 'webkit', 'This feature is iOS-only');diff --git a/docs/src/test-configuration.md b/docs/src/test-configuration.mdindex 09301370bd..18209da7a6 100644--- a/docs/src/test-configuration.md+++ b/docs/src/test-configuration.md@@ -47,7 +47,7 @@ module.exports = {``````js js-flavor=ts-import { PlaywrightTestConfig } from 'playwright/test';+import { PlaywrightTestConfig } from '@playwright/test';const config: PlaywrightTestConfig = {use: {// Browser options@@ -84,7 +84,7 @@ With `test.use()` you can override some options for a file or a `test.describe````js js-flavor=js// example.spec.js-const { test, expect } = require('playwright/test');+const { test, expect } = require('@playwright/test');// Run tests in this file with portrait-like viewport.test.use({ viewport: { width: 600, height: 900 } });@@ -96,7 +96,7 @@ test('my portrait test', async ({ page }) => {```js js-flavor=ts// example.spec.ts-import { test, expect } from 'playwright/test';+import { test, expect } from '@playwright/test';// Run tests in this file with portrait-like viewport.test.use({ viewport: { width: 600, height: 900 } });@@ -110,7 +110,7 @@ The same works inside describe.```js js-flavor=js// example.spec.js-const { test, expect } = require('playwright/test');+const { test, expect } = require('@playwright/test');test.describe('headed block', () => {// Run tests in this describe block in headed mode.@@ -124,7 +124,7 @@ test.describe('headed block', () => {```js js-flavor=ts// example.spec.ts-import { test, expect } from 'playwright/test';+import { test, expect } from '@playwright/test';test.describe('headed block', () => {// Run tests in this describe block in headed mode.@@ -178,7 +178,7 @@ module.exports = {```js js-flavor=ts// playwright.config.ts-import { PlaywrightTestConfig } from 'playwright/test';+import { PlaywrightTestConfig } from '@playwright/test';const config: PlaywrightTestConfig = {// Look for test files in the "tests" directory, relative to this configuration file@@ -242,7 +242,7 @@ module.exports = {```js js-flavor=ts// playwright.config.ts-import { PlaywrightTestConfig } from 'playwright/test';+import { PlaywrightTestConfig } from '@playwright/test';const config: PlaywrightTestConfig = {// Put any shared options on the top level.@@ -343,7 +343,7 @@ module.exports = {```js js-flavor=ts// playwright.config.ts-import { PlaywrightTestConfig } from 'playwright/test';+import { PlaywrightTestConfig } from '@playwright/test';import { devices } from 'playwright';const config: PlaywrightTestConfig = {@@ -376,7 +376,7 @@ You don't have to configure anything to mock network requests. Just define a cus```js js-flavor=js// example.spec.js-const { test, expect } = require('playwright/test');+const { test, expect } = require('@playwright/test');test.beforeEach(async ({ context }) => {// Block any css requests for each test in this file.@@ -391,7 +391,7 @@ test('loads page without css', async ({ page }) => {```js js-flavor=ts// example.spec.ts-import { test, expect } from 'playwright/test';+import { test, expect } from '@playwright/test';test.beforeEach(async ({ context }) => {// Block any css requests for each test in this file.@@ -408,7 +408,7 @@ Alternatively, you can use [`method: Page.route`] to mock network in a single te```js js-flavor=js// example.spec.js-const { test, expect } = require('playwright/test');+const { test, expect } = require('@playwright/test');test('loads page without images', async ({ page }) => {// Block png and jpeg images.@@ -421,7 +421,7 @@ test('loads page without images', async ({ page }) => {```js js-flavor=ts// example.spec.ts-import { test, expect } from 'playwright/test';+import { test, expect } from '@playwright/test';test('loads page without images', async ({ page }) => {// Block png and jpeg images.diff --git a/docs/src/test-fixtures.md b/docs/src/test-fixtures.mdindex 9321684304..1de591e818 100644--- a/docs/src/test-fixtures.md+++ b/docs/src/test-fixtures.md@@ -18,7 +18,7 @@ Here is how typical test environment setup differs between traditional test styl```js// todo.spec.js-const { test } = require('playwright/test');+const { test } = require('@playwright/test');const { TodoPage } = require('./todo-page');describe('todo tests', () => {@@ -51,7 +51,7 @@ describe('todo tests', () => {```js js-flavor=js// todo.spec.js-const base = require('playwright/test');+const base = require('@playwright/test');const { TodoPage } = require('./todo-page');// Extend basic test by providing a "todoPage" fixture.@@ -79,7 +79,7 @@ test('should remove an item', async ({ todoPage }) => {```js js-flavor=ts// example.spec.ts-import { test as base } from 'playwright/test';+import { test as base } from '@playwright/test';import { TodoPage } from './todo-page';// Extend basic test by providing a "table" fixture.@@ -145,7 +145,7 @@ Here is how test fixtures are declared and defined. Fixtures can use other fixtu```js js-flavor=js// hello.js-const base = require('playwright/test');+const base = require('@playwright/test');// Extend base test with fixtures "hello" and "helloWorld".// This new "test" can be used in multiple test files, and each of them will get the fixtures.@@ -168,7 +168,7 @@ module.exports = base.test.extend({```js js-flavor=ts// hello.ts-import base from 'playwright/test';+import base from '@playwright/test';// Define test fixtures "hello" and "helloWorld".type TestFixtures = {@@ -239,7 +239,7 @@ test('fetch 2', async ({ port }) => {And here is how fixtures are declared and defined:```js js-flavor=js// express-test.js-const base = require('playwright/test');+const base = require('@playwright/test');const express = require('express');// Define "port" and "express" worker fixtures.@@ -284,7 +284,7 @@ module.exports = base.test.extend({```js js-flavor=ts// express-test.ts-import { test as base } from 'playwright/test';+import { test as base } from '@playwright/test';import express from 'express';import type { Express } from 'express';diff --git a/docs/src/test-intro.md b/docs/src/test-intro.mdindex 8f8a0fe540..0889d341d9 100644--- a/docs/src/test-intro.md+++ b/docs/src/test-intro.md@@ -30,7 +30,7 @@ npm i -D playwrightCreate `tests/foo.spec.js` (or `tests/foo.spec.ts` for TypeScript) to define your test.```js js-flavor=js-const { test, expect } = require('playwright/test');+const { test, expect } = require('@playwright/test');test('basic test', async ({ page }) => {await page.goto('https://playwright.dev/');@@ -40,7 +40,7 @@ test('basic test', async ({ page }) => {``````js js-flavor=ts-import { test, expect } from 'playwright/test';+import { test, expect } from '@playwright/test';test('basic test', async ({ page }) => {await page.goto('https://playwright.dev/');@@ -140,7 +140,7 @@ test('skip this test', async ({ page, browserName }) => {You can group tests to give them a logical name or to scope before/after hooks to the group.```js js-flavor=js-const { test, expect } = require('playwright/test');+const { test, expect } = require('@playwright/test');test.describe('two tests', () => {test('one', async ({ page }) => {@@ -154,7 +154,7 @@ test.describe('two tests', () => {``````js js-flavor=ts-import { test, expect } from 'playwright/test';+import { test, expect } from '@playwright/test';test.describe('two tests', () => {test('one', async ({ page }) => {@@ -174,7 +174,7 @@ And you can use `test.beforeEach` and `test.afterEach` hooks to set up and tear```js js-flavor=js// example.spec.js-const { test, expect } = require('playwright/test');+const { test, expect } = require('@playwright/test');test.describe('feature foo', () => {test.beforeEach(async ({ page }) => {@@ -191,7 +191,7 @@ test.describe('feature foo', () => {```js js-flavor=ts// example.spec.ts-import { test, expect } from 'playwright/test';+import { test, expect } from '@playwright/test';test.describe('feature foo', () => {test.beforeEach(async ({ page }) => {@@ -220,7 +220,7 @@ Combine `expect` with various Playwright methods to create expectations for your```js js-flavor=js// example.spec.js-const { test, expect } = require('playwright/test');+const { test, expect } = require('@playwright/test');test('my test', async ({ page }) => {await page.goto('https://playwright.dev/');@@ -245,7 +245,7 @@ test('my test', async ({ page }) => {```js js-flavor=ts// example.spec.ts-import { test, expect } from 'playwright/test';+import { test, expect } from '@playwright/test';test('my test', async ({ page }) => {await page.goto('https://playwright.dev/');@@ -353,7 +353,7 @@ module.exports = {``````js js-flavor=ts-import { PlaywrightTestConfig } from 'playwright/test';+import { PlaywrightTestConfig } from '@playwright/test';const config: PlaywrightTestConfig = {// Each test is given 30 seconds.diff --git a/docs/src/test-parallel.md b/docs/src/test-parallel.mdindex 82c40a24cf..67453b69e6 100644--- a/docs/src/test-parallel.md+++ b/docs/src/test-parallel.md@@ -41,7 +41,7 @@ You can control the maximum number of worker processes via [command line](./test```js js-flavor=ts// playwright.config.ts- import { PlaywrightTestConfig } from 'playwright/test';+ import { PlaywrightTestConfig } from '@playwright/test';const config: PlaywrightTestConfig = {// Limit the number of workers on CI, use default locallydiff --git a/docs/src/test-pom.md b/docs/src/test-pom.mdindex 2747ba2a9a..9b4524340a 100644--- a/docs/src/test-pom.md+++ b/docs/src/test-pom.md@@ -73,7 +73,7 @@ Now we can use the `PlaywrightDevPage` class in our tests.```js js-flavor=js// example.spec.js-const { test, expect } = require('playwright/test');+const { test, expect } = require('@playwright/test');const { PlaywrightDevPage } = require('./playwright-dev-page');test('Get Started table of contents', async ({ page }) => {@@ -109,7 +109,7 @@ test('Core Concepts table of contents', async ({ page }) => {```js js-flavor=ts// example.spec.ts-import { test, expect } from 'playwright/test';+import { test, expect } from '@playwright/test';import { PlaywrightDevPage } from './playwright-dev-page';test('Get Started table of contents', async ({ page }) => {diff --git a/docs/src/test-reporters.md b/docs/src/test-reporters.mdindex 32a29fcd47..5c1f642040 100644--- a/docs/src/test-reporters.md+++ b/docs/src/test-reporters.md@@ -25,7 +25,7 @@ module.exports = {```js js-flavor=ts// playwright.config.ts-import { PlaywrightTestConfig } from 'playwright/test';+import { PlaywrightTestConfig } from '@playwright/test';const config: PlaywrightTestConfig = {reporter: 'line',@@ -48,7 +48,7 @@ module.exports = {```js js-flavor=ts// playwright.config.ts-import { PlaywrightTestConfig } from 'playwright/test';+import { PlaywrightTestConfig } from '@playwright/test';const config: PlaywrightTestConfig = {reporter: !process.env.CI@@ -81,7 +81,7 @@ module.exports = {```js js-flavor=ts// playwright.config.ts-import { PlaywrightTestConfig } from 'playwright/test';+import { PlaywrightTestConfig } from '@playwright/test';const config: PlaywrightTestConfig = {reporter: 'list',@@ -123,7 +123,7 @@ module.exports = {```js js-flavor=ts// playwright.config.ts-import { PlaywrightTestConfig } from 'playwright/test';+import { PlaywrightTestConfig } from '@playwright/test';const config: PlaywrightTestConfig = {reporter: 'line',@@ -162,7 +162,7 @@ module.exports = {```js js-flavor=ts// playwright.config.ts-import { PlaywrightTestConfig } from 'playwright/test';+import { PlaywrightTestConfig } from '@playwright/test';const config: PlaywrightTestConfig = {reporter: 'dot',@@ -196,7 +196,7 @@ module.exports = {```js js-flavor=ts// playwright.config.ts-import { PlaywrightTestConfig } from 'playwright/test';+import { PlaywrightTestConfig } from '@playwright/test';const config: PlaywrightTestConfig = {reporter: { name: 'json', outputFile: 'results.json' },@@ -223,7 +223,7 @@ module.exports = {```js js-flavor=ts// playwright.config.ts-import { PlaywrightTestConfig } from 'playwright/test';+import { PlaywrightTestConfig } from '@playwright/test';const config: PlaywrightTestConfig = {reporter: { name: 'junit', outputFile: 'results.xml' },diff --git a/docs/src/test-retries.md b/docs/src/test-retries.mdindex 841ba7a842..bcafd83fb1 100644--- a/docs/src/test-retries.md+++ b/docs/src/test-retries.md@@ -18,7 +18,7 @@ module.exports = {```js js-flavor=ts// playwright.config.ts-import { PlaywrightTestConfig } from 'playwright/test';+import { PlaywrightTestConfig } from '@playwright/test';const config: PlaywrightTestConfig = {retries: 3,diff --git a/docs/src/test-snapshots.md b/docs/src/test-snapshots.mdindex 9e71ac1186..9f9777721a 100644--- a/docs/src/test-snapshots.md+++ b/docs/src/test-snapshots.md@@ -7,7 +7,7 @@ Playwright Test includes the ability to produce and visually compare screenshots```js js-flavor=js// example.spec.js-const { test, expect } = require('playwright/test');+const { test, expect } = require('@playwright/test');test('example test', async ({ page }) => {await page.goto('https://playwright.dev');@@ -17,7 +17,7 @@ test('example test', async ({ page }) => {```js js-flavor=ts// example.spec.ts-import { test, expect } from 'playwright/test';+import { test, expect } from '@playwright/test';test('example test', async ({ page }) => {await page.goto('https://playwright.dev');@@ -35,7 +35,7 @@ Playwright Test uses the [pixelmatch](https://github.com/mapbox/pixelmatch) libr```js js-flavor=js// example.spec.js-const { test, expect } = require('playwright/test');+const { test, expect } = require('@playwright/test');test('example test', async ({ page }) => {await page.goto('https://playwright.dev');@@ -45,7 +45,7 @@ test('example test', async ({ page }) => {```js js-flavor=ts// example.spec.ts-import { test, expect } from 'playwright/test';+import { test, expect } from '@playwright/test';test('example test', async ({ page }) => {await page.goto('https://playwright.dev');@@ -59,7 +59,7 @@ Here we compare text content against the reference.```js js-flavor=js// example.spec.js-const { test, expect } = require('playwright/test');+const { test, expect } = require('@playwright/test');test('example test', async ({ page }) => {await page.goto('https://playwright.dev');@@ -69,7 +69,7 @@ test('example test', async ({ page }) => {```js js-flavor=ts// example.spec.ts-import { test, expect } from 'playwright/test';+import { test, expect } from '@playwright/test';test('example test', async ({ page }) => {await page.goto('https://playwright.dev');