-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add visual tests support #5456
Add visual tests support #5456
Conversation
@geriux Seems we'd need to tweak the CI job configuration to address the following error in
|
Wanna run full suite of Android and iOS UI tests? Click here and 'Approve' CI job! |
2de83f7
to
a2ab57c
Compare
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 looks great!
86a2046
to
1ed2a0f
Compare
Hey there 👋 I've just updated this PR as there were some conflicts. I think I've addressed all comments but please let me know if there are any other questions, thank you! |
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.
Looking forward to merging this. I left one question related to test clean up.
Additionally, what is the command used to run these tests locally?
|
||
// Visual test check | ||
const screenshot = await takeScreenshot(); | ||
expect( screenshot ).toMatchImageSnapshot(); |
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 the previous test has what appears to be clean up code removing the block. Should all tests including this one have that as well? This question applies to __device-tests__/gutenberg-editor-group-visual.test.js
as well.
expect( screenshot ).toMatchImageSnapshot(); | |
expect( screenshot ).toMatchImageSnapshot(); | |
await editorPage.removeBlockAtPosition( blockNames.gallery ); |
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 will depend on the test, for this case, to start with a "blank" canvas in the second test you need to remove the blocks you created before, as the other tests in the file will run in the same session.
Never mind. I was running the correct command locally: The errors I encountered locally related to the e2e tests' requirement of Xcode 13. I only had Xcode 14 installed. Installing Xcode 13 and |
Glad you got it running! Yeah until we upgrade to Appium 2, we are stuck with the Xcode 13 issue, becuase SauceLabs currently doesn't support Appium 2 for simulators on Android. |
Related PRs:
Description
This PR adds the setup to be able to have visual tests, the idea is to start migrating the manual test we currently do each release and to also start expanding our test suites, like testing themes and important components like
RichText
.We will be using two new libraries, jest-image-snapshot which enables us to compare two images using Jest. It compares the baseline image against the new one generated on CI, if the difference is over the threshold it will mark the test as failed and it will return the difference output as base64 in the console, this will be handy to check quickly what's breaking.
The other library is jimp which will be used to edit the screenshots taken using Appium, mostly to remove the status bar, resize and reduce quality.
As you'll see in the files changed and in the new tests, we just need to write them as we were doing for the other E2E tests, to match a visual change we'll just need to do:
To test CI checks should pass.
PR submission checklist: