Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blob report no top level fields #30270

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/src/test-reporter-api/class-fullconfig.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ Resolved configuration passed to [`method: Reporter.onBegin`].

## property: FullConfig.configFile
* since: v1.20
* deprecated: Use [`property: FullProject.configFile`] instead.
- type: ?<[string]>

Path to the configuration file (if any) used to run the tests.
@@ -36,6 +37,7 @@ See [`property: TestConfig.globalTeardown`].

## property: FullConfig.globalTimeout
* since: v1.10
* deprecated: Use [`property: FullProject.globalTimeout`] instead.
- type: <[int]>

See [`property: TestConfig.globalTimeout`].
@@ -54,6 +56,7 @@ See [`property: TestConfig.grepInvert`].

## property: FullConfig.maxFailures
* since: v1.10
* deprecated: Use [`property: FullProject.maxFailures`] instead.
- type: <[int]>

See [`property: TestConfig.maxFailures`].
@@ -130,6 +133,7 @@ See [`property: TestConfig.webServer`].

## property: FullConfig.workers
* since: v1.10
* deprecated: Use [`property: FullProject.workers`] instead.
- type: <[int]>

See [`property: TestConfig.workers`].
24 changes: 24 additions & 0 deletions docs/src/test-reporter-api/class-fullproject.md
Original file line number Diff line number Diff line change
@@ -7,12 +7,24 @@ to [Reporter]. It exposes some of the resolved fields declared in
[TestProject]. You can get [FullProject] instance from [`property: FullConfig.projects`]
or [`method: Suite.project`].

## property: FullProject.configFile
* since: v1.44
- type: ?<[string]>

Path to the configuration file (if any) used to run the tests.

## property: FullProject.dependencies
* since: v1.31
- type: <[Array]<[string]>>

See [`property: TestProject.dependencies`].

## property: FullProject.globalTimeout
* since: v1.44
- type: <[int]>

See [`property: TestConfig.globalTimeout`].

## property: FullProject.grep
* since: v1.10
- type: <[RegExp]|[Array]<[RegExp]>>
@@ -43,6 +55,12 @@ See [`property: TestProject.name`].

See [`property: TestProject.snapshotDir`].

## property: FullProject.maxFailures
* since: v1.44
- type: <[int]>

See [`property: TestConfig.maxFailures`].

## property: FullProject.outputDir
* since: v1.10
- type: <[string]>
@@ -96,3 +114,9 @@ See [`property: TestProject.timeout`].
- type: <[Fixtures]>

See [`property: TestProject.use`].

## property: FullProject.workers
* since: v1.44
- type: <[int]>

Number of test workers that ran tests from this project. See [`property: TestConfig.workers`].
1 change: 1 addition & 0 deletions packages/playwright/src/common/config.ts
Original file line number Diff line number Diff line change
@@ -174,7 +174,8 @@
const defaultSnapshotPathTemplate = '{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}{-snapshotSuffix}{ext}';
this.snapshotPathTemplate = takeFirst(projectConfig.snapshotPathTemplate, config.snapshotPathTemplate, defaultSnapshotPathTemplate);

