-
Notifications
You must be signed in to change notification settings - Fork 609
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
Smoke test that runs in travis #747
base: master
Are you sure you want to change the base?
Conversation
package.json
Outdated
@@ -21,7 +21,7 @@ | |||
"build-compare": "webpack --config ./compare/webpack.config.js", | |||
"dev-compare": "webpack-dev-server --content-base ./compare/output --config ./compare/webpack.config.js", | |||
"integration-test": "rm -rf newdir && mkdir newdir && cd newdir && node ../cli/index.js genConfig && node ../cli/index.js reference && node ../cli/index.js test && node -e \"require('../')('test')\"", | |||
"smoke-test": "cd test/configs/; node ../../cli/index.js test --config=backstop_features", | |||
"smoke-test": "node test/smoke/smoke_test.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.
Very nice harness you built there!
A suggestion: would you consider leaving the smoke-test
command the same (so it executes the backstop_features test like before) -- and add a new command for your new harness. Maybe call it like, travis-test
or git-commit-test
or deploy-test
?
I am totally open to suggestions -- my instinct is to keep it convenient for devs to still be able to run the raw smoke-test and see results (passing or non-passing).
Does this make sense?
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.
I think the harness works well for devs too because it tells them if it succeeds at the end. Right now it's hard to notice if something breaks (e.g., incorrect # of comparison failures or that a timeout). There are some scary looking messages in the output that I don't know if they mean somethings wrong or not (selector not found, etc).
The only difference is that the CI test doesn't pop up the browser report at the end.
But I will add an argument so if you do
npm run smoke-test
It will behave just like today with additional niceness and popup the browser, and
npm run smoke-test -- ci
Will do it without the browser report.
Question for you: Will this have to run in Docker? It seems like launching in travis doesn't really work. If so I can't currently see the docker cloud config - maybe you can share it with me?
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.
Sounds good!
I honestly am not an expert in docker -- I just know enough to get me into trouble. I am happy to share the configs with you -- they should all be in the /docker
directory.
Also -- just so I am understanding correctly -- when you say...
It seems like launching in travis doesn't really work
...are you saying you cant run backstop tests in travis?
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.
It seems like launching in travis doesn't really work
Well that's the way it is now - you can click below and see the error. I wasn't sure if you already knew this. If not - no worries I think I can fix this problem. So expect an updated PR shortly.
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.
Thank you for working on all of this! I am really really under the gun at work — it could take a little bit for me to test/merge this. It will happen ASAP! Thanks for your patience. Cheers.
Don't merge yet! I'm still working on it - unfortunately chrome in Linux produces image mismatch with chrome on the mac, so likely the mac version will have to use a docker container to generate the reference bitmaps. I will let you know when it's ready, and no worries about work - I know how it is. |
😄 ok thank you. BTW: if you are running into rendering differences you could try adding this to the settings...
In particular, —disable-gpu when used on Mac and Linux may fix the font rendering issues. It does seem to work across macOS boxes and may work across Linux and Mac. It would be good to know if this in fact can solve the issue. I am happy to rerender the images using that setting if you don’t have a Mac handy. And again, thanks so much for your effort 😊. |
@@ -43,7 +43,6 @@ a:hover { | |||
transform: translateZ(200px); | |||
} | |||
.lemurInYourFace { | |||
transition: transform 750ms ease, opacity 750ms ease, visibility 800ms ease; |
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.
This line was cuasing intermittent failures in the backstop tests. Since the lemurInYourFace is part of the initial styling with the index.html, the fade-in would happen on page load and therefore you'd occasionally get lemurs partially loaded especially in the noDelay scenario
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.
Of course in real life -- our designer would not let us remove a style because it was inconvenient to test 😄. Can we modify the test if this is causing a failure?
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.
The way to do this is with the transitionend event. This could be a new backstop feature, or one can write custom Javascript to detect the transition and use the readyEvent feature of Backstop. There is already a test of readyEvent - this 'lemurInYourFace' is supposed to be the 'Simple' test case. Demonstrating CSS transition in the "Simple" case seems wrong.
How about we add another issue "demo CSS transition handling" that can be done in a separate PR? I didn't introduce this problem - I'm just cleaning up something that was already flaky.
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.
yes that works. We can just comment the flaky test now and create an issue.
There is actually an article on dwb which discusses exactly your idea — using the transition event. The onReady test script can attach a listener and just emit a console log which triggers the shot.
Ok I'm ready! Here's what I did:
|
Hey - any luck reviewing this? Any concerns? |
Oh crap — sorry man. So busy... 😿 I have a day to work on the library on 5/18 — but hopefully I can this before that. Thanks for your patience! |
No worries, not in any big hurry, I just wanted to make sure it was in the queue. |
@@ -43,7 +43,6 @@ a:hover { | |||
transform: translateZ(200px); | |||
} | |||
.lemurInYourFace { | |||
transition: transform 750ms ease, opacity 750ms ease, visibility 800ms ease; |
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.
Of course in real life -- our designer would not let us remove a style because it was inconvenient to test 😄. Can we modify the test if this is causing a failure?
test/configs/backstop_features.js
Outdated
const ENGINE = 'puppet'; | ||
const SCRIPT_PATH = 'puppet'; | ||
const PLATFORM = process.env.BACKSTOP_SMOKE_PLATFORM || (process.platform === 'darwin' ? 'osx' : 'linux'); | ||
|
||
module.exports = { | ||
id: `${ENGINE}_backstop_features`, |
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.
The ID property is appended to all test images -- so adding your platform parameter there enables backstop to track these resources at file level.
Line 8 can be
id: `${PLATFORM}_${ENGINE}_backstop_features`,
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.
Yes this is much nicer - I changed it to this.
test/configs/backstop_features.js
Outdated
@@ -83,7 +86,7 @@ module.exports = { | |||
}, | |||
{ | |||
label: 'cookies', | |||
cookiePath: 'backstop_data/cookies.json', | |||
cookiePath: `${PLATFORM}/backstop_data/cookies.json`, |
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.
I noticed that you are not using cookies -- so in this case it seems unnecessary to customize the cookie path. And even if we did have cookies -- it's likely these would share the same file so the original (default) value does not need to be changed 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.
Fixed
test/configs/backstop_features.js
Outdated
engine_scripts: 'backstop_data/engine_scripts', | ||
html_report: 'backstop_data/html_report', | ||
ci_report: 'backstop_data/ci_report' | ||
bitmaps_reference: `${PLATFORM}/backstop_data/bitmaps_reference`, |
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.
Reference and test scripts can all remain using their default values.
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.
Done
test/configs/backstop_features.js
Outdated
ci_report: 'backstop_data/ci_report' | ||
bitmaps_reference: `${PLATFORM}/backstop_data/bitmaps_reference`, | ||
bitmaps_test: `${PLATFORM}/backstop_data/bitmaps_test`, | ||
engine_scripts: `engine_scripts`, |
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.
Engine scripts should stay in the backstop_data directory. (keep default value)
test/smoke/docker_smoke.sh
Outdated
@@ -0,0 +1,6 @@ | |||
#!/usr/bin/env bash |
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.
I would love to know what each of these lines did. I find it hard to parse docker configs. Particularly lines 5 & 6. I guess I expect we would cd to a workspace, install backstop locally to that space and use the feature tests runner. I don't understand why /test/configs/linux/node_modules
is called out in there.
test/smoke/smoke_test.js
Outdated
{ cwd: configsDir, env: processEnv } | ||
); | ||
|
||
const requiredStdout = [ |
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.
This sort of thing should be placed at the top of this script with explicit comments around how to use this array to handle different test scenarios.
In this case we should name it something very clear.
test/smoke/smoke_test.js
Outdated
'report | 0 Failed' | ||
]; | ||
|
||
const allowedStdErr = [ |
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.
same comment as above for this array.
test/smoke/smoke_test.js
Outdated
|
||
let missingStdOut = [...requiredStdout]; | ||
|
||
child.stdout.on('data', function (buf) { |
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.
Please use named functions for clarity.
test/smoke/smoke_test.js
Outdated
|
||
const code = await new Promise(resolve => child.on('close', resolve)); | ||
|
||
const problems = []; |
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.
would prefer if these were encapsulated a bit by functions so that the overall flow of this script can be easily grasped in a few lines.
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.
Hi Ken -- thank you very much for all your effort here! This is great work. I do have some comments though. I think this implementation can be significantly tightened up such that it would serve a nice reference implementation for other developers.
I'd like to take a more backstop-centric approach to the layout -- this would improve developer ergonomics and make the system easier to reason about. I called out suggestions which would enable you to allow backstop to manage all resources in it's own scaffolding (as intended by design). Instead of separate directories, images should be tagged 'linux' or 'osx' and managed by backstop in bitmap_reference. Most everything else is platform agnostic so separate platform directories are not necessary.
Let me know what you think.
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.
Thanks for making the changes.
I will pull these changes directly from your branch and test on 6/15.
I’ll put the css line back and also take care of line 131.
Thanks for all your work on this — it’s awesome.
Best
Garris
test/configs/backstop_features.js
Outdated
@@ -125,15 +128,16 @@ module.exports = { | |||
paths: { | |||
bitmaps_reference: 'backstop_data/bitmaps_reference', | |||
bitmaps_test: 'backstop_data/bitmaps_test', | |||
engine_scripts: 'backstop_data/engine_scripts', | |||
engine_scripts: 'engine_scripts', |
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.
Should also be under backstop data.
Is there anything preventing this from being merged, aside from needing a rebase? More tests would give contributors a lot of confidence their changes won't break things. |
We need to address #842 for the smoke tests to pass consistently. Then it needs to rebase. |
Don't merge yet - I intentionally put a console.error statement to see if this fails travis on the PR build.