mirror of
				https://github.com/microsoft/playwright.git
				synced 2025-06-26 21:40:17 +00:00 
			
		
		
		
	fix(test runner): restore --headed flag (#13872)
				
					
				
			This commit is contained in:
		
							parent
							
								
									2dafbfc2dc
								
							
						
					
					
						commit
						d87de8c52c
					
				| @ -251,6 +251,7 @@ export class Loader { | |||||||
|     projectConfig.repeatEach = takeFirst(this._configCLIOverrides.repeatEach, projectConfig.repeatEach); |     projectConfig.repeatEach = takeFirst(this._configCLIOverrides.repeatEach, projectConfig.repeatEach); | ||||||
|     projectConfig.retries = takeFirst(this._configCLIOverrides.retries, projectConfig.retries); |     projectConfig.retries = takeFirst(this._configCLIOverrides.retries, projectConfig.retries); | ||||||
|     projectConfig.timeout = takeFirst(this._configCLIOverrides.timeout, projectConfig.timeout); |     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 { |   private _resolveProject(config: Config, projectConfig: Project, throwawayArtifactsPath: string): FullProjectInternal { | ||||||
|  | |||||||
| @ -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'); |   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 }) => { | test('should not override use:browserName without projects', async ({ runInlineTest }) => { | ||||||
|   const result = await runInlineTest({ |   const result = await runInlineTest({ | ||||||
|     'playwright.config.ts': ` |     'playwright.config.ts': ` | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Dmitry Gozman
						Dmitry Gozman