1+ import '@percy/cypress' ;
2+ import { BASE_URL , GUEST_TOKEN } from '../utils/constants' ;
3+
4+ // ***********************************************
5+ // This example commands.js shows you how to
6+ // create various custom commands and overwrite
7+ // existing commands.
8+ //
9+ // For more comprehensive examples of custom
10+ // commands please read more here:
11+ // https://on.cypress.io/custom-commands
12+ // ***********************************************
13+ //
14+ //
15+ // -- This is a parent command --
16+ // Cypress.Commands.add('login', (email, password) => { ... })
17+ //
18+ //
19+ // -- This is a child command --
20+ // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
21+ //
22+ //
23+ // -- This is a dual command --
24+ // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
25+ //
26+ //
27+ // -- This will overwrite an existing command --
28+ // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
29+
30+ Cypress . Commands . add ( 'login' , ( ) => {
31+ cy . visit ( BASE_URL )
32+ . then ( ( ) => {
33+ window . localStorage . setItem ( 'lastUsedProvider' , 'guest' ) ;
34+ window . localStorage . setItem ( 'authCookie' , GUEST_TOKEN ) ;
35+ window . localStorage . setItem ( 'cookie:accepted' , 'true' ) ;
36+ } ) ;
37+ cy . get ( '[class="server-selection"]' ) . should ( 'be.visible' ) ;
38+ cy . reload ( ) ;
39+ } )
0 commit comments