docs: update import in code example (#22591)

This commit is contained in:
Ruben 2023-05-10 15:18:20 +02:00 committed by GitHub
parent cbf4f39957
commit f9eeaa2b75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 10 deletions

View file

@ -1857,7 +1857,7 @@ const { firefox } = require('playwright'); // Or 'chromium' or 'webkit'.
const browser = await firefox.launch(); const browser = await firefox.launch();
const page = await browser.newPage(); const page = await browser.newPage();
const watchDog = page.mainFrame().waitForFunction('window.innerWidth < 100'); const watchDog = page.mainFrame().waitForFunction('window.innerWidth < 100');
page.setViewportSize({width: 50, height: 50}); await page.setViewportSize({width: 50, height: 50});
await watchDog; await watchDog;
await browser.close(); await browser.close();
})(); })();

View file

@ -14,7 +14,7 @@ Selectors must be registered before creating the page.
An example of registering selector engine that queries elements based on a tag name: An example of registering selector engine that queries elements based on a tag name:
```js ```js
const { selectors, firefox } = require('playwright'); // Or 'chromium' or 'webkit'. const { selectors, firefox } = require('@playwright/test'); // Or 'chromium' or 'webkit'.
(async () => { (async () => {
// Must be a function that evaluates to a selector engine instance. // Must be a function that evaluates to a selector engine instance.

View file

@ -236,7 +236,7 @@ This includes any config that needs to be run before or after mounting the compo
```js ```js
// src/pages/ProductsPage.spec.tsx // src/pages/ProductsPage.spec.tsx
import { test, expect } from '@playwright/experimental-ct-react'; import { test, expect } from '@playwright/experimental-ct-react';
import type { HooksConfig } from 'playwright'; import type { HooksConfig } from '@playwright/test';
import { ProductsPage } from './pages/ProductsPage'; import { ProductsPage } from './pages/ProductsPage';
test('configure routing through hooks config', async ({ page, mount }) => { test('configure routing through hooks config', async ({ page, mount }) => {
@ -271,7 +271,7 @@ This includes any config that needs to be run before or after mounting the compo
```js ```js
// src/pages/ProductsPage.spec.tsx // src/pages/ProductsPage.spec.tsx
import { test, expect } from '@playwright/experimental-ct-solid'; import { test, expect } from '@playwright/experimental-ct-solid';
import type { HooksConfig } from 'playwright'; import type { HooksConfig } from '@playwright/test';
import { ProductsPage } from './pages/ProductsPage'; import { ProductsPage } from './pages/ProductsPage';
test('configure routing through hooks config', async ({ page, mount }) => { test('configure routing through hooks config', async ({ page, mount }) => {
@ -306,7 +306,7 @@ This includes any config that needs to be run before or after mounting the compo
```js ```js
// src/pages/ProductsPage.spec.ts // src/pages/ProductsPage.spec.ts
import { test, expect } from '@playwright/experimental-ct-vue'; import { test, expect } from '@playwright/experimental-ct-vue';
import type { HooksConfig } from 'playwright'; import type { HooksConfig } from '@playwright/test';
import ProductsPage from './pages/ProductsPage.vue'; import ProductsPage from './pages/ProductsPage.vue';
test('configure routing through hooks config', async ({ page, mount }) => { test('configure routing through hooks config', async ({ page, mount }) => {
@ -343,7 +343,7 @@ This includes any config that needs to be run before or after mounting the compo
```js ```js
// src/pages/ProductsPage.spec.ts // src/pages/ProductsPage.spec.ts
import { test, expect } from '@playwright/experimental-ct-vue2'; import { test, expect } from '@playwright/experimental-ct-vue2';
import type { HooksConfig } from 'playwright'; import type { HooksConfig } from '@playwright/test';
import ProductsPage from './pages/ProductsPage.vue'; import ProductsPage from './pages/ProductsPage.vue';
test('configure routing through hooks config', async ({ page, mount }) => { test('configure routing through hooks config', async ({ page, mount }) => {
@ -599,7 +599,7 @@ Pinia needs to be initialized in `playwright/index.{js,ts,jsx,tsx}`. If you do t
```js ```js
// src/pinia.spec.ts // src/pinia.spec.ts
import { test, expect } from '@playwright/experimental-ct-vue'; import { test, expect } from '@playwright/experimental-ct-vue';
import type { HooksConfig } from 'playwright'; import type { HooksConfig } from '@playwright/test';
import Store from './Store.vue'; import Store from './Store.vue';
test('override initialState ', async ({ mount }) => { test('override initialState ', async ({ mount }) => {

View file

@ -5182,7 +5182,7 @@ export interface Frame {
* const browser = await firefox.launch(); * const browser = await firefox.launch();
* const page = await browser.newPage(); * const page = await browser.newPage();
* const watchDog = page.mainFrame().waitForFunction('window.innerWidth < 100'); * const watchDog = page.mainFrame().waitForFunction('window.innerWidth < 100');
* page.setViewportSize({width: 50, height: 50}); * await page.setViewportSize({width: 50, height: 50});
* await watchDog; * await watchDog;
* await browser.close(); * await browser.close();
* })(); * })();
@ -5216,7 +5216,7 @@ export interface Frame {
* const browser = await firefox.launch(); * const browser = await firefox.launch();
* const page = await browser.newPage(); * const page = await browser.newPage();
* const watchDog = page.mainFrame().waitForFunction('window.innerWidth < 100'); * const watchDog = page.mainFrame().waitForFunction('window.innerWidth < 100');
* page.setViewportSize({width: 50, height: 50}); * await page.setViewportSize({width: 50, height: 50});
* await watchDog; * await watchDog;
* await browser.close(); * await browser.close();
* })(); * })();
@ -18536,7 +18536,7 @@ export interface Selectors {
* An example of registering selector engine that queries elements based on a tag name: * An example of registering selector engine that queries elements based on a tag name:
* *
* ```js * ```js
* const { selectors, firefox } = require('playwright'); // Or 'chromium' or 'webkit'. * const { selectors, firefox } = require('@playwright/test'); // Or 'chromium' or 'webkit'.
* *
* (async () => { * (async () => {
* // Must be a function that evaluates to a selector engine instance. * // Must be a function that evaluates to a selector engine instance.