From 3eac9c694cc89d089cc1cf2c1497e730fd832285 Mon Sep 17 00:00:00 2001 From: Ross Wollman Date: Fri, 22 Apr 2022 09:27:02 -0700 Subject: [PATCH] fix(test-runner): mark attach as async (#13687) Also brings back generation of experimental types as part of lint. --- docs/src/test-api/class-globalinfo.md | 2 +- docs/src/test-api/class-testinfo.md | 2 +- packages/playwright-test/types/test.d.ts | 2 +- tests/config/experimental.d.ts | 11 ++++++++--- utils/generate_types/index.js | 1 + 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/src/test-api/class-globalinfo.md b/docs/src/test-api/class-globalinfo.md index 1a368cceed..cff96d200e 100644 --- a/docs/src/test-api/class-globalinfo.md +++ b/docs/src/test-api/class-globalinfo.md @@ -98,7 +98,7 @@ The list of files or buffers attached to the overall test run. Some reporters sh To add an attachment, use [`method: GlobalInfo.attach`]. See [`property: TestInfo.attachments`] if you are looking for test-scoped attachments. -## method: GlobalInfo.attach +## async method: GlobalInfo.attach Attach a value or a file from disk to the overall test run. Some reporters show global attachments. Either [`option: path`] or [`option: body`] must be specified, but not both. diff --git a/docs/src/test-api/class-testinfo.md b/docs/src/test-api/class-testinfo.md index b36d2b9712..6c8ef6602d 100644 --- a/docs/src/test-api/class-testinfo.md +++ b/docs/src/test-api/class-testinfo.md @@ -42,7 +42,7 @@ The list of files or buffers attached to the current test. Some reporters show t To add an attachment, use [`method: TestInfo.attach`] instead of directly pushing onto this array. -## method: TestInfo.attach +## async method: TestInfo.attach Attach a value or a file from disk to the current test. Some reporters show test attachments. Either [`option: path`] or [`option: body`] must be specified, but not both. diff --git a/packages/playwright-test/types/test.d.ts b/packages/playwright-test/types/test.d.ts index 3d655d8554..27d7a2baf8 100644 --- a/packages/playwright-test/types/test.d.ts +++ b/packages/playwright-test/types/test.d.ts @@ -1474,7 +1474,7 @@ export interface TestInfo { contentType?: string; path?: string; - }): void; + }): Promise; /** * Column number where the currently running test is declared. diff --git a/tests/config/experimental.d.ts b/tests/config/experimental.d.ts index 880333a64f..4bf732c7b7 100644 --- a/tests/config/experimental.d.ts +++ b/tests/config/experimental.d.ts @@ -11117,13 +11117,18 @@ export interface Android { * @param options */ devices(options?: { + /** + * Optional host to establish ADB server connection. Default to `127.0.0.1`. + */ + host?: string; + /** * Prevents automatic playwright driver installation on attach. Assumes that the drivers have been installed already. */ omitDriverInstall?: boolean; /** - * Optional port to establish ADB server connection. + * Optional port to establish ADB server connection. Default to `5037`. */ port?: number; }): Promise>; @@ -17143,7 +17148,7 @@ interface TestConfig { reuseExistingServer?: boolean; /** - * Current working directory of the spawned process, `process.cwd()` by default. + * Current working directory of the spawned process, defaults to the directory of the configuration file. */ cwd?: string; @@ -17687,7 +17692,7 @@ export interface TestInfo { contentType?: string; path?: string; - }): void; + }): Promise; /** * Column number where the currently running test is declared. diff --git a/utils/generate_types/index.js b/utils/generate_types/index.js index 25f7318759..1775b0e235 100644 --- a/utils/generate_types/index.js +++ b/utils/generate_types/index.js @@ -658,6 +658,7 @@ class TypesGenerator { writeFile(path.join(coreTypesDir, 'types.d.ts'), await generateCoreTypes(false), true); writeFile(path.join(testTypesDir, 'test.d.ts'), await generateTestTypes(false), true); writeFile(path.join(testTypesDir, 'testReporter.d.ts'), await generateReporterTypes(false), true); + writeFile(path.join(__dirname, '..', '..', 'tests', 'config', 'experimental.d.ts'), await generateExperimentalTypes(), true); process.exit(hadChanges && process.argv.includes('--check-clean') ? 1 : 0); })().catch(e => { console.error(e);