fix(testServer): pass use options to listFiles command (#34832)
This commit is contained in:
parent
715123afbe
commit
1af4e367f4
|
|
@ -52,6 +52,7 @@ export type JsonProject = {
|
||||||
testIgnore: JsonPattern[];
|
testIgnore: JsonPattern[];
|
||||||
testMatch: JsonPattern[];
|
testMatch: JsonPattern[];
|
||||||
timeout: number;
|
timeout: number;
|
||||||
|
use: { [key: string]: any };
|
||||||
};
|
};
|
||||||
|
|
||||||
export type JsonSuite = {
|
export type JsonSuite = {
|
||||||
|
|
@ -326,7 +327,7 @@ export class TeleReporterReceiver {
|
||||||
dependencies: project.dependencies,
|
dependencies: project.dependencies,
|
||||||
teardown: project.teardown,
|
teardown: project.teardown,
|
||||||
snapshotDir: this._absolutePath(project.snapshotDir),
|
snapshotDir: this._absolutePath(project.snapshotDir),
|
||||||
use: {},
|
use: project.use,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -184,10 +184,17 @@ export class TeleReporterEmitter implements ReporterV2 {
|
||||||
dependencies: project.dependencies,
|
dependencies: project.dependencies,
|
||||||
snapshotDir: this._relativePath(project.snapshotDir),
|
snapshotDir: this._relativePath(project.snapshotDir),
|
||||||
teardown: project.teardown,
|
teardown: project.teardown,
|
||||||
|
use: this._serializeProjectUseOptions(project.use),
|
||||||
};
|
};
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _serializeProjectUseOptions(use: reporterTypes.FullProject['use']): Record<string, any> {
|
||||||
|
return {
|
||||||
|
testIdAttribute: use.testIdAttribute,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private _serializeSuite(suite: reporterTypes.Suite): teleReceiver.JsonSuite {
|
private _serializeSuite(suite: reporterTypes.Suite): teleReceiver.JsonSuite {
|
||||||
const result = {
|
const result = {
|
||||||
title: suite.title,
|
title: suite.title,
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,31 @@ test('file watching', async ({ startTestServer, writeFiles }, testInfo) => {
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should list tests with testIdAttribute', async ({ startTestServer, writeFiles }) => {
|
||||||
|
await writeFiles({
|
||||||
|
'a.test.ts': `
|
||||||
|
import { test } from '@playwright/test';
|
||||||
|
test('foo', () => {});
|
||||||
|
`,
|
||||||
|
'playwright.config.ts': `
|
||||||
|
module.exports = {
|
||||||
|
projects: [{
|
||||||
|
name: 'chromium',
|
||||||
|
use: {
|
||||||
|
testIdAttribute: 'testId',
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
`,
|
||||||
|
});
|
||||||
|
|
||||||
|
const testServerConnection = await startTestServer();
|
||||||
|
const events = await testServerConnection.listFiles({});
|
||||||
|
const onProject = events.report.find(e => e.method === 'onProject').params.project;
|
||||||
|
expect(onProject.name).toBe('chromium');
|
||||||
|
expect(onProject.use.testIdAttribute).toBe('testId');
|
||||||
|
});
|
||||||
|
|
||||||
test('stdio interception', async ({ startTestServer, writeFiles }) => {
|
test('stdio interception', async ({ startTestServer, writeFiles }) => {
|
||||||
const testServerConnection = await startTestServer();
|
const testServerConnection = await startTestServer();
|
||||||
await testServerConnection.initialize({ interceptStdio: true });
|
await testServerConnection.initialize({ interceptStdio: true });
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue