Skip to content

Commit 8856210

Browse files
Marien Scottbrandonroberts
authored andcommitted
feat(example-app): add visual testing with Applitools (#1605)
1 parent dac04bd commit 8856210

File tree

6 files changed

+282
-212
lines changed

6 files changed

+282
-212
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
"@angular/platform-browser-dynamic": "^7.0.1",
9292
"@angular/platform-server": "^7.0.1",
9393
"@angular/router": "^7.0.1",
94+
"@applitools/eyes-cypress": "^3.4.12",
9495
"@ngrx/db": "^2.2.0-beta.0",
9596
"core-js": "^2.5.4",
9697
"hammerjs": "^2.0.8",
@@ -121,7 +122,7 @@
121122
"conventional-changelog-cli": "^1.3.21",
122123
"coveralls": "^2.13.0",
123124
"cpy-cli": "^1.0.1",
124-
"cypress": "^3.1.2",
125+
"cypress": "^3.1.5",
125126
"deep-freeze": "^0.0.1",
126127
"deep-freeze-strict": "^1.1.1",
127128
"express": "^4.16.4",

projects/example-app-cypress/cypress.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"supportFile": "support/index.js",
77
"screenshotsFolder": "screenshots",
88
"videosFolder": "videos",
9-
"video": false
9+
"video": false,
10+
"projectId": "w65h7e"
1011
}

projects/example-app-cypress/integration/round-trip.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
context('Full round trip', () => {
22
before(() => {
3+
(cy as any).eyesOpen({
4+
appName: 'books_app',
5+
testName: 'round-trip',
6+
browser: { width: 800, height: 600 },
7+
});
38
window.indexedDB.deleteDatabase('books_app');
49
cy.visit('/');
510
});
611

12+
after(() => {
13+
(cy as any).eyesClose();
14+
});
15+
716
it('shows a message when the credentials are wrong', () => {
817
cy.get('[placeholder=Username]').type('wronguser');
918
cy.get('[placeholder=Password]').type('supersafepassword');
1019
cy.get('[type="submit"]').click();
1120

21+
(cy as any).eyesCheckWindow(
22+
'shows a message when the credentials are wrong'
23+
);
1224
cy.contains('Invalid username or password').should('be.visible');
1325
});
1426

@@ -24,6 +36,7 @@ context('Full round trip', () => {
2436
cy.contains('menu').click();
2537
cy.contains('Browse Books').click();
2638

39+
(cy as any).eyesCheckWindow('is possible to search for books');
2740
cy.get('[placeholder="Search for a book"]').type('The Alchemist');
2841
cy.get('bc-book-preview')
2942
.its('length')
@@ -36,6 +49,7 @@ context('Full round trip', () => {
3649
.click();
3750

3851
cy.contains('Add Book to Collection').click();
52+
(cy as any).eyesCheckWindow('is possible to add books');
3953
cy.contains('Add Book to Collection').should('not.exist');
4054
});
4155

@@ -48,13 +62,16 @@ context('Full round trip', () => {
4862

4963
cy.contains('Add Book to Collection').click();
5064
cy.contains('Remove Book from Collection').click();
65+
66+
(cy as any).eyesCheckWindow('is possible to remove books');
5167
cy.contains('Remove Book from Collection').should('not.exist');
5268
});
5369

5470
it('is possible to show the collection', () => {
5571
cy.contains('menu').click();
5672
cy.contains('My Collection').click();
5773

74+
(cy as any).eyesCheckWindow('is possible to show the collection');
5875
cy.get('bc-book-preview')
5976
.its('length')
6077
.should('be', 1);
@@ -65,6 +82,7 @@ context('Full round trip', () => {
6582
cy.contains('Sign Out').click();
6683
cy.contains('OK').click();
6784

85+
(cy as any).eyesCheckWindow('is possible to sign out');
6886
cy.get('[placeholder=Username]').should('exist');
6987
cy.get('[placeholder=Password]').should('exist');
7088
});
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const cypressTypeScriptPreprocessor = require('./cy-ts-preprocessor');
22

3-
module.exports = on => {
3+
module.exports = on =>
44
on('file:preprocessor', cypressTypeScriptPreprocessor);
5-
};
5+
6+
require('@applitools/eyes-cypress')(module);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import'@applitools/eyes-cypress/commands';
2+
3+

0 commit comments

Comments
 (0)