-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
test(e2e): improve puppeteer argument flags #2127
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
test(e2e): improve puppeteer argument flags #2127
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2127 +/- ##
==========================================
- Coverage 92.67% 92.53% -0.14%
==========================================
Files 32 32
Lines 1256 1260 +4
Branches 360 360
==========================================
+ Hits 1164 1166 +2
- Misses 85 87 +2
Partials 7 7
Continue to review full report at Codecov.
|
fmm.. CI fails. 😞 sometimes CI is stopped by Azure because of timeout. |
@Loonride maybe we can add timeout for puppeteer to avoid 60 minutes |
/cc @evilebottnawi @hiroppy Got it working! Turns out it was some timing issues. |
👍 This test seems to be a flaky test.
|
/cc @evilebottnawi @hiroppy Still possibly not perfect, but appears more reliable. Here are my changes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job, some notes
// prevent cases where the server is trying to send data while connection is closing | ||
if (connection.readyState === 1) { | ||
connection.write(message); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, let's rewrite
if (connection.readyState !== 1) {
return;
}
connection.write(message);
Hope it is not break code 😄
// prevent cases where the server is trying to send data while connection is closing | ||
if (connection.readyState === 1) { | ||
connection.send(message); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look above
test/e2e/ClientMode.test.js
Outdated
@@ -54,17 +54,29 @@ describe('clientMode', () => { | |||
res.push(_text); | |||
}); | |||
|
|||
setTimeout(() => { | |||
page.waitFor(3000).then(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic number, let's create file test/server/helpers/server-constans.js
and move this values in variable with name
@@ -31,5 +31,6 @@ Array [ | |||
exports[`Client console.log liveReload enabled 1`] = ` | |||
Array [ | |||
"Hey.", | |||
"[WDS] Live Reloading enabled.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why it is appears here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@evilebottnawi Previously, inline
was disabled for this test, so the live reload message was not printed. Look at the change in test-server.js
. I made it so that options.inline
is not set automatically to false
when options.liveReload
exists. This test makes more sense if inline
is enabled.
test/helpers/run-browser.js
Outdated
'--prerender-from-omnibox=disabled', | ||
'--use-gl=swiftshader', | ||
'--use-mock-keychain', | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this in variable and put above in file or maybe in other file
} | ||
} | ||
|
||
module.exports = CustomSequencer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add docs in above function and describe what it is do and why we need this, it can be misleading for other developers without description
@evilebottnawi Should I add a test for the |
test/helpers/server-constants.js
Outdated
@@ -0,0 +1,52 @@ | |||
'use strict'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's name file puppeteer-constaints.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One note, good work!
Oddly on the Windows node-8 test failure, the tests did not run in the specified order |
@Loonride maybe something wrong with paths? |
It looks like ordering isn't working on Windows CI, probably because of path yes, I will investigate Edit: Yes, Windows test paths using backslash |
For Bugs and Features; did you add new tests?
N/A
Motivation / Use-Case
Use the recommended args for puppeteer from https://github.com/alixaxel/chrome-aws-lambda/blob/master/source/index.js
Hopefully this could make e2e tests more stable.
Breaking Changes
None
Additional Info