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

[Feature] Adding webServer settings for multiple projects #28054

Closed
alSergey opened this issue Nov 9, 2023 · 2 comments
Closed

[Feature] Adding webServer settings for multiple projects #28054

alSergey opened this issue Nov 9, 2023 · 2 comments
Labels
feature-test-runner Playwright test specific issues

Comments

@alSergey
Copy link

alSergey commented Nov 9, 2023

I have 4 projects. For 2 of them I need the webServer setting, but for the other 2 I don't need it. I would like to be able to add a setting only for specific projects, and not for all at once.

How it works now

const isDevmode = (): boolean => process.env.TEST_TYPE.startsWith('devmode') || false

const config: PlaywrightTestConfig = {
	use: {
		baseURL: 'https://example.ru',
	},
	webServer: isDevmode() ? {
		command: 'npm run start',
		url: 'http://localhost:3000',
		stdout: 'pipe',
		stderr: 'pipe',
	} : undefined,
	projects: [
		{
			name: 'def',
			testMatch: [/** **/],
		},
		{
			name: 'devmode-def',
			testMatch: [/** **/],
			use: {
				baseURL: 'http://localhost:3000',
			},
		},
		{
			name: 'def-n3',
			testMatch: [/** **/],
		},
		{
			name: 'devmode-def-n3',
			testMatch: [/** **/],
			use: {
				baseURL: 'http://localhost:3000',
			},
		},
	],
}

How I wish it worked

const config: PlaywrightTestConfig = {
	use: {
		baseURL: 'https://example.ru',
	},
	projects: [
		{
			name: 'def',
			testMatch: [/** **/],
		},
		{
			name: 'devmode-def',
			testMatch: [/** **/],
			use: {
				baseURL: 'http://localhost:3000',
			},
			webServer: {
				command: 'npm run start',
				url: 'http://localhost:3000',
				stdout: 'pipe',
				stderr: 'pipe',
			},
		},
		{
			name: 'def-n3',
			testMatch: [/** **/],
		},
		{
			name: 'devmode-def-n3',
			testMatch: [/** **/],
			use: {
				baseURL: 'http://localhost:3000',
			},
			webServer: {
				command: 'npm run start',
				url: 'http://localhost:3000',
				stdout: 'pipe',
				stderr: 'pipe',
			},
		},
	],
}
@dgozman dgozman added the feature-test-runner Playwright test specific issues label Nov 9, 2023
@slutske22
Copy link

Need this!

@mxschmitt
Copy link
Member

Folding into #22496

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-test-runner Playwright test specific issues
Projects
None yet
Development

No branches or pull requests

4 participants