diff --git a/scripts/cypress/integration/common/1a_table_operations.js b/scripts/cypress/integration/common/1a_table_operations.js index fb662900e5..f7c48a9d10 100644 --- a/scripts/cypress/integration/common/1a_table_operations.js +++ b/scripts/cypress/integration/common/1a_table_operations.js @@ -76,18 +76,14 @@ export const genTest = (type, xcdb) => { // 4. verify linked contents in other table // 4a. Address table, has many field - cy.openTableTab('Address') - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('Address', 25) mainPage.getCell('City <= Address', 1).scrollIntoView() mainPage.getCell('City <= Address', 1).find('.name').contains('Lethbridge').should('exist') cy.closeTableTab('Address') // 4b. Country table, belongs to field - cy.openTableTab('Country') - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('Country', 25) mainPage.getCell('Country => City', 1).find('.name').contains('Kabul').should('exist') cy.closeTableTab('Country') diff --git a/scripts/cypress/integration/common/2a_table_with_belongs_to_colulmn.js b/scripts/cypress/integration/common/2a_table_with_belongs_to_colulmn.js index e4a7916dac..5080a67f15 100644 --- a/scripts/cypress/integration/common/2a_table_with_belongs_to_colulmn.js +++ b/scripts/cypress/integration/common/2a_table_with_belongs_to_colulmn.js @@ -7,9 +7,8 @@ export const genTest = (type, xcdb) => { describe(`${type.toUpperCase()} api - Table: belongs to, link record`, () => { before(() => { - cy.openTableTab('Country') - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('Country', 25) + }) after(() => { 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 087ab57f7d..b109a6cbbe 100644 --- a/scripts/cypress/integration/common/2b_table_with_m2m_column.js +++ b/scripts/cypress/integration/common/2b_table_with_m2m_column.js @@ -6,9 +6,8 @@ export const genTest = (type, xcdb) => { describe(`${type.toUpperCase()} api - M2M Column validation`, () => { before(() => { - cy.openTableTab('Actor') - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('Actor', 25) + }) after(() => { 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 5a503a1951..801a26ab9e 100644 --- a/scripts/cypress/integration/common/3a_filter_sort_fields_operations.js +++ b/scripts/cypress/integration/common/3a_filter_sort_fields_operations.js @@ -8,9 +8,7 @@ export const genTest = (type, xcdb) => { describe(`${type.toUpperCase()} api - Filter, Fields, Sort`, () => { before(() => { // open country table - cy.openTableTab('Country'); - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('Country', 25); }) after(() => { diff --git a/scripts/cypress/integration/common/3b_formula_column.js b/scripts/cypress/integration/common/3b_formula_column.js index 9279d3134c..6ba33e4a4d 100644 --- a/scripts/cypress/integration/common/3b_formula_column.js +++ b/scripts/cypress/integration/common/3b_formula_column.js @@ -11,9 +11,7 @@ export const genTest = (type, xcdb) => { before(() => { // open a table to work on views // - cy.openTableTab('City'); - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('City', 25); }) after(() => { diff --git a/scripts/cypress/integration/common/3c_lookup_column.js b/scripts/cypress/integration/common/3c_lookup_column.js index 051f901f46..49e00dbda1 100644 --- a/scripts/cypress/integration/common/3c_lookup_column.js +++ b/scripts/cypress/integration/common/3c_lookup_column.js @@ -20,9 +20,7 @@ export const genTest = (type, xcdb) => { before(() => { // open a table to work on views // - cy.openTableTab('City'); - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('City', 25); }) after(() => { diff --git a/scripts/cypress/integration/common/3d_rollup_column.js b/scripts/cypress/integration/common/3d_rollup_column.js index 898980d902..59c2b74399 100644 --- a/scripts/cypress/integration/common/3d_rollup_column.js +++ b/scripts/cypress/integration/common/3d_rollup_column.js @@ -20,9 +20,7 @@ export const genTest = (type, xcdb) => { before(() => { // open a table to work on views // - cy.openTableTab('Country'); - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('Country', 25); }) after(() => { 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 1bbadeb81e..4ed9be2549 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 @@ -13,9 +13,7 @@ export const genTest = (type, xcdb) => { before(() => { // open a table to work on views // - cy.openTableTab('Country'); - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('Country', 25); }) after(() => { diff --git a/scripts/cypress/integration/common/4b_table_view_share.js b/scripts/cypress/integration/common/4b_table_view_share.js index 5f13be660f..49ade215f7 100644 --- a/scripts/cypress/integration/common/4b_table_view_share.js +++ b/scripts/cypress/integration/common/4b_table_view_share.js @@ -35,9 +35,8 @@ export const genTest = (type, xcdb) => { // Run once before test- create project (rest/graphql) // before(() => { - cy.openTableTab('City') - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('City', 25) + // store base URL- to re-visit and delete form view later cy.url().then((url) => { storedURL = url diff --git a/scripts/cypress/integration/common/4c_form_view_detailed.js b/scripts/cypress/integration/common/4c_form_view_detailed.js index 119c35e23d..78c098b566 100644 --- a/scripts/cypress/integration/common/4c_form_view_detailed.js +++ b/scripts/cypress/integration/common/4c_form_view_detailed.js @@ -15,9 +15,7 @@ export const genTest = (type, xcdb) => { before(() => { // open a table to work on views // - cy.openTableTab('Country'); - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('Country', 25); }) beforeEach(() => { @@ -242,9 +240,7 @@ export const genTest = (type, xcdb) => { mainPage.configureSMTP('admin@ex.com', 'smtp.ex.com', '8080', 'TLS') // open form view & enable "email me" option - cy.openTableTab('Country'); - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('Country', 25); cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country1').click() cy.get('.nc-form > .mx-auto').find('[type="checkbox"]').eq(2).click({ force: true }) @@ -255,9 +251,7 @@ export const genTest = (type, xcdb) => { // reset SMPT config's mainPage.navigationDraw(mainPage.APPSTORE).click() mainPage.resetSMTP() - cy.openTableTab('Country'); - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('Country', 25); }) it(`Validate ${viewType}: Add/ remove field verification"`, () => { 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 6c1502a825..6f7b642f3b 100644 --- a/scripts/cypress/integration/common/4d_table_view_grid_locked.js +++ b/scripts/cypress/integration/common/4d_table_view_grid_locked.js @@ -11,9 +11,7 @@ export const genTest = (type, xcdb) => { before(() => { // open a table to work on views // - cy.openTableTab('Country'); - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('Country', 25); }) after(() => { diff --git a/scripts/cypress/integration/common/4e_form_view_share.js b/scripts/cypress/integration/common/4e_form_view_share.js index 1a782644f1..0fe2238d0e 100644 --- a/scripts/cypress/integration/common/4e_form_view_share.js +++ b/scripts/cypress/integration/common/4e_form_view_share.js @@ -16,9 +16,7 @@ export const genTest = (type, xcdb) => { before(() => { // open a table to work on views // - cy.openTableTab('City'); - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('City', 25) }) beforeEach(() => { diff --git a/scripts/cypress/integration/common/4f_grid_view_share.js b/scripts/cypress/integration/common/4f_grid_view_share.js index c9c7442ae2..b9dc5401e8 100644 --- a/scripts/cypress/integration/common/4f_grid_view_share.js +++ b/scripts/cypress/integration/common/4f_grid_view_share.js @@ -42,9 +42,7 @@ export const genTest = (type, xcdb) => { before(() => { // open a table to work on views // - cy.openTableTab('Address'); - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('Address', 25); cy.saveLocalStorage() }) @@ -82,7 +80,7 @@ export const genTest = (type, xcdb) => { it(`Share ${viewType.toUpperCase()} hide, sort, filter & verify`, () => { cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Address1').click() - mainPage.hideUnhideField('Address2') + mainPage.hideField('Address2') mainPage.sortField('District', 'Z -> A') mainPage.filterField('Address', 'is like', 'Ab') generateViewLink('combined') @@ -139,7 +137,7 @@ export const genTest = (type, xcdb) => { }) it(`Share ${viewType.toUpperCase()} view : verify download CSV`, () => { - mainPage.hideUnhideField('LastUpdate') + mainPage.hideField('LastUpdate') const verifyCsv = (retrievedRecords) => { // expected output, statically configured let storedRecords = [ @@ -162,7 +160,7 @@ export const genTest = (type, xcdb) => { // download & verify mainPage.downloadAndVerifyCsv(`Address_exported_1.csv`, verifyCsv) - mainPage.hideUnhideField('LastUpdate') + mainPage.unhideField('LastUpdate') }) it(`Share ${viewType.toUpperCase()} view : Disable sort`, () => { @@ -186,7 +184,7 @@ export const genTest = (type, xcdb) => { }) it(`Share ${viewType.toUpperCase()} view : verify download CSV after local filter`, () => { - mainPage.hideUnhideField('LastUpdate') + mainPage.hideField('LastUpdate') const verifyCsv = (retrievedRecords) => { // expected output, statically configured let storedRecords = [ @@ -208,7 +206,7 @@ export const genTest = (type, xcdb) => { } } mainPage.downloadAndVerifyCsv(`Address_exported_1.csv`, verifyCsv) - mainPage.hideUnhideField('LastUpdate') + mainPage.unhideField('LastUpdate') }) it(`Share ${viewType.toUpperCase()} view : Delete Filter`, () => { @@ -278,9 +276,7 @@ export const genTest = (type, xcdb) => { describe(`${type.toUpperCase()} api - Grid view/ row-column update verification`, () => { before(() => { // Address table has belongs to, has many & many-to-many - cy.openTableTab('Country') - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('Country', 25) cy.saveLocalStorage() // store base URL- to re-visit and delete form view later diff --git a/scripts/cypress/integration/common/5a_user_role.js b/scripts/cypress/integration/common/5a_user_role.js index c739782f6c..817eb0c467 100644 --- a/scripts/cypress/integration/common/5a_user_role.js +++ b/scripts/cypress/integration/common/5a_user_role.js @@ -116,7 +116,9 @@ export const genTest = (type, xcdb) => { }) it(`[${roles[roleType].name}] Download files`, () => { - mainPage.hideUnhideField('LastUpdate') + // #ID, City, LastUpdate, City => Address, Country <= City, + + mainPage.hideField('LastUpdate') + const verifyCsv = (retrievedRecords) => { // expected output, statically configured let storedRecords = [ @@ -135,7 +137,7 @@ export const genTest = (type, xcdb) => { // download & verify mainPage.downloadAndVerifyCsv(`City_exported_1.csv`, verifyCsv) - mainPage.hideUnhideField('LastUpdate') + mainPage.unhideField('LastUpdate') }) }) } diff --git a/scripts/cypress/integration/common/5b_preview_role.js b/scripts/cypress/integration/common/5b_preview_role.js index 6bed372c95..10b5ea05d7 100644 --- a/scripts/cypress/integration/common/5b_preview_role.js +++ b/scripts/cypress/integration/common/5b_preview_role.js @@ -40,9 +40,7 @@ export const genTest = (type, xcdb, roleType) => { it(`Role preview: ${roleType}: Enable preview`, () => { cy.get(`.nc-preview-${roleType}`).click() - cy.openTableTab('City') - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('City', 25) }) it(`Role preview: ${roleType}: Advance settings`, () => { diff --git a/scripts/cypress/integration/common/6b_downloadCsv.js b/scripts/cypress/integration/common/6b_downloadCsv.js index c96e3f11d5..2a64b77b56 100644 --- a/scripts/cypress/integration/common/6b_downloadCsv.js +++ b/scripts/cypress/integration/common/6b_downloadCsv.js @@ -9,7 +9,7 @@ export const genTest = (type, xcdb) => { describe(`${type.toUpperCase()} Upload/ Download CSV`, () => { before(() => { // loginPage.loginAndOpenProject(type) - cy.openTableTab('Country'); + cy.openTableTab('Country', 25); }) after(() => { @@ -17,7 +17,7 @@ export const genTest = (type, xcdb) => { }) it('Download verification- base view, default columns', () => { - mainPage.hideUnhideField('LastUpdate') + mainPage.hideField('LastUpdate') const verifyCsv = (retrievedRecords) => { // expected output, statically configured let storedRecords = [ @@ -36,7 +36,7 @@ export const genTest = (type, xcdb) => { // download & verify mainPage.downloadAndVerifyCsv(`Country_exported_1.csv`, verifyCsv) - mainPage.hideUnhideField('LastUpdate') + mainPage.unhideField('LastUpdate') }) }) } diff --git a/scripts/cypress/integration/common/6f_attachments.js b/scripts/cypress/integration/common/6f_attachments.js index c3fe4047ed..a2c8faaed7 100644 --- a/scripts/cypress/integration/common/6f_attachments.js +++ b/scripts/cypress/integration/common/6f_attachments.js @@ -8,9 +8,7 @@ export const genTest = (type, xcdb) => { describe(`${type.toUpperCase()} Columns of type attachment`, () => { before(() => { loginPage.loginAndOpenProject(type) - cy.openTableTab('Country'); - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('Country', 25); }) after(() => { @@ -86,12 +84,10 @@ export const genTest = (type, xcdb) => { it(`Filter column which contain only attachments, download CSV`, () => { // come back to main window loginPage.loginAndOpenProject(type) - cy.openTableTab('Country'); - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab('Country', 25); mainPage.filterField('testAttach', 'is not null', null) - mainPage.hideUnhideField('LastUpdate') + mainPage.hideField('LastUpdate') const verifyCsv = (retrievedRecords) => { let storedRecords = [ @@ -111,7 +107,7 @@ export const genTest = (type, xcdb) => { } mainPage.downloadAndVerifyCsv(`Country_exported_1.csv`, verifyCsv) - mainPage.hideUnhideField('LastUpdate') + mainPage.unhideField('LastUpdate') mainPage.filterReset() }) }) diff --git a/scripts/cypress/integration/common/7a_create_project_from_excel.js b/scripts/cypress/integration/common/7a_create_project_from_excel.js index 83ae275b1f..d729a9e5fb 100644 --- a/scripts/cypress/integration/common/7a_create_project_from_excel.js +++ b/scripts/cypress/integration/common/7a_create_project_from_excel.js @@ -163,14 +163,14 @@ export const genTest = (type, xcdb) => { // 0: { float: 1.1, number: 1, text: "abc" } // 1: { float: 1.2, number: 0, text: "def" } - cy.openTableTab('Sheet2') + cy.openTableTab('Sheet2', 2) for (const [key, value] of Object.entries(expectedData)) { mainPage.getCell(value[0], 1).contains(sheetData[0][value[0]]).should('exist') mainPage.getCell(value[0], 2).contains(sheetData[1][value[0]]).should('exist') } cy.closeTableTab('Sheet2') - cy.openTableTab('Sheet3') + cy.openTableTab('Sheet3', 2) for (const [key, value] of Object.entries(expectedData)) { mainPage.getCell(value[0], 1).contains(sheetData[0][value[0]]).should('exist') mainPage.getCell(value[0], 2).contains(sheetData[1][value[0]]).should('exist') @@ -261,7 +261,7 @@ export const genTest = (type, xcdb) => { // 0: { float: 1.1, number: 1, text: "abc" } // 1: { float: 1.2, number: 0, text: "def" } - cy.openTableTab('Sheet1') + cy.openTableTab('Sheet1', 25) let idx = 0 for (const [key, value] of Object.entries(UrlFileExpectedData)) { if(UrlFileExpectedData[idx][1] != 'Date') diff --git a/scripts/cypress/integration/spec/roleValidation.spec.js b/scripts/cypress/integration/spec/roleValidation.spec.js index 4fd685df20..7812f2a490 100644 --- a/scripts/cypress/integration/spec/roleValidation.spec.js +++ b/scripts/cypress/integration/spec/roleValidation.spec.js @@ -40,10 +40,8 @@ export function _editSchema(roleType, previewMode) { let validationString = (true == roles[roleType].validations.editSchema) ? 'exist' : 'not.exist' if (false == previewMode) { - cy.openTableTab(columnName) + cy.openTableTab(columnName, 25) } - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) // create table options // @@ -69,9 +67,7 @@ export function _editData(roleType, previewMode) { let columnName = 'City' let validationString = (true == roles[roleType].validations.editData) ? 'exist' : 'not.exist' - cy.openTableTab(columnName) - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab(columnName, 25) // add new row option (from menu header) // @@ -123,9 +119,7 @@ export function _editComment(roleType, previewMode) { let columnName = 'City' let validationString = (true == roles[roleType].validations.editComment) ? 'Comment added successfully' : 'Not allowed' - cy.openTableTab(columnName) - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab(columnName, 25) // click on comment icon & type comment // @@ -161,9 +155,7 @@ export function _viewMenu(roleType, previewMode) { let columnName = 'City' let navDrawListCnt = 2 - cy.openTableTab(columnName) - // wait for page rendering to complete - cy.get('.nc-grid-row').should('have.length', 25) + cy.openTableTab(columnName, 25) let validationString = (true == roles[roleType].validations.shareView) ? 'exist' : 'not.exist' diff --git a/scripts/cypress/support/commands.js b/scripts/cypress/support/commands.js index d81e76a0b6..00b6d121ea 100644 --- a/scripts/cypress/support/commands.js +++ b/scripts/cypress/support/commands.js @@ -105,8 +105,9 @@ Cypress.Commands.add('openOrCreateRestProject', (_args) => { } ) - -Cypress.Commands.add('openTableTab', (tn) => { +// tn: table name +// rc: row count. validate row count if rc!=0 +Cypress.Commands.add('openTableTab', (tn, rc) => { cy.get('.nc-project-tree') .find('.v-list-item__title:contains(Tables)', { timeout: 10000 }) .should('exist') @@ -124,7 +125,10 @@ Cypress.Commands.add('openTableTab', (tn) => { .find('.v-list-item__title:contains(Tables)', { timeout: 10000 }) .first().click() - // wait for page to load + // wait for page rendering to complete + if (rc != 0) { + cy.get('.nc-grid-row').should('have.length', rc) + } }) Cypress.Commands.add('closeTableTab', (tn) => { diff --git a/scripts/cypress/support/page_objects/mainPage.js b/scripts/cypress/support/page_objects/mainPage.js index 0819e1b547..9ccad6a306 100644 --- a/scripts/cypress/support/page_objects/mainPage.js +++ b/scripts/cypress/support/page_objects/mainPage.js @@ -198,12 +198,22 @@ export class _mainPage { cy.toastWait('Plugin uninstalled successfully') } - hideUnhideField = (field) => { + hideField = (field) => { + cy.get('.nc-grid-header-cell').contains(field).should('be.visible') cy.get('.nc-fields-menu-btn').click() cy.get(`.menuable__content__active .v-list-item label:contains(${field})`).click() cy.get('.nc-fields-menu-btn').click() + cy.get('.nc-grid-header-cell').contains(field).should('not.be.visible') } + unhideField = (field) => { + cy.get('.nc-grid-header-cell').contains(field).should('not.be.visible') + cy.get('.nc-fields-menu-btn').click() + cy.get(`.menuable__content__active .v-list-item label:contains(${field})`).click() + cy.get('.nc-fields-menu-btn').click() + cy.get('.nc-grid-header-cell').contains(field).should('be.visible') + } + sortField = (field, criteria) => { cy.get('.nc-sort-menu-btn').click() cy.contains('Add Sort Option').click();