add response check to submit login e2e test step

This commit is contained in:
mahula 2023-02-02 14:25:08 +01:00
parent bc12958e3e
commit 4dfad4086d

View File

@ -16,9 +16,19 @@ When("the user submits no credentials", () => {
When(
"the user submits the credentials {string} {string}",
(email: string, password: string) => {
cy.intercept("POST", "/graphql").as("login");
// cy.intercept('POST', '/graphql', (req) => {
// if (req.body.hasOwnProperty('query') && req.body.query.includes('mutation')) {
// req.alias = 'login'
// }
// });
loginPage.enterEmail(email);
loginPage.enterPassword(password);
loginPage.submitLogin();
cy.wait("@login").then((interception) => {
expect(JSON.stringify(interception.response.body)).contains(email);
});
}
);