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

Make console logs more accessible during Playwright e2e test runs #3066

Merged
merged 2 commits into from
May 3, 2024

Conversation

philrz
Copy link
Contributor

@philrz philrz commented May 3, 2024

While starting to debug #3063, I tried adding some console.log() debug statements to packages/zed-node/src/lake.ts, but the messages weren't visible in the shell window from which I ran yarn e2e nor in the packages/zui-player/run/playwright-itest/Pool Loads (succeeses)/1/logs/main.log. @jameskerr hacked at this with me a bit over Zoom and came up with these two improvements that make the messages show up in both locations. I'll put comments inline that explain which does what.

Comment on lines +15 to +17
// Ensure all console logs go through electron-log
console.log = log.log

Copy link
Contributor Author

@philrz philrz May 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change caused the console.log() messages I'd added in packages/zed-node/src/lake.ts to show up in the packages/zui-player/run/playwright-itest/Pool Loads (succeeses)/1/logs/main.log.

Comment on lines +48 to +52
// Pipe the stdout from the electron process into the test runner process
if (process.env['VERBOSE']) {
this.zui.process().stdout.pipe(process.stdout);
}

Copy link
Contributor Author

@philrz philrz May 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I run my tests via VERBOSE=1 yarn e2e, this change caused the console.log() messages I'd added in packages/zed-node/src/lake.ts to also show up in the shell window from which I ran yarn e2e.

@philrz philrz requested a review from jameskerr May 3, 2024 01:08
@philrz philrz merged commit 730a6a9 into main May 3, 2024
3 checks passed
@philrz philrz deleted the playwright-console-logs branch May 3, 2024 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants