From 8489ea73233acf07acb235ec87133f2501f33adb Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Sat, 12 Feb 2022 14:04:27 +0530 Subject: [PATCH] refactor: test/cypress variable clean-up/2 Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../integration/common/5b_preview_role.js | 6 ++-- .../support/page_objects/navigation.js | 4 +-- .../support/page_objects/projectConstants.js | 28 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/scripts/cypress/integration/common/5b_preview_role.js b/scripts/cypress/integration/common/5b_preview_role.js index d59f694bd1..c097d4b23d 100644 --- a/scripts/cypress/integration/common/5b_preview_role.js +++ b/scripts/cypress/integration/common/5b_preview_role.js @@ -16,8 +16,8 @@ import { _accessControl, } from "../spec/roleValidation.spec"; -export const genTest = (type, xcdb, roleType) => { - if (!isTestSuiteActive(type, xcdb)) return; +export const genTest = (apiType, dbType, roleType) => { + if (!isTestSuiteActive(apiType, dbType)) return; /////////////////////////////////////////////////////////// //// Test Suite @@ -25,7 +25,7 @@ export const genTest = (type, xcdb, roleType) => { describe("Role preview validations", () => { // Sign in/ open project before(() => { - loginPage.loginAndOpenProject(type, xcdb); + loginPage.loginAndOpenProject(apiType, dbType); cy.openTableTab("City", 25); }); diff --git a/scripts/cypress/support/page_objects/navigation.js b/scripts/cypress/support/page_objects/navigation.js index 5b7771e704..ce35b66c7a 100644 --- a/scripts/cypress/support/page_objects/navigation.js +++ b/scripts/cypress/support/page_objects/navigation.js @@ -55,10 +55,10 @@ export class _loginPage { // standard pre-project activity // - loginAndOpenProject(apiType, xcdb) { + loginAndOpenProject(apiType, dbType) { loginPage.signIn(roles.owner.credentials); - if (!xcdb) { + if (!dbType) { if ("rest" == apiType) projectsPage.openProject(staticProjects.externalREST.basic.name); else projectsPage.openProject(staticProjects.externalGQL.basic.name); diff --git a/scripts/cypress/support/page_objects/projectConstants.js b/scripts/cypress/support/page_objects/projectConstants.js index 075622ba34..e75a29766a 100644 --- a/scripts/cypress/support/page_objects/projectConstants.js +++ b/scripts/cypress/support/page_objects/projectConstants.js @@ -95,17 +95,17 @@ export const staticProjects = { // return TRUE if test suite specified is activated from env-variables // -export const isTestSuiteActive = (type, xcdb) => { +export const isTestSuiteActive = (apiType, dbType) => { const env = Cypress.env("testMode"); - if (!xcdb) { - switch (type) { + if (!dbType) { + switch (apiType) { case "rest": return env.includes("extREST") ? true : false; case "graphql": return env.includes("extGQL") ? true : false; } } else { - switch (type) { + switch (apiType) { case "rest": return env.includes("xcdbREST") ? true : false; case "graphql": @@ -129,31 +129,31 @@ export const getPrimarySuite = () => { } }; -export const isSecondarySuite = (proj, xcdb) => { - if (!isTestSuiteActive(proj, xcdb)) return false; +export const isSecondarySuite = (apiType, dbType) => { + if (!isTestSuiteActive(apiType, dbType)) return false; const env = Cypress.env("testMode").split("."); switch (env[0]) { case "extREST": - return proj == "rest" && !xcdb ? false : true; + return apiType == "rest" && !dbType ? false : true; case "extGQL": - return proj == "graphql" && !xcdb ? false : true; + return apiType == "graphql" && !dbType ? false : true; case "xcdbREST": - return proj == "rest" && xcdb ? false : true; + return apiType == "rest" && dbType ? false : true; case "xcdbGQL": - return proj == "graphql" && xcdb ? false : true; + return apiType == "graphql" && dbType ? false : true; } }; let currentTestMode = ``; let xcdbProjectString = ``; -export function setCurrentMode(proj, xcdb) { - if (!xcdb) { - if (proj == "rest") currentTestMode = "extREST"; +export function setCurrentMode(apiType, dbType) { + if (!dbType) { + if (apiType == "rest") currentTestMode = "extREST"; else currentTestMode = "extGQL"; } else { - if (proj == "rest") currentTestMode = "xcdbREST"; + if (apiType == "rest") currentTestMode = "xcdbREST"; else currentTestMode = "xcdbGQL"; } }