Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: consistently use TestAnnotation type (#41588)

Dmitry Gozmana92e459afb2b
diff --git a/packages/playwright/src/common/ipc.ts b/packages/playwright/src/common/ipc.ts
index 27fa4287fe..6cc0436d33 100644
--- a/packages/playwright/src/common/ipc.ts
+++ b/packages/playwright/src/common/ipc.ts
@@ -19,7 +19,7 @@ import util from 'util';
import { serializeCompilationCache } from '../transform/compilationCache';
import type { ConfigLocation, FullConfigInternal } from './config';
-import type { ReporterDescription, TestInfoError, TestStatus } from '../../types/test';
+import type { ReporterDescription, TestInfoError, TestStatus, TestAnnotation } from '../../types/test';
import type { SerializedCompilationCache } from '../transform/compilationCache';
export type ConfigCLIOverrides = {
@@ -116,7 +116,7 @@ export type TestEndPayload = {
errors: TestInfoErrorPayload[];
hasNonRetriableError: boolean;
expectedStatus: TestStatus;
- annotations: { type: string, description?: string }[];
+ annotations: TestAnnotation[];
timeout: number;
};
@@ -136,13 +136,13 @@ export type StepEndPayload = {
wallTime: number; // milliseconds since unix epoch
error?: TestInfoErrorPayload;
suggestedRebaseline?: string;
- annotations: { type: string, description?: string }[];
+ annotations: TestAnnotation[];
};
export type TestEntry = {
testId: string;
retry: number;
- planAnnotations: { type: string, description?: string, location?: { file: string, line: number, column: number } }[];
+ planAnnotations: TestAnnotation[];
};
export type RunPayload = {
diff --git a/packages/playwright/types/testReporter.d.ts b/packages/playwright/types/testReporter.d.ts
index 785f8800cc..47e406bcd1 100644
--- a/packages/playwright/types/testReporter.d.ts
+++ b/packages/playwright/types/testReporter.d.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import type { TestStatus, Metadata, PlaywrightTestOptions, PlaywrightWorkerOptions, ReporterDescription, FullConfig, FullProject, Location, WorkerInfo } from './test';
+import type { TestStatus, Metadata, PlaywrightTestOptions, PlaywrightWorkerOptions, ReporterDescription, FullConfig, FullProject, Location, WorkerInfo, TestAnnotation } from './test';
export type { FullConfig, FullProject, TestStatus, Location, WorkerInfo } from './test';
/**
@@ -300,7 +300,7 @@ export interface JSONReportSpec {
export interface JSONReportTest {
timeout: number;
- annotations: { type: string, description?: string }[],
+ annotations: TestAnnotation[],
expectedStatus: TestStatus;
projectName: string;
projectId: string;
@@ -332,7 +332,7 @@ export interface JSONReportTestResult {
body?: string;
contentType: string;
}[];
- annotations: { type: string, description?: string }[];
+ annotations: TestAnnotation[];
errorLocation?: Location;
}
diff --git a/utils/generate_types/overrides-testReporter.d.ts b/utils/generate_types/overrides-testReporter.d.ts
index a4376aabca..26633625a5 100644
--- a/utils/generate_types/overrides-testReporter.d.ts
+++ b/utils/generate_types/overrides-testReporter.d.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import type { TestStatus, Metadata, PlaywrightTestOptions, PlaywrightWorkerOptions, ReporterDescription, FullConfig, FullProject, Location, WorkerInfo } from './test';
+import type { TestStatus, Metadata, PlaywrightTestOptions, PlaywrightWorkerOptions, ReporterDescription, FullConfig, FullProject, Location, WorkerInfo, TestAnnotation } from './test';
export type { FullConfig, FullProject, TestStatus, Location, WorkerInfo } from './test';
/**
@@ -95,7 +95,7 @@ export interface JSONReportSpec {
export interface JSONReportTest {
timeout: number;
- annotations: { type: string, description?: string }[],
+ annotations: TestAnnotation[],
expectedStatus: TestStatus;
projectName: string;
projectId: string;
@@ -127,7 +127,7 @@ export interface JSONReportTestResult {
body?: string;
contentType: string;
}[];
- annotations: { type: string, description?: string }[];
+ annotations: TestAnnotation[];
errorLocation?: Location;
}