diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index 6d06215d54..8d7ccc3554 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -1133,15 +1133,26 @@ Cypress.Commands.add("startServerAndRoutes", () => { cy.intercept("PUT", "/api/v1/git/discard/app/*").as("discardChanges"); cy.intercept("GET", "/api/v1/libraries/*").as("getLibraries"); featureFlagIntercept({}, false); - // Mock empty product alerts so that it does not interfere with tests - cy.intercept("GET", "/api/v1/product-alert/alert", { - responseMeta: { - status: 200, - success: true, - }, - data: {}, - errorDisplay: "", - }); + + cy.intercept("GET", "/api/v1/product-alert/alert", (req) => { + try { + req.continue((res) => { + // This api should always be 200, for any case. + expect(res.statusCode).to.be.equal(200); + // Mock empty product alerts response so that it does not interfere with tests + res.send(200, { + responseMeta: { + status: 200, + success: true, + }, + data: {}, + errorDisplay: "", + }); + }); + } catch (e) { + console.error(e); + } + }).as("productAlert"); }); Cypress.Commands.add("startErrorRoutes", () => { @@ -1374,6 +1385,7 @@ Cypress.Commands.add("createSuperUser", () => { expect(interception.request.body).contains("signupForNewsletter=true"); }); } + cy.wait("@getWorkspace"); cy.LogOut(); cy.wait(2000); diff --git a/app/client/cypress/support/e2e.js b/app/client/cypress/support/e2e.js index 398a85fbee..17a1161606 100644 --- a/app/client/cypress/support/e2e.js +++ b/app/client/cypress/support/e2e.js @@ -92,7 +92,6 @@ before(function () { cy.url().then((url) => { if (url.indexOf("setup/welcome") > -1) { cy.createSuperUser(); - cy.LogOut(); cy.SignupFromAPI( Cypress.env("TESTUSERNAME1"), Cypress.env("TESTPASSWORD1"),