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(tests): add types for tests (#915)
Joel Einbinderc03e8b794601
diff --git a/test/accessibility.spec.js b/test/accessibility.spec.jsindex 64ab278d4a..902e8c06ff 100644--- a/test/accessibility.spec.js+++ b/test/accessibility.spec.js@@ -15,6 +15,9 @@* limitations under the License.*/+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT, MAC}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/browser.spec.js b/test/browser.spec.jsindex 59421ed2ce..4232dce3a8 100644--- a/test/browser.spec.js+++ b/test/browser.spec.js@@ -16,6 +16,9 @@const utils = require('./utils');+/**+ * @type {BrowserTestSuite}+ */module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/browsercontext.spec.js b/test/browsercontext.spec.jsindex 8e25831e03..6dc1e8a326 100644--- a/test/browsercontext.spec.js+++ b/test/browsercontext.spec.js@@ -17,6 +17,9 @@const utils = require('./utils');+/**+ * @type {BrowserTestSuite}+ */module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/capabilities.spec.js b/test/capabilities.spec.jsindex 65c6fff14f..09bb059613 100644--- a/test/capabilities.spec.js+++ b/test/capabilities.spec.js@@ -17,6 +17,9 @@const utils = require('./utils');const { waitEvent } = utils;+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, WIN, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/chromium/chromium.spec.js b/test/chromium/chromium.spec.jsindex 6307bf9e1e..5f106e9e1f 100644--- a/test/chromium/chromium.spec.js+++ b/test/chromium/chromium.spec.js@@ -16,6 +16,9 @@const { waitEvent } = require('../utils');+/**+ * @type {ChromiumTestSuite}+ */module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/chromium/coverage.spec.js b/test/chromium/coverage.spec.jsindex 45a49009ca..8c99a50e20 100644--- a/test/chromium/coverage.spec.js+++ b/test/chromium/coverage.spec.js@@ -14,6 +14,9 @@* limitations under the License.*/+/**+ * @type {ChromiumTestSuite}+ */module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/chromium/headful.spec.js b/test/chromium/headful.spec.jsindex b2b3fc9da5..a1744665f5 100644--- a/test/chromium/headful.spec.js+++ b/test/chromium/headful.spec.js@@ -24,6 +24,9 @@ const mkdtempAsync = util.promisify(fs.mkdtemp);const TMP_FOLDER = path.join(os.tmpdir(), 'pw_tmp_folder-');+/**+ * @type {TestSuite}+ */module.exports.describe = function({testRunner, expect, playwright, defaultBrowserOptions, FFOX, CHROMIUM, WEBKIT, WIN}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/chromium/launcher.spec.js b/test/chromium/launcher.spec.jsindex 8335157f48..0c96e30090 100644--- a/test/chromium/launcher.spec.js+++ b/test/chromium/launcher.spec.js@@ -25,6 +25,9 @@ const statAsync = util.promisify(fs.stat);const TMP_FOLDER = path.join(os.tmpdir(), 'pw_tmp_folder-');+/**+ * @type {TestSuite}+ */module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, WIN}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/chromium/oopif.spec.js b/test/chromium/oopif.spec.jsindex 707d17c111..71f66bff40 100644--- a/test/chromium/oopif.spec.js+++ b/test/chromium/oopif.spec.js@@ -14,6 +14,9 @@* limitations under the License.*/+/**+ * @type {ChromiumTestSuite}+ */module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/chromium/pdf.spec.js b/test/chromium/pdf.spec.jsindex a6f3a0f071..64df44a300 100644--- a/test/chromium/pdf.spec.js+++ b/test/chromium/pdf.spec.js@@ -17,6 +17,9 @@const fs = require('fs');const path = require('path');+/**+ * @type {ChromiumTestSuite}+ */module.exports.describe = function({testRunner, expect, headless, ASSETS_DIR}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/chromium/session.spec.js b/test/chromium/session.spec.jsindex 8c6ddf82bb..163e30432c 100644--- a/test/chromium/session.spec.js+++ b/test/chromium/session.spec.js@@ -16,6 +16,9 @@const { waitEvent } = require('../utils');+/**+ * @type {ChromiumTestSuite}+ */module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/chromium/tracing.spec.js b/test/chromium/tracing.spec.jsindex fea16eb9e3..fc9c16309e 100644--- a/test/chromium/tracing.spec.js+++ b/test/chromium/tracing.spec.js@@ -17,6 +17,9 @@const fs = require('fs');const path = require('path');+/**+ * @type {ChromiumTestSuite}+ */module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, ASSETS_DIR}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/click.spec.js b/test/click.spec.jsindex 07e7a9e0f4..f60f5ac365 100644--- a/test/click.spec.js+++ b/test/click.spec.js@@ -17,6 +17,9 @@const utils = require('./utils');+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/cookies.spec.js b/test/cookies.spec.jsindex e06cdde358..767c122c8f 100644--- a/test/cookies.spec.js+++ b/test/cookies.spec.js@@ -15,6 +15,9 @@* limitations under the License.*/+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, playwright, defaultBrowserOptions, MAC, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/defaultbrowsercontext.spec.js b/test/defaultbrowsercontext.spec.jsindex 1d74f22ff3..a3100883ef 100644--- a/test/defaultbrowsercontext.spec.js+++ b/test/defaultbrowsercontext.spec.js@@ -17,6 +17,9 @@const { makeUserDataDir, removeUserDataDir } = require('./utils');+/**+ * @type {PageTestSuite}+ */module.exports.describe = function ({ testRunner, expect, defaultBrowserOptions, playwright }) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/dialog.spec.js b/test/dialog.spec.jsindex 183169f5c1..6a131cbc02 100644--- a/test/dialog.spec.js+++ b/test/dialog.spec.js@@ -15,6 +15,9 @@* limitations under the License.*/+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/elementhandle.spec.js b/test/elementhandle.spec.jsindex a4aaf1a40a..65620ba44e 100644--- a/test/elementhandle.spec.js+++ b/test/elementhandle.spec.js@@ -17,6 +17,9 @@const utils = require('./utils');+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/emulation.spec.js b/test/emulation.spec.jsindex 2e849252d8..468b713faf 100644--- a/test/emulation.spec.js+++ b/test/emulation.spec.js@@ -15,6 +15,9 @@* limitations under the License.*/+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/evaluation.spec.js b/test/evaluation.spec.jsindex 47a4a37ecb..7f2cf1bf22 100644--- a/test/evaluation.spec.js+++ b/test/evaluation.spec.js@@ -19,6 +19,9 @@ const utils = require('./utils');const bigint = typeof BigInt !== 'undefined';+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/features/permissions.spec.js b/test/features/permissions.spec.jsindex 56640dd6a1..ea531eeda5 100644--- a/test/features/permissions.spec.js+++ b/test/features/permissions.spec.js@@ -18,6 +18,9 @@const fs = require('fs');const path = require('path');+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/fixtures.spec.js b/test/fixtures.spec.jsindex 1f9cf1eafd..95da9e2ef6 100644--- a/test/fixtures.spec.js+++ b/test/fixtures.spec.js@@ -18,6 +18,9 @@const path = require('path');const {spawn, execSync} = require('child_process');+/**+ * @type {TestSuite}+ */module.exports.describe = function({testRunner, expect, product, playwright, playwrightPath, defaultBrowserOptions, WIN, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/frame.spec.js b/test/frame.spec.jsindex 6cb912ba81..308f3c55df 100644--- a/test/frame.spec.js+++ b/test/frame.spec.js@@ -17,6 +17,9 @@const utils = require('./utils');+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/geolocation.spec.js b/test/geolocation.spec.jsindex 5af6dbe521..4e0a30ec93 100644--- a/test/geolocation.spec.js+++ b/test/geolocation.spec.js@@ -15,6 +15,9 @@* limitations under the License.*/+/**+ * @type {PageTestSuite}+ */module.exports.describe = function ({ testRunner, expect, FFOX, WEBKIT }) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/headful.spec.js b/test/headful.spec.jsindex 9bbc9c1f13..90b0ac12d9 100644--- a/test/headful.spec.js+++ b/test/headful.spec.js@@ -16,6 +16,9 @@const { makeUserDataDir, removeUserDataDir } = require('./utils');+/**+ * @type {TestSuite}+ */module.exports.describe = function({testRunner, expect, playwright, defaultBrowserOptions, FFOX, CHROMIUM, WEBKIT, WIN}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/ignorehttpserrors.spec.js b/test/ignorehttpserrors.spec.jsindex b9b623b53f..b2457edf87 100644--- a/test/ignorehttpserrors.spec.js+++ b/test/ignorehttpserrors.spec.js@@ -15,6 +15,9 @@* limitations under the License.*/+/**+ * @type {BrowserTestSuite}+ */module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/input.spec.js b/test/input.spec.jsindex 1e3e6254fd..ea796842bd 100644--- a/test/input.spec.js+++ b/test/input.spec.js@@ -21,6 +21,9 @@ const formidable = require('formidable');const FILE_TO_UPLOAD = path.join(__dirname, '/assets/file-to-upload.txt');+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/interception.spec.js b/test/interception.spec.jsindex 4922806bc2..003996ef8d 100644--- a/test/interception.spec.js+++ b/test/interception.spec.js@@ -20,6 +20,9 @@ const path = require('path');const { helper } = require('../lib/helper');const utils = require('./utils');+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/jshandle.spec.js b/test/jshandle.spec.jsindex 270079c1c1..69b72e442d 100644--- a/test/jshandle.spec.js+++ b/test/jshandle.spec.js@@ -15,6 +15,9 @@* limitations under the License.*/+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, CHROMIUM, FFOX, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/keyboard.spec.js b/test/keyboard.spec.jsindex 0ade260ee6..d5bf294d15 100644--- a/test/keyboard.spec.js+++ b/test/keyboard.spec.js@@ -18,6 +18,9 @@const utils = require('./utils');const os = require('os');+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT, MAC}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/launcher.spec.js b/test/launcher.spec.jsindex a68b91d772..f9e513133b 100644--- a/test/launcher.spec.js+++ b/test/launcher.spec.js@@ -20,6 +20,9 @@ const fs = require('fs');const utils = require('./utils');const { makeUserDataDir, removeUserDataDir } = require('./utils');+/**+ * @type {TestSuite}+ */module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, playwrightPath, product, CHROMIUM, FFOX, WEBKIT, WIN}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;@@ -42,7 +45,7 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, pawait playwright.launch(options).catch(e => waitError = e);expect(waitError.message).toContain('Failed to launch');});- if('should have default URL when launching browser', async function() {+ it('should have default URL when launching browser', async function() {const userDataDir = await makeUserDataDir();const browserContext = await playwright.launchPersistent(userDataDir, defaultBrowserOptions);const pages = (await browserContext.pages()).map(page => page.url());@@ -172,7 +175,7 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p});describe('Browser.close', function() {- it('should terminate network waiters', async({context, server}) => {+ it('should terminate network waiters', async({server}) => {const browserServer = await playwright.launchServer({...defaultBrowserOptions });const remote = await playwright.connect({ wsEndpoint: browserServer.wsEndpoint() });const newPage = await remote.newPage();diff --git a/test/mouse.spec.js b/test/mouse.spec.jsindex 9024d17757..de1ac8b3d3 100644--- a/test/mouse.spec.js+++ b/test/mouse.spec.js@@ -26,6 +26,9 @@ function dimensions() {};}+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT, MAC}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/multiclient.spec.js b/test/multiclient.spec.jsindex 46c53ae039..3f7ab0db61 100644--- a/test/multiclient.spec.js+++ b/test/multiclient.spec.js@@ -17,6 +17,9 @@const utils = require('./utils');+/**+ * @type {TestSuite}+ */module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/navigation.spec.js b/test/navigation.spec.jsindex 126c3cfaf5..5e0d30c4f2 100644--- a/test/navigation.spec.js+++ b/test/navigation.spec.js@@ -18,6 +18,9 @@const utils = require('./utils');const { performance } = require('perf_hooks');+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, playwright, MAC, WIN, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/network.spec.js b/test/network.spec.jsindex cafa1490df..d5c915ae6c 100644--- a/test/network.spec.js+++ b/test/network.spec.js@@ -19,6 +19,9 @@ const fs = require('fs');const path = require('path');const utils = require('./utils');+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, MAC, WIN, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/page.spec.js b/test/page.spec.jsindex cfcfd8a5f9..e42d215218 100644--- a/test/page.spec.js+++ b/test/page.spec.js@@ -19,6 +19,9 @@ const path = require('path');const utils = require('./utils');const {waitEvent} = utils;+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, headless, playwright, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/playwright.spec.js b/test/playwright.spec.jsindex e761ec975e..38590dba63 100644--- a/test/playwright.spec.js+++ b/test/playwright.spec.js@@ -24,6 +24,9 @@ const {Matchers} = require('../utils/testrunner/');const YELLOW_COLOR = '\x1b[33m';const RESET_COLOR = '\x1b[0m';+/**+ * @type {TestSuite}+ */module.exports.describe = ({testRunner, product, playwrightPath}) => {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/queryselector.spec.js b/test/queryselector.spec.jsindex e84105c380..27161b4f69 100644--- a/test/queryselector.spec.js+++ b/test/queryselector.spec.js@@ -17,6 +17,9 @@const zsSelectorEngineSource = require('../lib/generated/zsSelectorEngineSource');+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, selectors, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;@@ -236,7 +239,7 @@ module.exports.describe = function({testRunner, expect, selectors, FFOX, CHROMIUconst element = await page.$$('//html/body/non-existing-element');expect(element).toEqual([]);});- it('should return multiple elements', async({page, sever}) => {+ it('should return multiple elements', async({page, server}) => {await page.setContent('<div></div><div></div>');const elements = await page.$$('xpath=/html/body/div');expect(elements.length).toBe(2);diff --git a/test/screenshot.spec.js b/test/screenshot.spec.jsindex 478c34380c..6b184ff236 100644--- a/test/screenshot.spec.js+++ b/test/screenshot.spec.js@@ -15,6 +15,9 @@* limitations under the License.*/+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, product, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/tsconfig.json b/test/tsconfig.jsonnew file mode 100644index 0000000000..158060dd73--- /dev/null+++ b/test/tsconfig.json@@ -0,0 +1,11 @@+{+ "compilerOptions": {+ "allowJs": true,+ "checkJs": false,+ "noEmit": true,+ "moduleResolution": "node",+ "target": "ESNext",+ "strictNullChecks": false,+ },+ "include": ["*.spec.js", "types.d.ts"]+ }\ No newline at end of filediff --git a/test/types.d.ts b/test/types.d.tsnew file mode 100644index 0000000000..5aaa2ef67d--- /dev/null+++ b/test/types.d.ts@@ -0,0 +1,103 @@+type ServerResponse = import('http').ServerResponse;+type IncomingMessage = import('http').IncomingMessage;++type Falsy = false|""|0|null|undefined;+interface Expect<T> {+ toBe(other: T, message?: string): void;+ toBeFalsy(message?: string): void;+ toBeTruthy(message?: string): void;+ toContain(other: any, message?: string): void;+ toEqual(other: T, message?: string): void;+ toBeNull(message?: string): void;+ toBeInstanceOf(other: Function, message?: string): void;++ toBeGreaterThan(other: number, message?: string): void;+ toBeGreaterThanOrEqual(other: number, message?: string): void;+ toBeLessThan(other: number, message?: string): void;+ toBeLessThanOrEqual(other: number, message?: string): void;+ toBeCloseTo(other: number, precision: number, message?: string): void;++ toBeGolden(path: string): void;++ not: Expect<T>;+}++type DescribeFunction = ((name: string, inner: () => void) => void) & {skip(condition: boolean): DescribeFunction};++type ItFunction<STATE> = ((name: string, inner: (state: STATE) => Promise<void>) => void) & {skip(condition: boolean): ItFunction<STATE>};++type TestRunner<STATE> = {+ describe: DescribeFunction;+ xdescribe: DescribeFunction;+ fdescribe: DescribeFunction;++ it: ItFunction<STATE>;+ xit: ItFunction<STATE>;+ fit: ItFunction<STATE>;+ dit: ItFunction<STATE>;++ beforeAll, beforeEach, afterAll, afterEach, loadTests;+};++interface TestSetup<STATE> {+ testRunner: TestRunner<STATE>;+ product: 'Chromium'|'Firefox'|'WebKit';+ FFOX: boolean;+ WEBKIT: boolean;+ CHROMIUM: boolean;+ MAC: boolean;+ LINUX: boolean;+ WIN: boolean;+ playwright: import('../src/server/browserType').BrowserType;+ selectors: import('../src/selectors').Selectors;+ expect<T>(value: T): Expect<T>;+ defaultBrowserOptions: import('../src/server/browserType').LaunchOptions;+ playwrightPath;+ headless: boolean;+ ASSETS_DIR: string;+}++type TestState = {+ server: TestServer;+ httpsServer: TestServer;+ sourceServer: TestServer;+};++type BrowserState = TestState & {+ browser: import('../src/browser').Browser;+ browserServer: import('../src/server/browserServer').BrowserServer;+ newPage: (options?: import('../src/browserContext').BrowserContextOptions) => Promise<import('../src/page').Page>;+ newContext: (options?: import('../src/browserContext').BrowserContextOptions) => Promise<import('../src/browserContext').BrowserContext>;+};++type PageState = BrowserState & {+ context: import('../src/browserContext').BrowserContext;+ page: import('../src/page').Page;+};+type ChromiumPageState = PageState & {+ browser: import('../src/chromium/crBrowser').CRBrowser;+};+type TestSuite = (setup: TestSetup<TestState>) => void;+type BrowserTestSuite = (setup: TestSetup<BrowserState>) => void;+type PageTestSuite = (setup: TestSetup<PageState>) => void;+type ChromiumTestSuite = (setup: TestSetup<ChromiumPageState>) => void;+++interface TestServer {+ enableHTTPCache(pathPrefix: string);+ setAuth(path: string, username: string, password: string);+ enableGzip(path: string);+ setCSP(path: string, csp: string);+ stop(): Promise<void>;+ setRoute(path: string, handler: (message: IncomingMessage, response: ServerResponse) => void);+ setRedirect(from: string, to: string);+ waitForRequest(path: string): Promise<IncomingMessage>;+ reset();+ serveFile(request: IncomingMessage, response: ServerResponse, pathName: string);++ PORT: number;+ PREFIX: string;+ CROSS_PROCESS_PREFIX: string;+ EMPTY_PAGE: string;++}\ No newline at end of filediff --git a/test/waittask.spec.js b/test/waittask.spec.jsindex ad69e62425..9bb1bead96 100644--- a/test/waittask.spec.js+++ b/test/waittask.spec.js@@ -17,6 +17,9 @@const utils = require('./utils');+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, product, playwright, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/web.spec.js b/test/web.spec.jsindex de70032893..8e84de2d5e 100644--- a/test/web.spec.js+++ b/test/web.spec.js@@ -14,6 +14,9 @@* limitations under the License.*/+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, product, CHROMIUM, FFOX}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/webkit/provisional.spec.js b/test/webkit/provisional.spec.jsindex a069e9a8ac..df89747112 100644--- a/test/webkit/provisional.spec.js+++ b/test/webkit/provisional.spec.js@@ -14,6 +14,9 @@* limitations under the License.*/+/**+ * @type {PageTestSuite}+ */module.exports.describe = function ({ testRunner, expect }) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/test/workers.spec.js b/test/workers.spec.jsindex 3c369616bd..e9ee090374 100644--- a/test/workers.spec.js+++ b/test/workers.spec.js@@ -18,6 +18,9 @@const utils = require('./utils');const { waitEvent } = utils;+/**+ * @type {PageTestSuite}+ */module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;diff --git a/utils/testserver/index.js b/utils/testserver/index.jsindex c450753e08..13f2ea77be 100644--- a/utils/testserver/index.js+++ b/utils/testserver/index.js@@ -28,7 +28,7 @@ class TestServer {/*** @param {string} dirPath* @param {number} port- * @return {!TestServer}+ * @return {!Promise<TestServer>}*/static async create(dirPath, port) {const server = new TestServer(dirPath, port);@@ -39,7 +39,7 @@ class TestServer {/*** @param {string} dirPath* @param {number} port- * @return {!TestServer}+ * @return {!Promise<TestServer>}*/static async createHTTPS(dirPath, port) {const server = new TestServer(dirPath, port, {@@ -70,7 +70,7 @@ class TestServer {this._startTime = new Date();this._cachedPathPrefix = null;- /** @type {!Set<!net.Socket>} */+ /** @type {!Set<!NodeJS.Socket>} */this._sockets = new Set();/** @type {!Map<string, function(!IncomingMessage, !ServerResponse)>} */