fix(test runner): restore --headed flag (#13872)

This commit is contained in:
Dmitry Gozman 2022-05-02 16:55:14 +01:00 committed by GitHub
parent 2dafbfc2dc
commit d87de8c52c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -251,6 +251,7 @@ export class Loader {
projectConfig.repeatEach = takeFirst(this._configCLIOverrides.repeatEach, projectConfig.repeatEach);
projectConfig.retries = takeFirst(this._configCLIOverrides.retries, projectConfig.retries);
projectConfig.timeout = takeFirst(this._configCLIOverrides.timeout, projectConfig.timeout);
projectConfig.use = mergeObjects(projectConfig.use, this._configCLIOverrides.use);
}
private _resolveProject(config: Config, projectConfig: Project, throwawayArtifactsPath: string): FullProjectInternal {

View File

@ -121,6 +121,25 @@ test('should complain with projects and --browser', async ({ runInlineTest }) =>
expect(result.output).toContain('Cannot use --browser option when configuration file defines projects');
});
test('should override any headless option with --headed', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
module.exports = { projects: [
{ name: 'a', use: { headless: true } }
] };
`,
'a.test.ts': `
const { test } = pwt;
test('example', async ({ page }) => {
expect(await page.evaluate(() => navigator.userAgent)).not.toContain('Headless');
});
`,
}, { workers: 1, headed: true });
expect(result.exitCode).toBe(0);
expect(result.passed).toBe(1);
});
test('should not override use:browserName without projects', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `