Skip to content

Commit 7f78b10

Browse files
Merge pull request #2 from uktrade/feature/add-unit-tests
Introducing unit and e2e test set up to package
2 parents e5ee1d7 + c83d668 commit 7f78b10

File tree

12 files changed

+739
-967
lines changed

12 files changed

+739
-967
lines changed

.gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
node_modules
2-
dist
2+
dist
3+
4+
# test
5+
cypress-visual-screenshots/comparison
6+
cypress-visual-screenshots/diff
7+
cypress/videos
8+
cypress/fixtures
268 Bytes
Loading
Loading

cypress.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"integrationFolder": "cypress/specs",
3+
"pluginsFile": "cypress/plugins/index.js",
4+
"supportFile": "cypress/support/index.js",
5+
"defaultCommandTimeout": 20000,
6+
"requestTimeout": 20000
7+
}

cypress/plugins/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/* eslint-disable */
2+
module.exports = (on, config) => {
3+
const getCompareSnapshotsPlugin = require('../../dist/plugin')
4+
getCompareSnapshotsPlugin(on, config)
5+
}

cypress/specs/image-diff-spec.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
it('should compare screenshot of the entire page', () => {
2+
cy.visit('../../report-example.html')
3+
cy.compareSnapshot('wholePage')
4+
})
5+
6+
it('should compare screenshot from a given element', () => {
7+
cy.visit('../../report-example.html')
8+
cy.get('#report-header').compareSnapshot('element')
9+
})

cypress/support/commands.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const compareSnapshotCommand = require('../../dist/command')
2+
3+
compareSnapshotCommand()

cypress/support/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('./commands')

0 commit comments

Comments
 (0)