-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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() When a test fails in node, dump the result in cli_output #8206
Conversation
test/lib/visualTestLoop.js
Outdated
const fileName = localPath('../../cli_output', `${testName.replaceAll(' ', '_')}.png`); | ||
fs.writeFileSync(fileName.replace('file://', ''), dataUrl, { encoding: 'base64' }); | ||
} | ||
// else if (original) { |
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.
leave this please
I use it, git shows a very convenient diff.
And this way I can commit the change to the repo if I need to in a click
I have disabled golden debugging/recreation from node because I understood that it is not accurate enough because of node-canvas
fabric.js/test/node_test_setup.js
Line 14 in 5ead2d6
// QUnit.debugVisual = Number(process.env.QUNIT_DEBUG_VISUAL_TESTS); |
Don't you enjoy using it this way?
It is easy to add an option from the cli to dump the diff to cli_output
instead of updating the ref.
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.
that is not the one you use. That is a copy that i commented because i didn't write for browser
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.
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 link points me to a strange place. Add a comment in the code so I can see
that is not the one you use. That is a copy that i commented because i didn't write for browser
I wrote that in #8138
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 have disabled golden debugging/recreation from node because I understood that it is not accurate enough because of node-canvas
Yes node-canvas is not accurate enough, but i generate the golden from node anyway because they help finding out issues earlier. When a test is too much different in node, we disable the test for node ( we need to do that anyway or it will fail ).
Don't you enjoy using it this way?
I think the old was the best, i deleted a golden and i would get it back just running the tests, no flags.
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 old was the best, i deleted a golden and i would get it back just running the tests, no flags.
It still works like that.
The -d
flag will recreate the golden ONLY if the test failed
The -r
flag will recreate the golden regardless
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 don't mind switching the -d
flag on as default
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.
For me it is annoying running a test, seeing it fails, navigating to the file, deleting it and all over again each time I change something in the code and want to test the diff
I flag -d
and it happens.
Then I can discard changes in github desktop.
No hassle.
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.
Perhaps I didn't explain how to use it properly until now.
It should make your life much easier.
test/lib/visualTestLoop.js
Outdated
// var stringa = imageDataToChalk(output); | ||
// console.log(stringa); | ||
try { | ||
dumpFailedTest(testName, renderedCanvas, canvas, output); |
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.
you can move this into the if block below so it happens only when -d
or -r
flag are set
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 prefer it to happen every run, in case i can link the results out in PRs
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 looked into that as well
But you said that node visual test results are not accurate.
That is why I disabled the option the debug visuals in node tests to begin with and moved to browser outputs.
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 can be done if we post the results somewhere.
Github doesn't allow creating a comment with images using actions/bots but we can easily add links to posted images.
Maybe we create a test dumps repo under fabricjs
org and commit to there
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.
we create a branch, push images and remove the branch once the pr is closed
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.
How about the following:
CI runs visual tests with -d
flag, meaning that failing tests update golden refs.
Then it creates a branch with these changes and posts a comment with the diff between the branches.
It can prefix the branch name with something and delete it once the pr is closed.
Thoughts?
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.
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 didn't add a generate golden method, the method is differnet and produces a collage of the 3 images.
This method replaced the imageDataToChalk function that was not really usefull.
I want to take care of this, i felt the need for it, i started it, i can finish it. Then if is really ugly we can improve it.
we create a branch, push images and remove the branch once the pr is closed
This seems an overkill of resourcers.
There are actions that archive artifacts of pr runs, and keep them somewhere in github.
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 looked at artifacts...
Am not sure how to display the results though
This on the other hand is simple: ci-visual-test-action...ci-pr#8210-visuals-firefox
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.
Maybe is an overkill, but it is on github actions...
This is the result:
#8210 (comment)
uses: actions/upload-artifact@v3 | ||
with: | ||
name: chrome-failing-visual-tests | ||
path: cli_output/failed_visual_tests/chrome/* |
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 doesn't work yet
uses: actions/upload-artifact@v3 | ||
with: | ||
name: firefox-failing-visual-tests | ||
path: cli_output/failed_visual_tests/firefox/* |
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 doesn't work yet
I suggest you merge #8227 first. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I am closing in favor of #8402 If you disagree reopen |
No description provided.