1 // add new command to the existing Cypress interface
2 declare namespace Cypress {
5 openIframe : typeof openIframe
9 let currentLoginCookies : any = null;
12 function login(): void {
13 if(currentLoginCookies){
14 cy.setCookie('JSESSIONID', currentLoginCookies.value, {
15 expiry : currentLoginCookies.expiry,
16 path : currentLoginCookies.path,
17 domain : currentLoginCookies.domain
21 "LOGIN_ID" : "#loginId",
22 "PASSWORD_ID" : "#password",
23 "LOGIN_BTN_ID" : "#loginBtn"
26 cy.visit('/login_external.htm');
27 cy.get(constant.LOGIN_ID).type("us16807000")
28 .get(constant.PASSWORD_ID).type("us16807000")
29 .get(constant.LOGIN_BTN_ID).click();
31 cy.getCookie("JSESSIONID").then((res) => {
32 currentLoginCookies = res;
37 function openIframe(iframeUrl : string): void {
41 Cypress.Commands.add('login', login);
42 Cypress.Commands.add('openIframe', openIframe);