Browse Source

test: use closeTableTab() across files

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3905/head
Raju Udava 2 years ago
parent
commit
71b7d1ddff
  1. 7
      scripts/cypress/integration/common/00_pre_configurations.js
  2. 11
      scripts/cypress/integration/common/3c_lookup_column.js
  3. 10
      scripts/cypress/integration/common/3d_rollup_column.js
  4. 9
      scripts/cypress/integration/common/5a_user_role.js
  5. 4
      scripts/cypress/integration/common/9a_QuickTest.js
  6. 25
      scripts/cypress/support/commands.js
  7. 12
      scripts/cypress/support/page_objects/mainPage.js
  8. 14
      scripts/cypress/support/page_objects/navigation.js

7
scripts/cypress/integration/common/00_pre_configurations.js

@ -243,12 +243,7 @@ export const genTest = (apiType, dbType) => {
// wait for tab to be rendered completely
cy.wait(2000);
cy.getSettled("button.ant-tabs-tab-remove")
.should("be.visible")
.click();
cy.get("button.ant-tabs-tab-remove").should("not.exist");
cy.wait(2000);
cy.closeTableTab();
// first instance of updating local storage information
cy.saveLocalStorage();

11
scripts/cypress/integration/common/3c_lookup_column.js

@ -11,18 +11,7 @@ export const genTest = (apiType, dbType) => {
cy.get("label").contains(label).parents(".ant-row").click();
};
// Run once before test- create project (rest/graphql)
//
// before(() => {
// cy.fileHook();
// mainPage.tabReset();
// // open a table to work on views
// //
//
// // // close team & auth tab
// // cy.get('button.ant-tabs-tab-remove').should('exist').click();
//
// cy.openTableTab("City", 25);
// });
beforeEach(() => {

10
scripts/cypress/integration/common/3d_rollup_column.js

@ -11,17 +11,7 @@ export const genTest = (apiType, dbType) => {
cy.get("label").contains(label).parents(".ant-row").click();
};
// Run once before test- create project (rest/graphql)
//
// before(() => {
// cy.fileHook();
// mainPage.tabReset();
//
// // // close team & auth tab
// // cy.get('button.ant-tabs-tab-remove').should('exist').click();
// // open a table to work on views
// //
// cy.openTableTab("Country", 25);
// });
beforeEach(() => {

9
scripts/cypress/integration/common/5a_user_role.js

@ -145,14 +145,7 @@ export const genTest = (apiType, dbType) => {
}
if (roleType === "creator") {
// kludge: wait for page load to finish
// close team & auth tab
// cy.wait(500);
// cy.get("button.ant-tabs-tab-remove").should("exist").click();
cy.getSettled("button.ant-tabs-tab-remove")
.should("be.visible")
.click();
cy.wait(2000);
cy.closeTableTab();
}
cy.saveLocalStorage();

4
scripts/cypress/integration/common/9a_QuickTest.js

@ -113,9 +113,7 @@ export const genTest = (apiType, dbType, testMode) => {
// kludge: wait for page load to finish
cy.wait(2000);
// close team & auth tab
cy.get("button.ant-tabs-tab-remove").should("exist").click();
cy.wait(2000);
cy.closeTableTab();
} else {
cy.restoreLocalStorage();
}

25
scripts/cypress/support/commands.js

@ -189,17 +189,24 @@ Cypress.Commands.add("openTableTab", (tn, rc) => {
Cypress.Commands.add("closeTableTab", (tn) => {
cy.task("log", `[closeTableTab] ${tn}`);
cy.get(".ant-tabs-tab-btn")
.contains(tn)
.should("exist")
.parent()
.parent()
.parent()
.find("button")
.click();
if (tn) {
// request to close specific tab
cy.get(".ant-tabs-tab-btn")
.contains(tn)
.should("exist")
.parent()
.parent()
.parent()
.find("button")
.click();
} else {
// lone tab active; close it
cy.getSettled("button.ant-tabs-tab-remove").should("be.visible").click();
cy.get("button.ant-tabs-tab-remove").should("not.exist");
}
// subsequent tab open commands will fail if tab is not closed completely
cy.wait(2000)
cy.wait(2000);
});
Cypress.Commands.add("openOrCreateGqlProject", (_args) => {

12
scripts/cypress/support/page_objects/mainPage.js

@ -615,17 +615,7 @@ export class _mainPage {
});
}
tabReset() {
// temporary disable (kludge)
// mainPage.toolBarTopLeft(mainPage.HOME).click({ force: true });
// cy.get(".project-row").should("exist").click({ force: true });
// projectsPage.waitHomePageLoad();
// option-2
// cy.openTableTab("Country", 0);
// cy.get(".mdi-close").click({ multiple: true });
// cy.get("button.ant-tabs-tab-remove").click({ multiple: true });
// cy.get('.ant-tabs-tab-remove').should('not.exist')
}
tabReset() {}
toggleRightSidebar() {
cy.get(".nc-toggle-right-navbar").should("exist").click();

14
scripts/cypress/support/page_objects/navigation.js

@ -70,16 +70,6 @@ export class _loginPage {
loginAndOpenProject(apiType, dbType) {
loginPage.signIn(roles.owner.credentials);
projectsPage.openConfiguredProject(apiType, dbType);
// if (dbType === "mysql") {
// projectsPage.openProject(staticProjects.externalREST.basic.name);
// } else if (dbType === "xcdb") {
// projectsPage.openProject(staticProjects.sampleREST.basic.name);
// } else if (dbType === "postgres") {
// projectsPage.openProject(staticProjects.pgExternalREST.basic.name);
// }
//
// // close team & auth tab
// cy.get('button.ant-tabs-tab-remove').should('exist').click();
}
}
@ -108,9 +98,7 @@ export class _projectsPage {
cy.wait("@waitForPageLoad");
// close team & auth tab
cy.getSettled("button.ant-tabs-tab-remove").should("be.visible").click();
cy.get("button.ant-tabs-tab-remove").should("not.exist");
cy.wait(2000);
cy.closeTableTab();
}
// Open existing project

Loading…
Cancel
Save