Skip to content

Commit e1c23d7

Browse files
authored
Simplify (#3)
Revamped Tutorial to match new quickstart: https://applitools.com/tutorials/quickstart/web/cypress/cypress_quickstart
1 parent 3ff7927 commit e1c23d7

File tree

6 files changed

+6384
-8554
lines changed

6 files changed

+6384
-8554
lines changed

applitools.config.js

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,18 @@
1-
// This config file specifies how to run visual tests with Applitools.
2-
// It applies to all tests in this project.
3-
41
module.exports = {
5-
6-
// Concurrency refers to the number of visual checkpoints Applitools will perform in parallel.
2+
// Specify the number of visual checkpoints Applitools will perform in parallel.
73
// Warning: If you have a free account, then concurrency will be limited to 1.
84
testConcurrency: 5,
95

10-
// To connect visual test results to your account,
11-
// you must set the `APPLITOOLS_API_KEY` environment variable to your Applitools API key.
12-
// To find it: https://applitools.com/tutorials/getting-started/setting-up-your-environment.html
13-
// If you don't explicitly set the API key here,
14-
// then the SDK will automatically read the `APPLITOOLS_API_KEY` environment variable to fetch it.
15-
apiKey: 'APPLITOOLS_API_KEY',
16-
17-
// A batch is the collection of visual checkpoints for a test suite.
18-
// Batches are displayed in the Eyes Test Manager, so use meaningful names.
19-
batchName: 'Example: Cypress in JavaScript with the Ultrafast Grid',
6+
// Uncomment the below line and paste in your API key as an alternative to using an environment variable
7+
// apiKey: '',
208

21-
// Applitools can run checkpoints for snapshots against any browser in the Ultrafast Grid.
22-
// This setting defines 5 unique browser configurations to test.
23-
browser: [
9+
batchName: 'Cypress Quickstart',
2410

25-
// Add 3 desktop browsers with different viewports for cross-browser testing in the Ultrafast Grid.
26-
// Other browsers are also available, like Edge and IE.
11+
// Select the browsers and devices to run your tests on via the Ultrafast Grid
12+
browser: [
2713
{width: 800, height: 600, name: 'chrome'},
2814
{width: 1600, height: 1200, name: 'firefox'},
2915
{width: 1024, height: 768, name: 'safari'},
30-
31-
// Add 2 mobile emulation devices with different orientations for cross-browser testing in the Ultrafast Grid.
32-
// Other mobile devices are available, including iOS.
3316
{deviceName: 'Pixel 2', screenOrientation: 'portrait'},
3417
{deviceName: 'Nexus 10', screenOrientation: 'landscape'},
3518
]

cypress/e2e/acme-bank.cy.js

Lines changed: 0 additions & 67 deletions
This file was deleted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
describe('ACME Bank', () => {
2+
beforeEach(() => {
3+
// Start Applitools Visual AI Test
4+
cy.eyesOpen({
5+
appName: 'ACME Bank',
6+
testName: Cypress.currentTest.title,
7+
})
8+
})
9+
it('should log into a bank account', () => {
10+
cy.visit('https://sandbox.applitools.com/bank?layoutAlgo=true');
11+
12+
// Full Page - Visual AI Assertion
13+
cy.eyesCheckWindow({
14+
tag: "Login page"
15+
});
16+
17+
cy.get('#username').type('user')
18+
cy.get('#password').type('password')
19+
cy.get('#log-in').click()
20+
21+
cy.eyesCheckWindow({
22+
tag: "Main page",
23+
layout: [
24+
{selector: '.dashboardOverview_accountBalances__3TUPB'},
25+
{selector: '.dashboardTable_dbTable___R5Du'}
26+
]
27+
});
28+
})
29+
afterEach(() => {
30+
// End Applitools Visual AI Test
31+
cy.eyesClose()
32+
})
33+
})

cypress/e2e/simple-example.cy.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
describe('ACME Bank', () => {
2+
beforeEach(() => {
3+
// Start Applitools Visual AI Test
4+
cy.eyesOpen({
5+
appName: 'ACME Bank',
6+
testName: Cypress.currentTest.title,
7+
})
8+
})
9+
it('should log into a bank account', () => {
10+
cy.visit('https://sandbox.applitools.com/bank?layoutAlgo=true');
11+
12+
// Full Page - Visual AI Assertion
13+
cy.eyesCheckWindow({
14+
tag: "Login page"
15+
});
16+
17+
cy.get('#username').type('user')
18+
cy.get('#password').type('password')
19+
cy.get('#log-in').click()
20+
21+
cy.eyesCheckWindow({
22+
tag: "Main page",
23+
// Uncomment to apply Layout regions and have test pass
24+
// layout: [
25+
// {selector: '.dashboardOverview_accountBalances__3TUPB'},
26+
// {selector: '.dashboardTable_dbTable___R5Du'}
27+
// ]
28+
});
29+
})
30+
afterEach(() => {
31+
// End Applitools Visual AI Test
32+
cy.eyesClose()
33+
})
34+
})

0 commit comments

Comments
 (0)