-
Notifications
You must be signed in to change notification settings - Fork 687
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
Cypress visual testing integration #3136
Conversation
|
@@ -0,0 +1,13 @@ | |||
/// <reference types="cypress" /> |
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.
Is this needed?
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 am not totally sure, Dev left it in the file. But good question, Ill read up on it.
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.
Yeah, it is needed for IntelliSense to suggest cypress auto completions.
it('should render page builder content correctly', () => { | ||
cy.visit('/'); | ||
|
||
cy.wait(3000); |
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 feel like this is too short. A no-cache, hard refresh page load on https://develop.pwa-venia.com/ took 6000ms for me.
Maybe 10000 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.
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.
Yeah, you guys are right, but in the scope of this PR, I was working on introducing the plugin and integrating it not dint quite get into the test itself. In the following tickets, we can delegate this to the developer working on the ticket about what they think is the right choice of wait or use a helper as Dave suggested.
The test in this PR is a dummy one, just there to prove that this plugin works after the integration.
I got a couple errors while validating:
The file is definitely there and doesn't contain a syntax error. I'm not sure why / how it would throw an error when required. I also got an "update" message immediately from Cypress saying |
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.
Verification errors
I have upgraded Cypress in this PR. Can you try This was done on purpose because this package is just like docs, has nothing to do with pwa-studio from the outside world's perspective. |
@revanth0212 It still fails when screen shot captured window size differs current running window size. |
const fs = require('fs'); | ||
const { matchImageSnapshotPlugin } = require('cypress-image-snapshot/plugin'); | ||
|
||
const resizeSnapshot = imageConfig => { |
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.
Is this the function that resolves differences in terms of resolution and pixel density?
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's the one.
delete global.Cypress; | ||
}); | ||
|
||
test('sup', () => { |
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 this test be skipped?
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.
Oops, done 👍
Tests pass. QA approved. Back @revanth0212 to confirm if there will be additional commits |
QA Approved. Current UI tests are just demo ones and will be replaced soon. |
Description
Added Cypress Visual Testing plugin. With this, we can write tests that can capture snapshots of the page visually while testing.
Related Issue
Closes PWA-1661
Verification Stakeholders
@dpatil-magento
Verification Steps
yarn install
yarn test
to start the cypress UI.Screenshots / Screen Captures (if appropriate)
Checklist