Skip to content
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

Introducing unit and e2e test set up to package #2

Merged
merged 3 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
node_modules
dist
dist

# test
cypress-visual-screenshots/comparison
cypress-visual-screenshots/diff
cypress/videos
cypress/fixtures
Binary file added cypress-visual-screenshots/baseline/element.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"integrationFolder": "cypress/specs",
"pluginsFile": "cypress/plugins/index.js",
"supportFile": "cypress/support/index.js",
"defaultCommandTimeout": 20000,
"requestTimeout": 20000
}
5 changes: 5 additions & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* eslint-disable */
module.exports = (on, config) => {
const getCompareSnapshotsPlugin = require('../../dist/plugin')
getCompareSnapshotsPlugin(on, config)
}
9 changes: 9 additions & 0 deletions cypress/specs/image-diff-spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
it('should compare screenshot of the entire page', () => {
cy.visit('../../report-example.html')
cy.compareSnapshot('wholePage')
})

it('should compare screenshot from a given element', () => {
cy.visit('../../report-example.html')
cy.get('#report-header').compareSnapshot('element')
})
3 changes: 3 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const compareSnapshotCommand = require('../../dist/command')

compareSnapshotCommand()
1 change: 1 addition & 0 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('./commands')
Loading