mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
parent
562fd989df
commit
7ba527c65f
@ -16,76 +16,9 @@
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import type { FullConfig, TestCase, Suite, TestResult, TestError, TestStep, FullResult, TestStatus, Location, Reporter } from '../../types/testReporter';
|
||||
import type { FullConfig, TestCase, Suite, TestResult, TestError, TestStep, FullResult, Location, Reporter, JSONReport, JSONReportSuite, JSONReportSpec, JSONReportTest, JSONReportTestResult, JSONReportTestStep } from '../../types/testReporter';
|
||||
import { prepareErrorStack } from './base';
|
||||
|
||||
export interface JSONReport {
|
||||
config: Omit<FullConfig, 'projects'> & {
|
||||
projects: {
|
||||
outputDir: string,
|
||||
repeatEach: number,
|
||||
retries: number,
|
||||
metadata: any,
|
||||
name: string,
|
||||
testDir: string,
|
||||
testIgnore: string[],
|
||||
testMatch: string[],
|
||||
timeout: number,
|
||||
}[],
|
||||
};
|
||||
suites: JSONReportSuite[];
|
||||
errors: TestError[];
|
||||
}
|
||||
export interface JSONReportSuite {
|
||||
title: string;
|
||||
file: string;
|
||||
column: number;
|
||||
line: number;
|
||||
specs: JSONReportSpec[];
|
||||
suites?: JSONReportSuite[];
|
||||
}
|
||||
export interface JSONReportSpec {
|
||||
tags: string[],
|
||||
title: string;
|
||||
ok: boolean;
|
||||
tests: JSONReportTest[];
|
||||
file: string;
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
export interface JSONReportTest {
|
||||
timeout: number;
|
||||
annotations: { type: string, description?: string }[],
|
||||
expectedStatus: TestStatus;
|
||||
projectName: string;
|
||||
results: JSONReportTestResult[];
|
||||
status: 'skipped' | 'expected' | 'unexpected' | 'flaky';
|
||||
}
|
||||
export interface JSONReportTestResult {
|
||||
workerIndex: number;
|
||||
status: TestStatus | undefined;
|
||||
duration: number;
|
||||
error: TestError | undefined;
|
||||
stdout: JSONReportSTDIOEntry[];
|
||||
stderr: JSONReportSTDIOEntry[];
|
||||
retry: number;
|
||||
steps?: JSONReportTestStep[];
|
||||
attachments: {
|
||||
name: string;
|
||||
path?: string;
|
||||
body?: string;
|
||||
contentType: string;
|
||||
}[];
|
||||
errorLocation?: Location;
|
||||
}
|
||||
export interface JSONReportTestStep {
|
||||
title: string;
|
||||
duration: number;
|
||||
error: TestError | undefined;
|
||||
steps?: JSONReportTestStep[];
|
||||
}
|
||||
export type JSONReportSTDIOEntry = { text: string } | { buffer: string };
|
||||
|
||||
export function toPosixPath(aPath: string): string {
|
||||
return aPath.split(path.sep).join(path.posix.sep);
|
||||
}
|
||||
|
73
packages/playwright-test/types/testReporter.d.ts
vendored
73
packages/playwright-test/types/testReporter.d.ts
vendored
@ -457,6 +457,79 @@ export interface Reporter {
|
||||
*/
|
||||
printsToStdio?(): boolean;}
|
||||
|
||||
export interface JSONReport {
|
||||
config: Omit<FullConfig, 'projects'> & {
|
||||
projects: {
|
||||
outputDir: string,
|
||||
repeatEach: number,
|
||||
retries: number,
|
||||
metadata: any,
|
||||
name: string,
|
||||
testDir: string,
|
||||
testIgnore: string[],
|
||||
testMatch: string[],
|
||||
timeout: number,
|
||||
}[],
|
||||
};
|
||||
suites: JSONReportSuite[];
|
||||
errors: TestError[];
|
||||
}
|
||||
|
||||
export interface JSONReportSuite {
|
||||
title: string;
|
||||
file: string;
|
||||
column: number;
|
||||
line: number;
|
||||
specs: JSONReportSpec[];
|
||||
suites?: JSONReportSuite[];
|
||||
}
|
||||
|
||||
export interface JSONReportSpec {
|
||||
tags: string[],
|
||||
title: string;
|
||||
ok: boolean;
|
||||
tests: JSONReportTest[];
|
||||
file: string;
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
|
||||
export interface JSONReportTest {
|
||||
timeout: number;
|
||||
annotations: { type: string, description?: string }[],
|
||||
expectedStatus: TestStatus;
|
||||
projectName: string;
|
||||
results: JSONReportTestResult[];
|
||||
status: 'skipped' | 'expected' | 'unexpected' | 'flaky';
|
||||
}
|
||||
|
||||
export interface JSONReportTestResult {
|
||||
workerIndex: number;
|
||||
status: TestStatus | undefined;
|
||||
duration: number;
|
||||
error: TestError | undefined;
|
||||
stdout: JSONReportSTDIOEntry[];
|
||||
stderr: JSONReportSTDIOEntry[];
|
||||
retry: number;
|
||||
steps?: JSONReportTestStep[];
|
||||
attachments: {
|
||||
name: string;
|
||||
path?: string;
|
||||
body?: string;
|
||||
contentType: string;
|
||||
}[];
|
||||
errorLocation?: Location;
|
||||
}
|
||||
|
||||
export interface JSONReportTestStep {
|
||||
title: string;
|
||||
duration: number;
|
||||
error: TestError | undefined;
|
||||
steps?: JSONReportTestStep[];
|
||||
}
|
||||
|
||||
export type JSONReportSTDIOEntry = { text: string } | { buffer: string };
|
||||
|
||||
// This is required to not export everything by default. See https://github.com/Microsoft/TypeScript/issues/19545#issuecomment-340490459
|
||||
export {};
|
||||
|
||||
|
73
tests/config/experimental.d.ts
vendored
73
tests/config/experimental.d.ts
vendored
@ -20594,6 +20594,79 @@ export interface Reporter {
|
||||
*/
|
||||
printsToStdio?(): boolean;}
|
||||
|
||||
export interface JSONReport {
|
||||
config: Omit<FullConfig, 'projects'> & {
|
||||
projects: {
|
||||
outputDir: string,
|
||||
repeatEach: number,
|
||||
retries: number,
|
||||
metadata: any,
|
||||
name: string,
|
||||
testDir: string,
|
||||
testIgnore: string[],
|
||||
testMatch: string[],
|
||||
timeout: number,
|
||||
}[],
|
||||
};
|
||||
suites: JSONReportSuite[];
|
||||
errors: TestError[];
|
||||
}
|
||||
|
||||
export interface JSONReportSuite {
|
||||
title: string;
|
||||
file: string;
|
||||
column: number;
|
||||
line: number;
|
||||
specs: JSONReportSpec[];
|
||||
suites?: JSONReportSuite[];
|
||||
}
|
||||
|
||||
export interface JSONReportSpec {
|
||||
tags: string[],
|
||||
title: string;
|
||||
ok: boolean;
|
||||
tests: JSONReportTest[];
|
||||
file: string;
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
|
||||
export interface JSONReportTest {
|
||||
timeout: number;
|
||||
annotations: { type: string, description?: string }[],
|
||||
expectedStatus: TestStatus;
|
||||
projectName: string;
|
||||
results: JSONReportTestResult[];
|
||||
status: 'skipped' | 'expected' | 'unexpected' | 'flaky';
|
||||
}
|
||||
|
||||
export interface JSONReportTestResult {
|
||||
workerIndex: number;
|
||||
status: TestStatus | undefined;
|
||||
duration: number;
|
||||
error: TestError | undefined;
|
||||
stdout: JSONReportSTDIOEntry[];
|
||||
stderr: JSONReportSTDIOEntry[];
|
||||
retry: number;
|
||||
steps?: JSONReportTestStep[];
|
||||
attachments: {
|
||||
name: string;
|
||||
path?: string;
|
||||
body?: string;
|
||||
contentType: string;
|
||||
}[];
|
||||
errorLocation?: Location;
|
||||
}
|
||||
|
||||
export interface JSONReportTestStep {
|
||||
title: string;
|
||||
duration: number;
|
||||
error: TestError | undefined;
|
||||
steps?: JSONReportTestStep[];
|
||||
}
|
||||
|
||||
export type JSONReportSTDIOEntry = { text: string } | { buffer: string };
|
||||
|
||||
// This is required to not export everything by default. See https://github.com/Microsoft/TypeScript/issues/19545#issuecomment-340490459
|
||||
export {};
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { JSONReport, JSONReportSuite } from '@playwright/test/src/reporters/json';
|
||||
import type { JSONReport, JSONReportSuite } from '@playwright/test/reporter';
|
||||
import * as fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
|
@ -591,7 +591,15 @@ class TypesGenerator {
|
||||
...coreDocumentation.classesArray.map(cls => cls.name),
|
||||
...testDocumentation.classesArray.map(cls => cls.name),
|
||||
]),
|
||||
ignoreMissing: new Set(['FullResult']),
|
||||
ignoreMissing: new Set([
|
||||
'FullResult',
|
||||
'JSONReport',
|
||||
'JSONReportSuite',
|
||||
'JSONReportSpec',
|
||||
'JSONReportTest',
|
||||
'JSONReportTestResult',
|
||||
'JSONReportTestStep',
|
||||
]),
|
||||
includeExperimental,
|
||||
});
|
||||
return await generator.generateTypes(path.join(__dirname, 'overrides-testReporter.d.ts'));
|
||||
|
73
utils/generate_types/overrides-testReporter.d.ts
vendored
73
utils/generate_types/overrides-testReporter.d.ts
vendored
@ -48,5 +48,78 @@ export interface Reporter {
|
||||
onEnd?(result: FullResult): void | Promise<void>;
|
||||
}
|
||||
|
||||
export interface JSONReport {
|
||||
config: Omit<FullConfig, 'projects'> & {
|
||||
projects: {
|
||||
outputDir: string,
|
||||
repeatEach: number,
|
||||
retries: number,
|
||||
metadata: any,
|
||||
name: string,
|
||||
testDir: string,
|
||||
testIgnore: string[],
|
||||
testMatch: string[],
|
||||
timeout: number,
|
||||
}[],
|
||||
};
|
||||
suites: JSONReportSuite[];
|
||||
errors: TestError[];
|
||||
}
|
||||
|
||||
export interface JSONReportSuite {
|
||||
title: string;
|
||||
file: string;
|
||||
column: number;
|
||||
line: number;
|
||||
specs: JSONReportSpec[];
|
||||
suites?: JSONReportSuite[];
|
||||
}
|
||||
|
||||
export interface JSONReportSpec {
|
||||
tags: string[],
|
||||
title: string;
|
||||
ok: boolean;
|
||||
tests: JSONReportTest[];
|
||||
file: string;
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
|
||||
export interface JSONReportTest {
|
||||
timeout: number;
|
||||
annotations: { type: string, description?: string }[],
|
||||
expectedStatus: TestStatus;
|
||||
projectName: string;
|
||||
results: JSONReportTestResult[];
|
||||
status: 'skipped' | 'expected' | 'unexpected' | 'flaky';
|
||||
}
|
||||
|
||||
export interface JSONReportTestResult {
|
||||
workerIndex: number;
|
||||
status: TestStatus | undefined;
|
||||
duration: number;
|
||||
error: TestError | undefined;
|
||||
stdout: JSONReportSTDIOEntry[];
|
||||
stderr: JSONReportSTDIOEntry[];
|
||||
retry: number;
|
||||
steps?: JSONReportTestStep[];
|
||||
attachments: {
|
||||
name: string;
|
||||
path?: string;
|
||||
body?: string;
|
||||
contentType: string;
|
||||
}[];
|
||||
errorLocation?: Location;
|
||||
}
|
||||
|
||||
export interface JSONReportTestStep {
|
||||
title: string;
|
||||
duration: number;
|
||||
error: TestError | undefined;
|
||||
steps?: JSONReportTestStep[];
|
||||
}
|
||||
|
||||
export type JSONReportSTDIOEntry = { text: string } | { buffer: string };
|
||||
|
||||
// This is required to not export everything by default. See https://github.com/Microsoft/TypeScript/issues/19545#issuecomment-340490459
|
||||
export {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user