Skip to content

Commit

Permalink
Only apply Firefox workarounds in GitHub Actions (#481)
Browse files Browse the repository at this point in the history
* Only apply Firefox workarounds in GitHub Actions

* Fix test

* Add override console logging
  • Loading branch information
tunetheweb authored May 14, 2024
1 parent 9d1d10a commit 27f5d87
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/e2e/onFCP-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {stubVisibilityChange} from '../utils/stubVisibilityChange.js';
const originalStrictEqual = assert.strictEqual;
assert.strictEqual = function (actual, expected, message) {
if (
process.env.GITHUB_ACTIONS &&
browser.capabilities.browserName === 'firefox' &&
(expected === 'good' || expected === 'needs-improvement') &&
actual !== expected
Expand Down
11 changes: 10 additions & 1 deletion test/e2e/onLCP-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {stubVisibilityChange} from '../utils/stubVisibilityChange.js';
const originalStrictEqual = assert.strictEqual;
assert.strictEqual = function (actual, expected, message) {
if (
process.env.GITHUB_ACTIONS &&
browser.capabilities.browserName === 'firefox' &&
(expected === 'good' || expected === 'needs-improvement') &&
actual !== expected
Expand Down Expand Up @@ -717,7 +718,15 @@ const assertFullReportsAreCorrect = (beacons) => {

// Temp fix to address Firefox flakiness.
// See https://github.com/GoogleChrome/web-vitals/issues/472
if (browser.capabilities.browserName !== 'firefox') {
if (
process.env.GITHUB_ACTIONS &&
browser.capabilities.browserName === 'firefox' &&
lcp1.value >= 500
) {
console.log(
`Override assert for Firefox (actual: ${lcp1.value}, expected: < 500)`,
);
} else {
assert(lcp1.value < 500); // Less than the image load delay.
}
assert(lcp1.id.match(/^v4-\d+-\d+$/));
Expand Down

0 comments on commit 27f5d87

Please sign in to comment.