-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(visual): Fix e2e tests in new headless mode
- Don't use intersection observer in the test code, instead just poll. - Patch visual-regression to focus tab before taking a screenshot.
- Loading branch information
Showing
2 changed files
with
30 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/node_modules/@web/test-runner-visual-regression/dist/visualRegressionPlugin.js b/node_modules/@web/test-runner-visual-regression/dist/visualRegressionPlugin.js | ||
index bd4e733..416bd33 100644 | ||
--- a/node_modules/@web/test-runner-visual-regression/dist/visualRegressionPlugin.js | ||
+++ b/node_modules/@web/test-runner-visual-regression/dist/visualRegressionPlugin.js | ||
@@ -42,6 +42,8 @@ function visualRegressionPlugin(options = {}) { | ||
if (!element) { | ||
throw new VisualRegressionError_1.VisualRegressionError('Something went wrong diffing element, the browser could not find it.'); | ||
} | ||
+ // Screenshots must be done in the foreground. | ||
+ page.bringToFront(); | ||
const screenshot = (await element.screenshot({ encoding: 'binary' })); | ||
return (0, visualDiffCommand_1.visualDiffCommand)(mergedOptions, screenshot, payload.name, context); | ||
} |