From 010e17ee62e87b04540711237048d9a5ff373315 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 2 Feb 2023 21:58:08 +0100 Subject: [PATCH] Revert "move response in e2e test to common step definitions" This reverts commit d89fc1ef105366d0f9deffb0bf79869ce5dff019. --- .../support/step_definitions/common_steps.ts | 12 ------------ .../step_definitions/user_authentication_steps.ts | 13 +++++++++++++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts b/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts index 881394e6d..42142380b 100644 --- a/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts +++ b/e2e-tests/cypress/tests/cypress/support/step_definitions/common_steps.ts @@ -18,18 +18,6 @@ Given( Then("the user is logged in with username {string}", (username: string) => { const overviewPage = new OverviewPage(); - cy.intercept("POST", "/graphql", (req) => { - if ( - req.body.hasOwnProperty("query") && - req.body.query.includes("mutation") - ) { - req.alias = "login"; - } - }); - cy.wait("@login").then((interception) => { - expect(interception.response.statusCode).equals(200); - expect(JSON.stringify(interception.response.body)).contains(email); - }); cy.url().should("include", "/overview"); cy.get(overviewPage.navbarName).should("contain", username); }); diff --git a/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts b/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts index 67a64eba0..d469180b3 100644 --- a/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts +++ b/e2e-tests/cypress/tests/cypress/support/step_definitions/user_authentication_steps.ts @@ -16,9 +16,22 @@ When("the user submits no credentials", () => { When( "the user submits the credentials {string} {string}", (email: string, password: string) => { + 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(interception.response.statusCode).equals(200); + expect(JSON.stringify(interception.response.body)).contains(email); + }); } );