-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tests): Track visual regressions (#413)
Refs: - "applitools eyes" is visual snapshot service for Cypress - I picked it from https://docs.cypress.io/plugins/#visual-testing because it was verified by Cypress and they provide a free plan for open source projects - install steps: https://applitools.com/tutorials/cypress.html --> https://eyes.applitools.com/app
- Loading branch information
1 parent
ea10937
commit 7c48ba0
Showing
8 changed files
with
912 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// This suite intends to navigate through all pages, to detect visual regressions. | ||
|
||
context('Visual Snapshots', () => { | ||
before(() => { | ||
cy.eyesOpen({ | ||
appName: 'Openwhyd', | ||
testName: 'Visual Snapshots', | ||
browser: { width: 1000, height: 660 }, // cf https://docs.cypress.io/api/commands/viewport.html#Defaults | ||
}); | ||
// TODO: insert a few tracks, to also check regressions on the rendering of those tracks | ||
}); | ||
|
||
after(() => { | ||
cy.eyesClose(); | ||
}); | ||
|
||
it('visitor', () => { | ||
cy.visit('/'); // Home page (full stream) | ||
cy.eyesCheckWindow('visitor on /'); | ||
|
||
cy.contains('Got it!').click(); // Remove cookie banner | ||
cy.eyesCheckWindow('visitor on / (discarded cookie banner)'); | ||
|
||
cy.contains('Hot Tracks').click(); | ||
// cy.get('#pageLoader').should('have.css', { opacity: 0.5 }); | ||
cy.location('pathname').should('equal', '/hot'); | ||
// cy.get('#pageLoader').should('have.css', { opacity: 0 }); | ||
cy.contains('/ All'); // in the header of the list of tracks | ||
cy.eyesCheckWindow('visitor on /hot'); | ||
|
||
cy.contains('Sign up').click(); | ||
cy.contains('Create an account').should('be.visible'); // title of the modal dialog | ||
cy.eyesCheckWindow('visitor on /#signup'); | ||
cy.get('body').type('{esc}'); // press "escape", to close the modal | ||
|
||
cy.contains('Login').click(); | ||
cy.location('pathname').should('equal', '/login'); | ||
cy.contains('No account yet?'); // below the sign in form | ||
cy.eyesCheckWindow('visitor on /login'); | ||
|
||
// TODO: open a profile page (currently broken) | ||
|
||
// TODO: open the /button page (currently broken) | ||
|
||
// TODO: make the following test work: navigate back to home page, from the login page | ||
// cy.go('back'); // does not work, for some reason... | ||
// cy.window().then((window) => window.history.back()); // does not work either... | ||
// cy.get('#logo').click(); // even worse: this displays a "Whoops, there is no test to run" error page from Cypress! | ||
// TODO: try cy.window().invoke("history").invoke("back") | ||
// cy.location('pathname').should('equal', '/'); | ||
// cy.contains('Recent tracks from all users'); // in the header of the list of tracks | ||
// cy.eyesCheckWindow('visitor on / (back navigation)'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '@applitools/eyes-cypress'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.