1
1
/// <reference types="cypress" />
2
2
3
- // This test case spec contains everything needed to run a full visual test against the ACME bank site.
4
- // The file `applitools.config.js` specifies how to run this test against multiple browsers in Applitools Ultrafast Grid.
3
+ const viewportWidth = 375 ;
4
+ const viewportHeight = 812 ;
5
+ const urls = [
6
+ "https://illuccixhcp.com/" ,
7
+ "https://illuccixhcp.com/safety/" ,
8
+ "https://illuccixhcp.com/preparation/" ,
9
+ "https://illuccixhcp.com/receive-updates/" ,
10
+ "https://illuccixhcp.com/access-reimbursement/" ,
11
+ "https://illuccixhcp.com/accessibility/" ,
12
+ "https://illuccixhcp.com/efficacy/" ,
13
+ "https://illuccixhcp.com/subscribe"
14
+
15
+ ]
16
+
17
+ Cypress . on ( "uncaught:exception" , ( err , runnable ) => {
18
+ return false ;
19
+ } ) ;
5
20
6
- // This "describe" method contains related test cases with per-test setup and cleanup.
7
- // In this example, there is only one test.
8
21
describe ( 'ACME Bank' , ( ) => {
9
-
10
22
// This method performs setup before each test.
11
23
beforeEach ( ( ) => {
12
-
13
- // Open Eyes to start visual testing.
14
- // Each test should open its own Eyes for its own snapshots.
15
24
cy . eyesOpen ( {
16
-
17
- // The name of the application under test.
18
- // All tests for the same app should share the same app name.
19
- // Set this name wisely: Applitools features rely on a shared app name across tests.
20
25
appName : 'ACME Bank' ,
21
-
22
- // The name of the test case for the given application.
23
- // Additional unique characteristics of the test may also be specified as part of the test name,
24
- // such as localization information ("Home Page - EN") or different user permissions ("Login by admin").
25
26
testName : Cypress . currentTest . title ,
26
- } )
27
- } )
28
-
29
- // This test covers login for the Applitools demo site, which is a dummy banking app.
30
- // The interactions use typical Cypress calls,
31
- // but the verifications use one-line snapshot calls with Applitools Eyes.
32
- // If the page ever changes, then Applitools will detect the changes and highlight them in the Eyes Test Manager.
33
- // Traditional assertions that scrape the page for text values are not needed here.
34
- it ( 'should log into a bank account' , ( ) => {
35
-
36
- // Load the login page.
37
- cy . visit ( 'https://demo.applitools.com' )
38
-
39
- // Verify the full login page loaded correctly.
40
- cy . eyesCheckWindow ( {
41
- tag : "Login page" ,
42
- target : 'window' ,
43
- fully : true
27
+ browser : { width : viewportWidth , height : viewportHeight , name : chrome } ,
28
+ baselineEnvName : 'desktop'
44
29
} ) ;
45
-
46
- // Perform login.
47
- cy . get ( '#username' ) . type ( 'andy' )
48
- cy . get ( '#password' ) . type ( 'i<3pandas' )
49
- cy . get ( '#log-in' ) . click ( )
50
-
51
- // Verify the full main page loaded correctly.
52
- // This snapshot uses LAYOUT match level to avoid differences in closing time text.
53
- cy . eyesCheckWindow ( {
54
- tag : "Main page" ,
55
- target : 'window' ,
56
- fully : true ,
57
- matchLevel : 'Layout'
30
+ } ) ;
31
+
32
+ urls . forEach ( ( url ) => {
33
+ it ( `should capture snapshots for comparison between envs on ${ url } ` , ( ) => {
34
+ cy . visit ( url ) ;
35
+ cy . contains ( "I am a" ) . click ( { force : true } ) ;
36
+ cy . get ( "#indications-tray" ) . invoke ( 'remove' ) ;
37
+ // cy.get(".icon-tabler-x").click({ force: true });
38
+ cy . viewport ( viewportWidth , viewportHeight ) ;
39
+
40
+ // Extract the path from the URL
41
+ const urlPath = new URL ( url ) . pathname ;
42
+
43
+ // Capture a visual snapshot using Applitools with the path as the tag
44
+ cy . eyesCheckWindow ( {
45
+ tag : urlPath , // Using the path as a tag for the snapshot
46
+ fully : true , // Capture the full page
47
+ } ) ;
58
48
} ) ;
59
- } )
49
+ } ) ;
60
50
61
51
// This method performs cleanup after each test.
62
52
afterEach ( ( ) => {
63
-
64
- // Close Eyes to tell the server it should display the results.
65
- cy . eyesClose ( )
66
- } )
67
- } )
53
+ cy . eyesClose ( ) ;
54
+ } ) ;
55
+ } ) ;
0 commit comments