diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/TableV2/Add_new_row_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/TableV2/Add_new_row_spec.js index 93a2a133a8..4828308887 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/TableV2/Add_new_row_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/TableV2/Add_new_row_spec.js @@ -193,6 +193,7 @@ describe("Table widget Add new row feature's", () => { describe("Validation flow", () => { before(() => { + cy.startServerAndRoutes(); agHelper.RestoreLocalStorageCache(); cy.addDsl(dsl); }); @@ -350,6 +351,7 @@ describe("Table widget Add new row feature's", () => { describe("Actions flow (save, discard)", () => { before(() => { + cy.startServerAndRoutes(); agHelper.RestoreLocalStorageCache(); cy.addDsl(dsl); }); diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Workspace/ShareAppTests_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Workspace/ShareAppTests_spec.js index 7f597d441d..39ed93c5e7 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Workspace/ShareAppTests_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Workspace/ShareAppTests_spec.js @@ -56,11 +56,6 @@ describe("Create new workspace and share with a user", function () { it("3. Enable public access to Application", function () { cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD")); - cy.wait("@applications").should( - "have.nested.property", - "response.body.responseMeta.status", - 200, - ); cy.SearchApp(appid); cy.wait("@getPagesForCreateApp").should( "have.nested.property", @@ -117,11 +112,6 @@ describe("Create new workspace and share with a user", function () { it("6. login as Owner and disable public access", function () { cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD")); - cy.wait("@applications").should( - "have.nested.property", - "response.body.responseMeta.status", - 200, - ); cy.SearchApp(appid); cy.wait("@getPagesForCreateApp").should( "have.nested.property", diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index 141b6adf42..95dc602846 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -274,11 +274,14 @@ Cypress.Commands.add("Signup", (uname, pword) => { Cypress.Commands.add("LoginFromAPI", (uname, pword) => { cy.location().then((loc) => { + let baseURL = Cypress.config().baseUrl; + baseURL = baseURL.endsWith("/") ? baseURL.slice(0, -1) : baseURL; + cy.visit({ method: "POST", url: "api/v1/login", headers: { - origin: loc.origin, + origin: baseURL, }, followRedirect: true, body: { @@ -289,9 +292,15 @@ Cypress.Commands.add("LoginFromAPI", (uname, pword) => { .then(() => cy.location()) .then((loc) => { expect(loc.href).to.equal(loc.origin + "/applications"); + cy.wait("@getMe"); + cy.wait("@applications").should( + "have.nested.property", + "response.body.responseMeta.status", + 200, + ); + cy.wait("@getReleaseItems"); }); }); - cy.wait(2000); //for the page elements to load! }); Cypress.Commands.add("DeleteApp", (appName) => { @@ -599,18 +608,16 @@ Cypress.Commands.add("generateUUID", () => { Cypress.Commands.add("addDsl", (dsl) => { let currentURL, pageid, layoutId, appId; - appId = localStorage.getItem("applicationId"); cy.url().then((url) => { currentURL = url; pageid = currentURL.split("/")[5]?.split("-").pop(); - cy.log(pageidcopy + "page id copy"); - cy.log(pageid + "page id"); - appId = localStorage.getItem("applicationId"); + //Fetch the layout id cy.request("GET", "api/v1/pages/" + pageid).then((response) => { const respBody = JSON.stringify(response.body); - layoutId = JSON.parse(respBody).data.layouts[0].id; - cy.log("appid:" + appId); + const data = JSON.parse(respBody).data; + layoutId = data.layouts[0].id; + appId = data.applicationId; // Dumping the DSL to the created page cy.request({ method: "PUT", @@ -629,6 +636,7 @@ Cypress.Commands.add("addDsl", (dsl) => { cy.log(response.body); expect(response.status).equal(200); cy.reload(); + cy.wait("@getWorkspace"); }); }); }); @@ -926,6 +934,7 @@ Cypress.Commands.add("startServerAndRoutes", () => { cy.route("GET", "/api/v1/datasources?workspaceId=*").as("getDataSources"); cy.route("GET", "/api/v1/pages?*mode=EDIT").as("getPagesForCreateApp"); cy.route("GET", "/api/v1/pages?*mode=PUBLISHED").as("getPagesForViewApp"); + cy.route("GET", "/api/v1/applications/releaseItems").as("getReleaseItems"); cy.route("POST"); cy.route("GET", "/api/v1/pages/*").as("getPage"); diff --git a/app/client/cypress/support/index.js b/app/client/cypress/support/index.js index ae13fe938d..dd0a9a04b9 100644 --- a/app/client/cypress/support/index.js +++ b/app/client/cypress/support/index.js @@ -33,6 +33,17 @@ import "./AdminSettingsCommands"; import "cypress-plugin-tab"; /// +let rapidMode = { + enabled: false, // Set to true to disable app creation + appName: "cf023e29", // Replace it with your app name + pageName: "page1", // Replace it with the page name + pageID: "644d0ec870cec01248edfc9a", // Replace it with pageID + + url: function () { + return `app/${this.appName}/${this.pageName}-${this.pageID}/edit`; + }, +}; + Cypress.on("uncaught:exception", () => { // returning false here prevents Cypress from // failing the test @@ -46,6 +57,24 @@ Cypress.on("fail", (error) => { Cypress.env("MESSAGES", MESSAGES); before(function () { + if (rapidMode.enabled) { + cy.startServerAndRoutes(); + cy.getCookie("SESSION").then((cookie) => { + if (!cookie) { + cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD")); + } + }); + + Cypress.Cookies.preserveOnce("SESSION", "remember_token"); + cy.visit(rapidMode.url()); + cy.wait("@getWorkspace"); + } +}); + +before(function () { + if (rapidMode.enabled) { + return; + } //console.warn = () => {}; //to remove all warnings in cypress console initLocalstorage(); initLocalstorageRegistry(); @@ -86,12 +115,14 @@ before(function () { }); before(function () { + if (rapidMode.enabled) { + return; + } //console.warn = () => {}; Cypress.Cookies.preserveOnce("SESSION", "remember_token"); const username = Cypress.env("USERNAME"); const password = Cypress.env("PASSWORD"); cy.LoginFromAPI(username, password); - cy.wait("@getMe"); cy.wait(3000); cy.get(".t--applications-container .createnew") .should("be.visible") @@ -122,6 +153,9 @@ beforeEach(function () { }); after(function () { + if (rapidMode.enabled) { + return; + } //-- Deleting the application by Api---// cy.DeleteAppByApi(); //-- LogOut Application---//