Skip to content

Commit

Permalink
fix(e2e): support headless/headful env var toggle (#6558)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoerge authored and ricokahler committed May 14, 2024
1 parent 20b66b1 commit 92260a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {readBoolEnv, readEnv} from './test/e2e/helpers/envVars'
loadEnvFiles()

const CI = readBoolEnv('CI', false)
const HEADLESS = readBoolEnv('HEADLESS', true)

/**
* Excludes the GitHub reporter until https://github.com/microsoft/playwright/issues/19817 is resolved, since it creates a lot of noise in our PRs.
Expand All @@ -22,13 +23,14 @@ function excludeGithub(reporters: PlaywrightTestConfig['reporter']) {
const playwrightConfig = createPlaywrightConfig({
projectId: readEnv('SANITY_E2E_PROJECT_ID'),
token: readEnv('SANITY_E2E_SESSION_TOKEN'),
playwrightOptions(config) {
playwrightOptions(config): PlaywrightTestConfig {
return {
...config,
reporter: excludeGithub(config.reporter),
use: {
...config.use,
baseURL: 'http://localhost:3339',
headless: HEADLESS,
},
webServer: {
...config.webServer,
Expand Down
1 change: 1 addition & 0 deletions test/e2e/helpers/envVars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ type KnownEnvVar =
| 'SANITY_E2E_PROJECT_ID'
| 'SANITY_E2E_DATASET'
| 'CI'
| 'HEADLESS'

/**
* Read an environment variable, parsing the response as a boolean, using loose
Expand Down

0 comments on commit 92260a4

Please sign in to comment.