diff --git a/.gitignore b/.gitignore index 99e245988a..23c854e3d4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ *.iml .env -app/client/cypress.env.json stacks # to ignore the node_modeules folder diff --git a/app/client/.gitignore b/app/client/.gitignore index 842286773c..3415ab513f 100755 --- a/app/client/.gitignore +++ b/app/client/.gitignore @@ -32,7 +32,7 @@ yarn-error.log* .storybook-out/ cypress/videos cypress/screenshots -/cypress.env.json +cypress.env.json results/ diff --git a/app/client/cypress.env.json b/app/client/cypress.env.json deleted file mode 100644 index 3f16015903..0000000000 --- a/app/client/cypress.env.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "MySQL": 1, - "Mongo": 1, - "Edition": 0 -} \ No newline at end of file diff --git a/app/client/cypress/fixtures/REPO.ts b/app/client/cypress/fixtures/REPO.ts new file mode 100644 index 0000000000..24085c86b2 --- /dev/null +++ b/app/client/cypress/fixtures/REPO.ts @@ -0,0 +1,8 @@ +export const REPO = { + CE: "CE", + EE: "EE", +}; +// CURRENT_REPO value is set as "CE" in appsmith repo and "EE" in appsmith-ee repo. +// appsmith-ee has a commit ahead of CE to persist the change. +// This file should not be modified to avoid the conflict when ce code merged to ee. +export const CURRENT_REPO = REPO.CE; diff --git a/app/client/cypress/fixtures/variables.ts b/app/client/cypress/fixtures/variables.ts new file mode 100644 index 0000000000..cf45f5c5cb --- /dev/null +++ b/app/client/cypress/fixtures/variables.ts @@ -0,0 +1,5 @@ +// Make the INTERCEPT value as true locally, if there is a need to intercept the DB. +export const INTERCEPT = { + MYSQL: false, + MONGO: false, +}; diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/AuditLogs/Audit_logs_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/AuditLogs/Audit_logs_spec.js index 49b3923564..7c0ae21b45 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/AuditLogs/Audit_logs_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/AuditLogs/Audit_logs_spec.js @@ -1,3 +1,5 @@ +import { REPO, CURRENT_REPO } from "../../../../fixtures/REPO"; + const Access = { AdminSettingsEntryLink: ".admin-settings-menu-option", LeftPaneAuditLogsLink: @@ -27,7 +29,7 @@ const locators = { ...Access, ...UpgradePage }; describe("Audit logs", () => { it("1. Super user can access audit logs page", () => { - if (Cypress.env("Edition") === 0) { + if (CURRENT_REPO === REPO.CE) { cy.LogOut(); cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD")); cy.visit("/applications"); diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Branding/Branding_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Branding/Branding_spec.js index d5eaef79a1..fbdbe38307 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Branding/Branding_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Branding/Branding_spec.js @@ -1,4 +1,5 @@ const commonlocators = require("../../../../locators/commonlocators.json"); +import { REPO, CURRENT_REPO } from "../../../../fixtures/REPO"; const locators = { AdminSettingsEntryLink: ".admin-settings-menu-option", @@ -90,7 +91,7 @@ describe("Branding", () => { }); it("3. Check if localStorage is populated with tenantConfig values & form cannot be submitted", () => { - if (Cypress.env("Edition") === 0) { + if (CURRENT_REPO === REPO.CE) { const tenantConfig = localStorage.getItem("tenantConfig"); expect(tenantConfig).to.be.null; cy.get(locators.submitButton).should("be.disabled"); diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/RepoLimitExceededErrorModal_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/RepoLimitExceededErrorModal_spec.js index 911288acf2..afd345dea4 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/RepoLimitExceededErrorModal_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/RepoLimitExceededErrorModal_spec.js @@ -1,5 +1,6 @@ import gitSyncLocators from "../../../../../locators/gitSyncLocators"; import * as _ from "../../../../../support/Objects/ObjectsCore"; +import { REPO, CURRENT_REPO } from "../../../../../fixtures/REPO"; let repoName1, repoName2, repoName3, repoName4, windowOpenSpy; describe("Repo Limit Exceeded Error Modal", function() { @@ -46,7 +47,7 @@ describe("Repo Limit Exceeded Error Modal", function() { // cy.createAppAndConnectGit(repoName3, false); // cy.createAppAndConnectGit(repoName4, false, true); - if (Cypress.env("Edition") === 0) { + if (CURRENT_REPO === REPO.CE) { cy.get(gitSyncLocators.repoLimitExceededErrorModal).should("exist"); // title and info text checking diff --git a/app/client/cypress/integration/Regression_TestSuite/EnterpriseTests/AdminSettings/Admin_settings_spec.js b/app/client/cypress/integration/Regression_TestSuite/EnterpriseTests/AdminSettings/Admin_settings_spec.js index 3a03e01e94..4f5f15ca03 100644 --- a/app/client/cypress/integration/Regression_TestSuite/EnterpriseTests/AdminSettings/Admin_settings_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/EnterpriseTests/AdminSettings/Admin_settings_spec.js @@ -1,5 +1,6 @@ const EnterpriseAdminSettingsLocators = require("../../../../locators/EnterpriseAdminSettingsLocators.json"); import adminsSettings from "../../../../locators/AdminsSettings"; +import { REPO, CURRENT_REPO } from "../../../../fixtures/REPO"; describe("Admin settings page", function() { beforeEach(() => { @@ -23,7 +24,7 @@ describe("Admin settings page", function() { cy.visit("/settings/general"); cy.get(adminsSettings.authenticationTab).click(); cy.url().should("contain", "/settings/authentication"); - if (Cypress.env("Edition") === 0) { + if (CURRENT_REPO === REPO.CE) { cy.get(EnterpriseAdminSettingsLocators.upgradeOidcButton) .should("be.visible") .should("contain", "UPGRADE"); diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/Mongo_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/Mongo_Spec.ts index e45e27636d..a52e3998ed 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/Mongo_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/Mongo_Spec.ts @@ -1,3 +1,4 @@ +import { INTERCEPT } from "../../../../fixtures/variables"; import { ObjectsRegistry } from "../../../../support/Objects/Registry"; let dsName: any; @@ -16,7 +17,7 @@ describe("Validate Mongo CRUD with JSON Form", () => { }); beforeEach(function() { - if (Cypress.env("Mongo") === 0) { + if (INTERCEPT.MONGO) { cy.log("Mongo DB is not found. Using intercept"); dataSources.StartInterceptRoutesForMongo(); } else cy.log("Mongo DB is found, hence using actual DB"); @@ -101,10 +102,10 @@ describe("Validate Mongo CRUD with JSON Form", () => { table.ReadTableRowColumnData(0, 0, "v1", 2000).then(($cellData) => { expect($cellData).to.eq(col1Text); }); - table.ReadTableRowColumnData(0, 3,"v1", 200).then(($cellData) => { + table.ReadTableRowColumnData(0, 3, "v1", 200).then(($cellData) => { expect($cellData).to.eq(col2Text); }); - table.ReadTableRowColumnData(0, 6,"v1", 200).then(($cellData) => { + table.ReadTableRowColumnData(0, 6, "v1", 200).then(($cellData) => { expect($cellData).to.eq(col3Text); }); diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/MySQL1_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/MySQL1_Spec.ts index 530dbdf94c..1fc1de7299 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/MySQL1_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/MySQL1_Spec.ts @@ -1,5 +1,5 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry"; - +// import { INTERCEPT } from "../../../../fixtures/variables"; let dsName: any; let agHelper = ObjectsRegistry.AggregateHelper, @@ -13,7 +13,7 @@ let agHelper = ObjectsRegistry.AggregateHelper, describe("Validate MySQL Generate CRUD with JSON Form", () => { // beforeEach(function() { - // if (Cypress.env("MySQL") === 0) { + // if (INTERCEPT.MYSQL) { // cy.log("MySQL DB is not found. Using intercept"); // //dataSources.StartInterceptRoutesForMySQL(); // } else cy.log("MySQL DB is found, hence using actual DB"); diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/MySQL2_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/MySQL2_Spec.ts index c3582a5bed..5ec33b5b0a 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/MySQL2_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/GenerateCRUD/MySQL2_Spec.ts @@ -1,5 +1,5 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry"; - +// import { INTERCEPT } from "../../../../fixtures/variables"; let dsName: any, newStoreSecret: any; let agHelper = ObjectsRegistry.AggregateHelper, @@ -12,7 +12,7 @@ let agHelper = ObjectsRegistry.AggregateHelper, describe("Validate MySQL Generate CRUD with JSON Form", () => { // beforeEach(function() { - // if (Cypress.env("MySQL") === 0) { + // if (INTERCEPT.MYSQL) { // cy.log("MySQL DB is not found. Using intercept"); // //dataSources.StartInterceptRoutesForMySQL(); // } else cy.log("MySQL DB is found, hence using actual DB"); diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/QueryPane/Mongo_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/QueryPane/Mongo_Spec.ts index 724b774bb8..b219eea85c 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/QueryPane/Mongo_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/QueryPane/Mongo_Spec.ts @@ -1,3 +1,4 @@ +import { INTERCEPT } from "../../../../fixtures/variables"; import { ObjectsRegistry } from "../../../../support/Objects/Registry"; let dsName: any; @@ -17,7 +18,7 @@ describe("Validate Mongo Query Pane Validations", () => { }); beforeEach(function() { - if (Cypress.env("Mongo") === 0) { + if (INTERCEPT.MONGO) { cy.log("Mongo DB is not found. Using intercept"); dataSources.StartInterceptRoutesForMongo(); } else cy.log("Mongo DB is found, hence using actual DB"); diff --git a/app/client/cypress/integration/Regression_TestSuite/UpgradeAppsmith/UpgradeAppsimth_spec.js b/app/client/cypress/integration/Regression_TestSuite/UpgradeAppsmith/UpgradeAppsimth_spec.js index 825285a4d7..c05a0349ab 100644 --- a/app/client/cypress/integration/Regression_TestSuite/UpgradeAppsmith/UpgradeAppsimth_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/UpgradeAppsmith/UpgradeAppsimth_spec.js @@ -1,6 +1,7 @@ /* eslint-disable no-console */ const testdata = require("../../../fixtures/testdata.json"); import { ObjectsRegistry } from "../../../support/Objects/Registry"; +import { CURRENT_REPO, REPO } from "../../../fixtures/REPO"; let agHelper = ObjectsRegistry.AggregateHelper; const tedUrl = "http://localhost:5001/v1/parent/cmd"; @@ -33,7 +34,7 @@ describe("Upgrade appsmith version", () => { }); //verify the Applications after upgrade only on CE and skip for BE - if (Cypress.env("Edition") === 0) { + if (CURRENT_REPO === REPO.CE) { cy.forceVisit(testdata.APPURL); agHelper.GetNClick(".t--widget-iconbuttonwidget button", 0, true); agHelper.Sleep(1000); diff --git a/app/client/cypress/support/Pages/HomePage.ts b/app/client/cypress/support/Pages/HomePage.ts index 5884bfeac7..61c03920dd 100644 --- a/app/client/cypress/support/Pages/HomePage.ts +++ b/app/client/cypress/support/Pages/HomePage.ts @@ -1,4 +1,5 @@ import { ObjectsRegistry } from "../Objects/Registry"; +import { REPO, CURRENT_REPO } from "../../fixtures/REPO"; export class HomePage { private agHelper = ObjectsRegistry.AggregateHelper; private locator = ObjectsRegistry.CommonLocators; @@ -25,7 +26,7 @@ export class HomePage { workspaceName + ") button:contains('Share')"; private _email = - Cypress.env("Edition") === 0 + CURRENT_REPO === REPO.CE ? "//input[@type='email' and contains(@class,'bp3-input-ghost')]" : "//input[@type='text' and contains(@class,'bp3-input-ghost')]"; _visibleTextSpan = (spanText: string) => "//span[text()='" + spanText + "']"; @@ -125,7 +126,7 @@ export class HomePage { .click({ force: true }); cy.get(this._renameWorkspaceInput) .should("be.visible") - .type(newWorkspaceName.concat("{enter}"), {delay : 0}); + .type(newWorkspaceName.concat("{enter}"), { delay: 0 }); this.agHelper.Sleep(2000); this, this.agHelper.ValidateNetworkStatus("@updateWorkspace"); this.agHelper.AssertContains(newWorkspaceName); @@ -173,7 +174,7 @@ export class HomePage { text: string, ) { const errorMessage = - Cypress.env("Edition") === 0 + CURRENT_REPO === REPO.CE ? "Invalid email address(es) found" : "Invalid email address(es) or group(s) found"; this.StubPostHeaderReq();