-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[scout] use project deps as global hooks for parallel tests #211409
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
Changes from 9 commits
c94ec44
877dd6f
fea8235
bea8083
e515789
635d3ec
a587e61
00a4836
ec41d69
c3067e6
78750fc
2784c92
dd209a8
2666497
c44c2ec
f9b78bd
40aec68
b94cecc
bdc3907
f4e15e0
44393bf
9fc55bd
bf1af52
dd37a3b
5dea2ff
20cf7a7
089e756
108554c
c1ade3a
c8ec61a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,9 +27,31 @@ export function createPlaywrightConfig(options: ScoutPlaywrightOptions): Playwri | |
| process.env.TEST_RUN_ID = runId; | ||
| } | ||
|
|
||
| const scoutProjects: PlaywrightTestConfig<ScoutTestOptions>['projects'] = [ | ||
| { | ||
| name: 'local', | ||
| use: { ...devices['Desktop Chrome'], configName: 'local' }, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. each project will override default |
||
| }, | ||
| ]; | ||
|
|
||
| /** | ||
| * For parallel tests, we need to add a setup project that runs before the tests project. | ||
| */ | ||
| if (options.workers && options.workers > 1) { | ||
| scoutProjects.unshift({ | ||
| name: 'setup', | ||
| testMatch: /global.setup\.ts/, | ||
| }); | ||
|
|
||
| scoutProjects.forEach((project) => { | ||
| if (project.name !== 'setup') { | ||
| project.dependencies = ['setup']; | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| return defineConfig<ScoutTestOptions>({ | ||
| testDir: options.testDir, | ||
| globalSetup: options.globalSetup, | ||
| /* Run tests in files in parallel */ | ||
| fullyParallel: false, | ||
| /* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
|
|
@@ -49,6 +71,7 @@ export function createPlaywrightConfig(options: ScoutPlaywrightOptions): Playwri | |
| use: { | ||
| testIdAttribute: 'data-test-subj', | ||
| serversConfigDir: SCOUT_SERVERS_ROOT, | ||
| configName: 'local', | ||
| [VALID_CONFIG_MARKER]: true, | ||
| /* Base URL to use in actions like `await page.goto('/')`. */ | ||
| // baseURL: 'http://127.0.0.1:3000', | ||
|
|
@@ -70,24 +93,6 @@ export function createPlaywrightConfig(options: ScoutPlaywrightOptions): Playwri | |
|
|
||
| outputDir: './output/test-artifacts', // For other test artifacts (screenshots, videos, traces) | ||
|
|
||
| /* Configure projects for major browsers */ | ||
| projects: [ | ||
| { | ||
| name: 'chromium', | ||
| use: { ...devices['Desktop Chrome'] }, | ||
| }, | ||
|
|
||
| // { | ||
| // name: 'firefox', | ||
| // use: { ...devices['Desktop Firefox'] }, | ||
| // }, | ||
| ], | ||
|
|
||
| /* Run your local dev server before starting the tests */ | ||
| // webServer: { | ||
| // command: 'npm run start', | ||
| // url: 'http://127.0.0.1:3000', | ||
| // reuseExistingServer: !process.env.CI, | ||
| // }, | ||
| projects: scoutProjects, | ||
| }); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,10 +64,14 @@ export const coreWorkerFixtures = base.extend< | |
| */ | ||
| config: [ | ||
| ({ log }, use, testInfo) => { | ||
| const configName = 'local'; | ||
| const projectUse = testInfo.project.use as ScoutTestOptions; | ||
| if (!projectUse.configName) { | ||
| throw new Error( | ||
| 'Invalid Playwright project configuration. Make sure to set "configName" property' | ||
|
csr marked this conversation as resolved.
Outdated
|
||
| ); | ||
| } | ||
| const serversConfigDir = projectUse.serversConfigDir; | ||
| const configInstance = createScoutConfig(serversConfigDir, configName, log); | ||
| const configInstance = createScoutConfig(serversConfigDir, projectUse.configName, log); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| use(configInstance); | ||
| }, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.