this.project = {

Check failure on line 177 in packages/playwright/src/common/config.ts

GitHub Actions / docs & lint

Type '{ globalTimeout: number; grep: RegExp | RegExp[]; grepInvert: RegExp | RegExp[] | null; outputDir: string; repeatEach: number; retries: number; metadata: Metadata; ... 8 more ...; teardown: string | undefined; }' is missing the following properties from type 'FullProject<{}, {}>': maxFailures, workers
globalTimeout: fullConfig.config.globalTimeout,
grep: takeFirst(projectConfig.grep, config.grep, defaultGrep),
grepInvert: takeFirst(projectConfig.grepInvert, config.grepInvert, null),
outputDir: takeFirst(configCLIOverrides.outputDir, pathResolve(configDir, projectConfig.outputDir), pathResolve(configDir, config.outputDir), path.join(throwawayArtifactsPath, 'test-results')),
2 changes: 1 addition & 1 deletion packages/playwright/src/common/ipc.ts
Original file line number Diff line number Diff line change
@@ -129,7 +129,7 @@ export type EnvProducedPayload = [string, string | null][];

export function serializeConfig(config: FullConfigInternal, passCompilationCache: boolean): SerializedConfig {
const result: SerializedConfig = {
location: { configDir: config.configDir, resolvedConfigFile: config.config.configFile },
location: { configDir: config.configDir, resolvedConfigFile: config.config.projects[0]?.configFile },
configCLIOverrides: config.configCLIOverrides,
compilationCache: passCompilationCache ? serializeCompilationCache() : undefined,
};
4 changes: 2 additions & 2 deletions packages/playwright/src/reporters/base.ts
Original file line number Diff line number Diff line change
@@ -153,7 +153,7 @@ export class BaseReporter implements ReporterV2 {
}

protected generateStartingMessage() {
const jobs = this.config.metadata.actualWorkers ?? this.config.workers;
const jobs = this.config.metadata.actualWorkers ?? this.config.projects[0].workers;
const shardDetails = this.config.shard ? `, shard ${this.config.shard.current} of ${this.config.shard.total}` : '';
if (!this.totalTestCount)
return '';
@@ -195,7 +195,7 @@ export class BaseReporter implements ReporterV2 {
if (expected)
tokens.push(colors.green(` ${expected} passed`) + colors.dim(` (${milliseconds(this.result.duration)})`));
if (this.result.status === 'timedout')
tokens.push(colors.red(` Timed out waiting ${this.config.globalTimeout / 1000}s for the entire test run`));
tokens.push(colors.red(` Timed out waiting ${this.config.projects[0].globalTimeout / 1000}s for the entire test run`));
if (fatalErrors.length && expected + unexpected.length + interrupted.length + flaky.length > 0)
tokens.push(colors.red(` ${fatalErrors.length === 1 ? '1 error was not a part of any test' : fatalErrors.length + ' errors were not a part of any test'}, see above for details`));

4 changes: 2 additions & 2 deletions packages/playwright/src/reporters/json.ts
Original file line number Diff line number Diff line change
@@ -231,8 +231,8 @@ class JSONReporter extends EmptyReporter {
async function outputReport(report: JSONReport, config: FullConfig, outputFile: string | undefined) {
const reportString = JSON.stringify(report, undefined, 2);
if (outputFile) {
assert(config.configFile || path.isAbsolute(outputFile), 'Expected fully resolved path if not using config file.');
outputFile = config.configFile ? path.resolve(path.dirname(config.configFile), outputFile) : outputFile;
assert(config.projects[0]?.configFile || path.isAbsolute(outputFile), 'Expected fully resolved path if not using config file.');
outputFile = config.projects[0]?.configFile ? path.resolve(path.dirname(config.projects[0]?.configFile), outputFile) : outputFile;
await fs.promises.mkdir(path.dirname(outputFile), { recursive: true });
await fs.promises.writeFile(outputFile, reportString);
} else {
4 changes: 2 additions & 2 deletions packages/playwright/src/reporters/junit.ts
Original file line number Diff line number Diff line change
@@ -55,8 +55,8 @@ class JUnitReporter extends EmptyReporter {
this.timestamp = new Date();
this.startTime = monotonicTime();
if (this.outputFile) {
assert(this.config.configFile || path.isAbsolute(this.outputFile), 'Expected fully resolved path if not using config file.');
this.resolvedOutputFile = this.config.configFile ? path.resolve(path.dirname(this.config.configFile), this.outputFile) : this.outputFile;
assert(this.config.projects[0]?.configFile || path.isAbsolute(this.outputFile), 'Expected fully resolved path if not using config file.');
this.resolvedOutputFile = this.config.projects[0]?.configFile ? path.resolve(path.dirname(this.config.projects[0]?.configFile), this.outputFile) : this.outputFile;
}
}

2 changes: 1 addition & 1 deletion packages/playwright/src/runner/loadUtils.ts
Original file line number Diff line number Diff line change
@@ -169,7 +169,7 @@ export async function createRootSuite(testRun: TestRun, errors: TestError[], sho
if (config.config.forbidOnly) {
const onlyTestsAndSuites = rootSuite._getOnlyItems();
if (onlyTestsAndSuites.length > 0) {
const configFilePath = config.config.configFile ? path.relative(config.config.rootDir, config.config.configFile) : undefined;
const configFilePath = config.config.projects[0]?.configFile ? path.relative(config.config.rootDir, config.config.projects[0]?.configFile) : undefined;
errors.push(...createForbidOnlyErrors(onlyTestsAndSuites, config.configCLIOverrides.forbidOnly, configFilePath));
}
}
2 changes: 1 addition & 1 deletion packages/playwright/src/runner/runner.ts
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ export class Runner {
async runAllTests(): Promise<FullResult['status']> {
const config = this._config;
const listOnly = config.cliListOnly;
const deadline = config.config.globalTimeout ? monotonicTime() + config.config.globalTimeout : 0;
const deadline = config.config.projects[0].globalTimeout ? monotonicTime() + config.config.projects[0].globalTimeout : 0;

// Legacy webServer support.
webServerPluginsForConfig(config).forEach(p => config.plugins.push({ factory: p }));
8 changes: 4 additions & 4 deletions packages/playwright/src/runner/tasks.ts
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ export class TestRun {
}

export function createTaskRunner(config: FullConfigInternal, reporter: ReporterV2): TaskRunner<TestRun> {
const taskRunner = new TaskRunner<TestRun>(reporter, config.config.globalTimeout);
const taskRunner = new TaskRunner<TestRun>(reporter, config.config.projects[0].globalTimeout);
addGlobalSetupTasks(taskRunner, config);
taskRunner.addTask('load tests', createLoadTask('in-process', { filterOnly: true, failOnLoadErrors: true }));
addRunTasks(taskRunner, config);
@@ -109,14 +109,14 @@ function addRunTasks(taskRunner: TaskRunner<TestRun>, config: FullConfigInternal
}

export function createTaskRunnerForList(config: FullConfigInternal, reporter: ReporterV2, mode: 'in-process' | 'out-of-process', options: { failOnLoadErrors: boolean }): TaskRunner<TestRun> {
const taskRunner = new TaskRunner<TestRun>(reporter, config.config.globalTimeout);
const taskRunner = new TaskRunner<TestRun>(reporter, config.config.projects[0].globalTimeout);
taskRunner.addTask('load tests', createLoadTask(mode, { ...options, filterOnly: false }));
taskRunner.addTask('report begin', createReportBeginTask());
return taskRunner;
}

export function createTaskRunnerForListFiles(config: FullConfigInternal, reporter: ReporterV2): TaskRunner<TestRun> {
const taskRunner = new TaskRunner<TestRun>(reporter, config.config.globalTimeout);
const taskRunner = new TaskRunner<TestRun>(reporter, config.config.projects[0].globalTimeout);
taskRunner.addTask('load tests', createListFilesTask());
taskRunner.addTask('report begin', createReportBeginTask());
return taskRunner;
@@ -283,7 +283,7 @@ function createPhasesTask(): Task<TestRun> {
testRun.phases.push(phase);
for (const project of phaseProjects) {
const projectSuite = projectToSuite.get(project)!;
const testGroups = createTestGroups(projectSuite, testRun.config.config.workers);
const testGroups = createTestGroups(projectSuite, project.project.workers);
phase.projects.push({ project, projectSuite, testGroups });
testGroupsInPhase += testGroups.length;
}
26 changes: 26 additions & 0 deletions packages/playwright/types/testReporter.d.ts
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {
webServer: ConfigInWorker['webServer'];
/**
* Path to the configuration file (if any) used to run the tests.
* @deprecated Use [fullProject.configFile](https://playwright.dev/docs/api/class-fullproject#full-project-config-file) instead.
*/
configFile?: string;

@@ -64,6 +65,8 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {

/**
* See [testConfig.globalTimeout](https://playwright.dev/docs/api/class-testconfig#test-config-global-timeout).
* @deprecated Use [fullProject.globalTimeout](https://playwright.dev/docs/api/class-fullproject#full-project-global-timeout)
* instead.
*/
globalTimeout: number;

@@ -79,6 +82,7 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {

/**
* See [testConfig.maxFailures](https://playwright.dev/docs/api/class-testconfig#test-config-max-failures).
* @deprecated Use [fullProject.maxFailures](https://playwright.dev/docs/api/class-fullproject#full-project-max-failures) instead.
*/
maxFailures: number;

@@ -141,6 +145,7 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {

/**
* See [testConfig.workers](https://playwright.dev/docs/api/class-testconfig#test-config-workers).
* @deprecated Use [fullProject.workers](https://playwright.dev/docs/api/class-fullproject#full-project-workers) instead.
*/
workers: number;
}
@@ -156,11 +161,21 @@ export interface FullProject<TestArgs = {}, WorkerArgs = {}> {
* See [testProject.use](https://playwright.dev/docs/api/class-testproject#test-project-use).
*/
use: UseOptions<PlaywrightTestOptions & TestArgs, PlaywrightWorkerOptions & WorkerArgs>;
/**
* Path to the configuration file (if any) used to run the tests.
*/
configFile?: string;

/**
* See [testProject.dependencies](https://playwright.dev/docs/api/class-testproject#test-project-dependencies).
*/
dependencies: Array<string>;

/**
* See [testConfig.globalTimeout](https://playwright.dev/docs/api/class-testconfig#test-config-global-timeout).
*/
globalTimeout: number;

/**
* See [testProject.grep](https://playwright.dev/docs/api/class-testproject#test-project-grep).
*/
@@ -171,6 +186,11 @@ export interface FullProject<TestArgs = {}, WorkerArgs = {}> {
*/
grepInvert: null|RegExp|Array<RegExp>;

/**
* See [testConfig.maxFailures](https://playwright.dev/docs/api/class-testconfig#test-config-max-failures).
*/
maxFailures: number;

/**
* See [testProject.metadata](https://playwright.dev/docs/api/class-testproject#test-project-metadata).
*/
@@ -225,6 +245,12 @@ export interface FullProject<TestArgs = {}, WorkerArgs = {}> {
* See [testProject.timeout](https://playwright.dev/docs/api/class-testproject#test-project-timeout).
*/
timeout: number;

/**
* Number of test workers that ran tests from this project. See
* [testConfig.workers](https://playwright.dev/docs/api/class-testconfig#test-config-workers).
*/
workers: number;
}

/**
2 changes: 1 addition & 1 deletion packages/trace-viewer/src/ui/uiModeFiltersView.tsx
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@ export const FiltersView: React.FC<{
const copy = new Map(projectFilters);
copy.set(projectName, !copy.get(projectName));
setProjectFilters(copy);
const configFile = testModel?.config?.configFile;
const configFile = testModel?.config?.projects[0]?.configFile;
if (configFile)
settings.setObject(configFile + ':projects', [...copy.entries()].filter(([_, v]) => v).map(([k]) => k));
}}/>
2 changes: 1 addition & 1 deletion packages/trace-viewer/src/ui/uiModeView.tsx
Original file line number Diff line number Diff line change
@@ -202,7 +202,7 @@ export const UIModeView: React.FC<{}> = ({
return;

const { config, rootSuite } = testModel;
const selectedProjects = config.configFile ? settings.getObject<string[] | undefined>(config.configFile + ':projects', undefined) : undefined;
const selectedProjects = config.projects[0]?.configFile ? settings.getObject<string[] | undefined>(config.projects[0]?.configFile + ':projects', undefined) : undefined;
const newFilter = new Map(projectFilters);
for (const projectName of newFilter.keys()) {
if (!rootSuite.suites.find(s => s.title === projectName))

Unchanged files with check annotations Beta

private _parseProject(project: JsonProject): TeleFullProject {
return {
metadata: project.metadata,
name: project.name,

Check failure on line 311 in packages/playwright/src/isomorphic/teleReceiver.ts

GitHub Actions / docs & lint

Type '{ metadata: Metadata; name: string; outputDir: string; repeatEach: number; retries: number; testDir: string; testIgnore: (string | RegExp)[]; testMatch: (string | RegExp)[]; ... 6 more ...; use: {}; }' is missing the following properties from type 'FullProject<{}, {}>': globalTimeout, maxFailures, workers
outputDir: this._absolutePath(project.outputDir),
repeatEach: project.repeatEach,
retries: project.retries,