Skip to content

Commit

Permalink
e2e-test: better env var for browser trace (#6093)
Browse files Browse the repository at this point in the history
### Summary
I noticed that traces weren’t attaching for browser failures/retries in
CI only since my change yesterday. After some investigation, I realized
the issue was caused by an environment variable not containing the value
I expected. To resolve this, I selected a more reliable environment
variable that’s compatible with CI runs, ensuring it correctly
determines whether the tests are being run via the CLI.

### QA Notes
* [Triggered a browser/web
failure](https://d38p2avprg8il3.cloudfront.net/playwright-report-12930854312-27797/index.html#?testId=d3c3813350b4cc7e69da-d3305c7a59dec61b969f)
and confirmed trace is now attached.
  • Loading branch information
midleman authored Jan 23, 2025
1 parent 0140de6 commit f771d2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/e2e/tests/_test.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ export const test = base.extend<TestFixtures, WorkerFixtures>({
}, { auto: true }],

tracing: [async ({ app }, use, testInfo) => {
// Determine environment and mode
const isCommandLineRun = process.env.TERM_PROGRAM === 'vscode' && !(process.env.PW_UI_MODE === 'true');
// Determine execution mode
const isCommandLineRun = process.env.npm_execpath && !(process.env.PW_UI_MODE === 'true');

// Use default built-in tracing for e2e-browser except when running via CLI
if (testInfo.project.name === 'e2e-browser' && !isCommandLineRun) {
Expand Down

0 comments on commit f771d2c

Please sign in to comment.