diff --git a/scripts/cypress/integration/common/2b_table_with_m2m_column.js b/scripts/cypress/integration/common/2b_table_with_m2m_column.js index f1a1078d73..efc5fc1ec0 100644 --- a/scripts/cypress/integration/common/2b_table_with_m2m_column.js +++ b/scripts/cypress/integration/common/2b_table_with_m2m_column.js @@ -12,7 +12,7 @@ export const genTest = (type, xcdb) => { }) after(() => { - cy.get('[href="#table||db||Actor"]').find('button.mdi-close').click() + cy.closeTableTab('Actor') }) it('Table column header, URL validation', () => { diff --git a/scripts/cypress/integration/common/3a_filter_sort_fields_operations.js b/scripts/cypress/integration/common/3a_filter_sort_fields_operations.js index 89e8eae170..12e546d47e 100644 --- a/scripts/cypress/integration/common/3a_filter_sort_fields_operations.js +++ b/scripts/cypress/integration/common/3a_filter_sort_fields_operations.js @@ -17,7 +17,7 @@ export const genTest = (type, xcdb) => { }) after(() => { - cy.get('[href="#table||db||Country"]').find('button.mdi-close').click() + cy.closeTableTab('Country') }) describe(`Pagination`, () => { diff --git a/scripts/cypress/integration/common/3b_formula_column.js b/scripts/cypress/integration/common/3b_formula_column.js index a00152591e..0e79a29c5e 100644 --- a/scripts/cypress/integration/common/3b_formula_column.js +++ b/scripts/cypress/integration/common/3b_formula_column.js @@ -18,7 +18,7 @@ export const genTest = (type, xcdb) => { }) after(() => { - cy.get('[href="#table||db||City"]').find('button.mdi-close').click() + cy.closeTableTab('City') }) // Given rowname & expected result for first 10 entries, validate diff --git a/scripts/cypress/integration/common/3c_lookup_column.js b/scripts/cypress/integration/common/3c_lookup_column.js index 637359c78d..8c2e0ab364 100644 --- a/scripts/cypress/integration/common/3c_lookup_column.js +++ b/scripts/cypress/integration/common/3c_lookup_column.js @@ -27,7 +27,7 @@ export const genTest = (type, xcdb) => { }) after(() => { - cy.get('[href="#table||db||City"]').find('button.mdi-close').click() + cy.closeTableTab('City') }) // Routine to create a new look up column diff --git a/scripts/cypress/integration/common/3d_rollup_column.js b/scripts/cypress/integration/common/3d_rollup_column.js index d71e22eb2c..0839f1c03b 100644 --- a/scripts/cypress/integration/common/3d_rollup_column.js +++ b/scripts/cypress/integration/common/3d_rollup_column.js @@ -26,7 +26,7 @@ export const genTest = (type, xcdb) => { }) after(() => { - cy.get('[href="#table||db||Country"]').find('button.mdi-close').click() + cy.closeTableTab('Country'); }) // Routine to create a new look up column diff --git a/scripts/cypress/integration/common/4a_table_view_grid_gallery_form.js b/scripts/cypress/integration/common/4a_table_view_grid_gallery_form.js index 4a32db692c..3a2f413adb 100644 --- a/scripts/cypress/integration/common/4a_table_view_grid_gallery_form.js +++ b/scripts/cypress/integration/common/4a_table_view_grid_gallery_form.js @@ -19,7 +19,7 @@ export const genTest = (type, xcdb) => { }) after(() => { - cy.get('[href="#table||db||Country"]').find('button.mdi-close').click() + cy.closeTableTab('Country') }) // Common routine to create/edit/delete GRID & GALLERY view diff --git a/scripts/cypress/integration/common/4b_table_view_share.js b/scripts/cypress/integration/common/4b_table_view_share.js index 5e900ffd84..f3fffb747c 100644 --- a/scripts/cypress/integration/common/4b_table_view_share.js +++ b/scripts/cypress/integration/common/4b_table_view_share.js @@ -87,7 +87,7 @@ export const genTest = (type, xcdb) => { }) after(() => { - cy.get('[href="#table||db||City"]').find('button.mdi-close').click() + cy.closeTableTab('City') }) }) } diff --git a/scripts/cypress/integration/common/4c_form_view_detailed.js b/scripts/cypress/integration/common/4c_form_view_detailed.js index 87c6aeaee5..4a1bd7495e 100644 --- a/scripts/cypress/integration/common/4c_form_view_detailed.js +++ b/scripts/cypress/integration/common/4c_form_view_detailed.js @@ -30,7 +30,7 @@ export const genTest = (type, xcdb) => { }) after(() => { - cy.get('[href="#table||db||Country"]').find('button.mdi-close').click() + cy.closeTableTab('Country') }) // Common routine to create/edit/delete GRID & GALLERY view diff --git a/scripts/cypress/integration/common/4d_table_view_grid_locked.js b/scripts/cypress/integration/common/4d_table_view_grid_locked.js index e3655696e6..07015fb32c 100644 --- a/scripts/cypress/integration/common/4d_table_view_grid_locked.js +++ b/scripts/cypress/integration/common/4d_table_view_grid_locked.js @@ -17,7 +17,7 @@ export const genTest = (type, xcdb) => { }) after(() => { - cy.get('[href="#table||db||Country"]').find('button.mdi-close').click() + cy.closeTableTab('Country') }) const lockViewTest = (enabled) => { diff --git a/scripts/cypress/integration/common/4e_form_view_share.js b/scripts/cypress/integration/common/4e_form_view_share.js index 439ce91b49..9dc2148105 100644 --- a/scripts/cypress/integration/common/4e_form_view_share.js +++ b/scripts/cypress/integration/common/4e_form_view_share.js @@ -30,7 +30,7 @@ export const genTest = (type, xcdb) => { }) after(() => { - cy.get('[href="#table||db||City"]').find('button.mdi-close').click() + cy.closeTableTab('City') }) diff --git a/scripts/cypress/integration/common/4f_grid_view_share.js b/scripts/cypress/integration/common/4f_grid_view_share.js index ff7bfdac40..296437da6d 100644 --- a/scripts/cypress/integration/common/4f_grid_view_share.js +++ b/scripts/cypress/integration/common/4f_grid_view_share.js @@ -57,7 +57,7 @@ export const genTest = (type, xcdb) => { after(() => { // close table // mainPage.deleteCreatedViews() - cy.get('[href="#table||db||Address"]').find('button.mdi-close').click() + cy.closeTableTab('Address') }) // Common routine to create/edit/delete GRID & GALLERY view @@ -426,7 +426,7 @@ export const genTest = (type, xcdb) => { // // close table // cy.visit(baseURL) // mainPage.deleteCreatedViews() - // cy.get('[href="#table||db||Address"]').find('button.mdi-close').click() + // cy.closeTableTab('Address') // }) // it(`Generate default Shared GRID view URL`, () => { @@ -510,7 +510,7 @@ export const genTest = (type, xcdb) => { mainPage.deleteCreatedViews() // close table - cy.get('[href="#table||db||Country"]').find('button.mdi-close').click() + cy.closeTableTab('Country') }) it(`Generate default Shared GRID view URL`, () => { diff --git a/scripts/cypress/integration/common/5b_preview_role.js b/scripts/cypress/integration/common/5b_preview_role.js index 51b998bd8a..78e99fcc77 100644 --- a/scripts/cypress/integration/common/5b_preview_role.js +++ b/scripts/cypress/integration/common/5b_preview_role.js @@ -261,7 +261,7 @@ export const genTest = (type, xcdb, roleType) => { cy.wait(3000) mainPage.navigationDraw(mainPage.ROLE_VIEW).contains('Reset Preview').should('not.exist') - cy.get('[href="#table||db||City"]').find('button.mdi-close').click() + cy.closeTableTab('City') }) const genTestSub = (roleType) => { diff --git a/scripts/cypress/integration/common/6b_downloadCsv.js b/scripts/cypress/integration/common/6b_downloadCsv.js index cd5ef3edb7..c96e3f11d5 100644 --- a/scripts/cypress/integration/common/6b_downloadCsv.js +++ b/scripts/cypress/integration/common/6b_downloadCsv.js @@ -13,7 +13,7 @@ export const genTest = (type, xcdb) => { }) after(() => { - cy.get('[href="#table||db||Country"]').find('button.mdi-close').click() + cy.closeTableTab('Country') }) it('Download verification- base view, default columns', () => { diff --git a/scripts/cypress/integration/common/6f_attachments.js b/scripts/cypress/integration/common/6f_attachments.js index 8712421def..40d9828c32 100644 --- a/scripts/cypress/integration/common/6f_attachments.js +++ b/scripts/cypress/integration/common/6f_attachments.js @@ -24,7 +24,7 @@ export const genTest = (type, xcdb) => { mainPage.getCell("Country", 10).rightclick() cy.getActiveMenu().contains('Delete Selected Row').click() - cy.get('[href="#table||db||Country"]').find('button.mdi-close').click() + cy.closeTableTab('Country') }) it(`Add column of type attachments`, () => { diff --git a/scripts/cypress/support/commands.js b/scripts/cypress/support/commands.js index 4b31eae402..aefd661f47 100644 --- a/scripts/cypress/support/commands.js +++ b/scripts/cypress/support/commands.js @@ -124,6 +124,10 @@ Cypress.Commands.add('openTableTab', (tn) => { cy.wait(500) }) +Cypress.Commands.add('closeTableTab', (tn) => { + cy.get(`[href="#table||db||${tn}"]`).find('button.mdi-close').click() +}) + Cypress.Commands.add('openOrCreateGqlProject', (_args) => { const args = Object.assign({new: false, meta: false}, _args)