Browse Source

test(cypress): hide/unhide field & openTableTab retry-ability

Signed-off-by: Raju Udava <sivadstala@gmail.com>
pull/865/head
Raju Udava 3 years ago
parent
commit
2d0be9e4d6
  1. 8
      scripts/cypress/integration/common/1a_table_operations.js
  2. 5
      scripts/cypress/integration/common/2a_table_with_belongs_to_colulmn.js
  3. 5
      scripts/cypress/integration/common/2b_table_with_m2m_column.js
  4. 4
      scripts/cypress/integration/common/3a_filter_sort_fields_operations.js
  5. 4
      scripts/cypress/integration/common/3b_formula_column.js
  6. 4
      scripts/cypress/integration/common/3c_lookup_column.js
  7. 4
      scripts/cypress/integration/common/3d_rollup_column.js
  8. 4
      scripts/cypress/integration/common/4a_table_view_grid_gallery_form.js
  9. 5
      scripts/cypress/integration/common/4b_table_view_share.js
  10. 12
      scripts/cypress/integration/common/4c_form_view_detailed.js
  11. 4
      scripts/cypress/integration/common/4d_table_view_grid_locked.js
  12. 4
      scripts/cypress/integration/common/4e_form_view_share.js
  13. 18
      scripts/cypress/integration/common/4f_grid_view_share.js
  14. 6
      scripts/cypress/integration/common/5a_user_role.js
  15. 4
      scripts/cypress/integration/common/5b_preview_role.js
  16. 6
      scripts/cypress/integration/common/6b_downloadCsv.js
  17. 12
      scripts/cypress/integration/common/6f_attachments.js
  18. 6
      scripts/cypress/integration/common/7a_create_project_from_excel.js
  19. 16
      scripts/cypress/integration/spec/roleValidation.spec.js
  20. 10
      scripts/cypress/support/commands.js
  21. 12
      scripts/cypress/support/page_objects/mainPage.js

8
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')

5
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(() => {

5
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(() => {

4
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(() => {

4
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(() => {

4
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(() => {

4
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(() => {

4
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(() => {

5
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

12
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"`, () => {

4
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(() => {

4
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(() => {

18
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

6
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')
})
})
}

4
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`, () => {

6
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')
})
})
}

12
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()
})
})

6
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')

16
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'

10
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) => {

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

@ -198,10 +198,20 @@ 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) => {

Loading…
Cancel
Save