dimanche 29 novembre 2020

How to validate the SAML response from cypress

have implemented test for SAML scenario. Here I want to get the SAML response received and validate it. I used cy.server() and cy.rout() methods. But getting error as mentioned below. I used the assertion url as well to rout cy.route("GET", "https://ift.tt/3ocOvF7); But same issue occurred.

Can you explain a way to capture the SAML response within the test to resolve this issue Here is my code:

 cy.server();
        cy.route("GET", "/logincontext?/*").as('route1');
        cy.visit("https://localhost:9443/t/cypress/samlsso?spEntityID=SampleExpressApp");
        cy.get(USERNAME_INPUT).type(username);
        cy.get(PASSWORD_INPUT).type(password,{ log : false });
        cy.contains(CONTINUE_BUTTON).click({ delay: 1500000 }).wait(['@route1'], { timeout: 15000 }).then(xhr => {
            // Do what you want with the xhr object
            cy.writeFile("cypress/fixtures/saml.json",xhr.response);
        }) ;

Cypress execution

SAML Request and response

Aucun commentaire:

Enregistrer un commentaire