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

Fixes tests for GitHub actions. #272

Merged
merged 1 commit into from
Mar 6, 2025
Merged

Fixes tests for GitHub actions. #272

merged 1 commit into from
Mar 6, 2025

Conversation

theengineear
Copy link
Collaborator

@theengineear theengineear commented Mar 1, 2025

Previously, the tests weren’t actually being run by GitHub actions for some time now. They would run locally, but the browser would silently fail to launch in GitHub when the action was run.

Additionally, we now “Bail out!” within “test.js” if any exceptions are caught — these are magic words that our TAP parser will recognize and they instruct the parser to immediately consider the test a failure.

@theengineear
Copy link
Collaborator Author

Note that this is now failing — which is what we want! Previously, we were missing some test coverage which should have tanked our tests.

Before

Screenshot 2025-03-01 at 11 14 17 AM

After

Screenshot 2025-03-01 at 11 14 58 AM

@@ -5,14 +5,9 @@ import puppeteer from 'puppeteer';
// Open our browser.
const browser = await puppeteer.launch({
timeout: 10000,
// opt-in to the new Chrome headless implementation
// ref: https://developer.chrome.com/articles/new-headless/
headless: 'new',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this setting is outdated now?

args: [
// Disables interactive prompt: Do you want to the application Chromium.app to accept incoming network connections?
// ref: https://github.com/puppeteer/puppeteer/issues/4752#issuecomment-586599843
'--disable-features=DialMediaRouteProvider',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I checked the linked issue and it seemed like it was closed.

],
// These args fix “Error: Failed to launch the browser process!” when
// run in GitHub. We are only running our own code here, so this is ok.
args: ['--no-sandbox', '--disable-setuid-sandbox'],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Would love a cross-check on this one. I think this is what we need to do now in GitHub based on our settings?

@theengineear theengineear requested a review from klebba March 1, 2025 19:17
@theengineear
Copy link
Collaborator Author

@klebba — Would you mind taking a look at this?

theengineear added a commit that referenced this pull request Mar 1, 2025
See #272 for a discussion on our tests in GH.
theengineear added a commit that referenced this pull request Mar 1, 2025
See #272 for a discussion on our tests in GH.
@theengineear
Copy link
Collaborator Author

Back to passing now that underlying tests are actually fixed (versus just not running at all).

Previously, the tests weren’t actually being run by GitHub actions for
some time now. They would run locally, but the browser would silently
fail to launch in GitHub when the action was run.

Additionally, we now “Bail out!” within “test.js” if any exceptions are
caught — these are magic words that our TAP parser will recognize and
they instruct the parser to immediately consider the test a failure.
@@ -66,6 +61,9 @@ import puppeteer from 'puppeteer';
// Close our browser.
await browser.close();
} catch (err) {
// Ensure that we “Bail out!” (see TAP specification) if script fails. Note
// that the tap stream is being read on stdout.
console.log('Bail out!'); // eslint-disable-line no-console
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

FYI @klebba — we should bake this sort of thing into all our test.js files across projects.

@theengineear
Copy link
Collaborator Author

Note that in addition to fixing this action, we also ensure that it will break in the right way in the future if the browser fails to launch.

Screenshot 2025-03-05 at 7 47 02 PM

Copy link
Collaborator

@klebba klebba left a comment

Choose a reason for hiding this comment

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

LG2M

@theengineear theengineear merged commit 57959e4 into main Mar 6, 2025
1 check passed
@theengineear theengineear deleted the fix-test-action branch March 6, 2025 23:58
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