Browse Source

test(cypress) retry-ability, remove static delays- phase:1/5

Signed-off-by: Raju Udava <sivadstala@gmail.com>
pull/865/head
Raju Udava 3 years ago
parent
commit
4e51b87186
  1. 1
      scripts/cypress/integration/common/00_pre_configurations.js
  2. 23
      scripts/cypress/integration/common/1a_table_operations.js
  3. 22
      scripts/cypress/integration/common/1b_table_column_operations.js
  4. 37
      scripts/cypress/integration/common/2a_table_with_belongs_to_colulmn.js
  5. 44
      scripts/cypress/integration/common/2b_table_with_m2m_column.js
  6. 37
      scripts/cypress/integration/common/3a_filter_sort_fields_operations.js
  7. 17
      scripts/cypress/integration/common/3b_formula_column.js
  8. 10
      scripts/cypress/integration/common/3c_lookup_column.js
  9. 17
      scripts/cypress/integration/common/3d_rollup_column.js
  10. 1
      scripts/cypress/integration/test/restTableOps.js
  11. 22
      scripts/cypress/support/commands.js
  12. 1
      scripts/cypress/support/page_objects/mainPage.js

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

@ -14,7 +14,6 @@ export const genTest = (type, xcdb) => {
cy.task('log', 'This will be output to the terminal')
cy.waitForSpinners();
cy.signinOrSignup(roles.owner.credentials)
cy.wait(2000)
})
const createProject = (proj) => {

23
scripts/cypress/integration/common/1a_table_operations.js

@ -1,5 +1,4 @@
import { loginPage } from "../../support/page_objects/navigation";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { mainPage } from "../../support/page_objects/mainPage";
@ -9,7 +8,6 @@ export const genTest = (type, xcdb) => {
describe(`${xcdb ? 'Meta - ' : ''}${type.toUpperCase()} api - Table`, () => {
before(() => {
//loginPage.loginAndOpenProject(type, xcdb)
cy.get('.mdi-close').click({ multiple: true })
})
@ -36,7 +34,10 @@ export const genTest = (type, xcdb) => {
it('Open Audit tab', ()=> {
mainPage.navigationDraw(mainPage.AUDIT).click()
cy.wait(2000)
// wait for column headers to appear
//
cy.get('thead > tr > th.caption').should('have.length', 5)
// Audit table entries
// [Header] Operation Type, Operation Sub Type, Description, User, Created
@ -76,17 +77,19 @@ export const genTest = (type, xcdb) => {
// 4. verify linked contents in other table
// 4a. Address table, has many field
cy.openTableTab('Address')
cy.wait(2000).then(() => {
mainPage.getCell('City <= Address', 1).scrollIntoView()
mainPage.getCell('City <= Address', 1).find('.name').contains('Lethbridge').should('exist')
})
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 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')
cy.wait(2000).then(() => {
mainPage.getCell('Country => City', 1).find('.name').contains('Kabul').should('exist')
})
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 25)
mainPage.getCell('Country => City', 1).find('.name').contains('Kabul').should('exist')
cy.closeTableTab('Country')
// revert re-name operation to not impact rest of test suite

22
scripts/cypress/integration/common/1b_table_column_operations.js

@ -1,5 +1,4 @@
import { loginPage } from "../../support/page_objects/navigation"
import { mainPage } from "../../support/page_objects/mainPage"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
@ -14,7 +13,6 @@ export const genTest = (type, xcdb) => {
const updatedRandVal = 'Updated@1234.com'
before(() => {
// loginPage.loginAndOpenProject(type)
cy.createTable(name)
});
@ -28,9 +26,6 @@ export const genTest = (type, xcdb) => {
mainPage.addColumn(colName)
cy.get(`th:contains(${colName})`).should('exist');
// wait for pop up's to exit
cy.wait(3000)
})
// edit the newly created column
@ -46,6 +41,8 @@ export const genTest = (type, xcdb) => {
cy.contains('LongText').click()
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy.toastWait('Update table.tablex successful')
cy.get(`th[data-col="${colName}"] .mdi-text-subject`).should('exist')
cy.get(`th:contains(${colName}) .mdi-menu-down`)
@ -67,7 +64,7 @@ export const genTest = (type, xcdb) => {
cy.get('.nc-column-name-input input').clear().type(updatedColName)
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy.wait(3000)
cy.toastWait('Update table.tablex successful')
cy.get(`th:contains(${colName})`).should('not.exist')
cy.get(`th:contains(${updatedColName})`).should('exist')
@ -83,18 +80,18 @@ export const genTest = (type, xcdb) => {
cy.get('.nc-column-delete').click()
cy.get('button:contains(Confirm)').click()
cy.toastWait('Update table.tablex successful')
cy.get(`th:contains(${updatedColName})`).should('not.exist');
})
it('Add new row', () => {
cy.wait(2000)
cy.get('.nc-add-new-row-btn:visible').should('exist')
cy.get('.nc-add-new-row-btn').click({force: true});
cy.get('#data-table-form-Title > input').first().type(randVal);
cy.getActiveModal().find('button').contains('Save Row').click({ force: true })
// kludge- add delay to ensure previous operations are completed
cy.wait(2000)
cy.toastWait('updated successfully')
mainPage.getCell('Title', 1).contains(randVal).should('exist')
})
@ -103,7 +100,7 @@ export const genTest = (type, xcdb) => {
cy.get('#data-table-form-Title > input').first().clear().type(updatedRandVal);
cy.getActiveModal().find('button').contains('Save Row').click({force: true})
cy.wait(3000)
cy.toastWait('updated successfully')
mainPage.getCell('Title', 1).contains(randVal).should('not.exist')
mainPage.getCell('Title', 1).contains(updatedRandVal).should('exist')
@ -114,15 +111,12 @@ export const genTest = (type, xcdb) => {
// delete row
cy.getActiveMenu().find('.v-list-item:contains("Delete Row")').first().click({force: true})
cy.wait(1000)
cy.toastWait('Deleted row successfully')
cy.get('td').contains(randVal).should('not.exist');
})
})
}
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*

37
scripts/cypress/integration/common/2a_table_with_belongs_to_colulmn.js

@ -1,16 +1,22 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Table: belongs to, link record`, () => {
// before(() => loginPage.loginAndOpenProject(type))
it('Table column header, URL validation', () => {
before(() => {
cy.openTableTab('Country')
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 25)
})
after(() => {
cy.closeTableTab('Country')
})
it('Table column header, URL validation', () => {
// column name validation
cy.get(`.project-tab:contains(Country):visible`).should('exist')
// URL validation
@ -18,7 +24,6 @@ export const genTest = (type, xcdb) => {
})
it('Expand belongs-to column', () => {
// expand first row
cy.get('td[data-col="Country => City"] div:visible', {timeout: 12000}).first().click()
cy.get('td[data-col="Country => City"] div .mdi-arrow-expand:visible').first().click()
@ -26,25 +31,21 @@ export const genTest = (type, xcdb) => {
it('Expand Link record, validate', () => {
cy.getActiveModal().find('button:contains(Link to \'City\')').click()
cy.wait(1000)
// Link record form validation
cy.getActiveModal().contains('Link Record').should('exist')
cy.getActiveModal().find('button.mdi-reload').should('exist')
cy.getActiveModal().find('button:contains("New Record")').should('exist')
cy.getActiveModal().find('.child-card').eq(0).contains('A Corua (La Corua)').should('exist')
.then(() => {
// Link record form validation
cy.getActiveModal().contains('Link Record').should('exist')
cy.getActiveModal().find('button.mdi-reload').should('exist')
cy.getActiveModal().find('button:contains("New Record")').should('exist')
cy.getActiveModal().find('.child-card').eq(0).contains('A Corua (La Corua)').should('exist')
cy.getActiveModal().find('button.mdi-close').click()
cy.wait(200)
cy.getActiveModal().find('button.mdi-close').click()
cy.getActiveModal().find('button.mdi-close').click().then(() => {
cy.getActiveModal().find('button.mdi-close').click()
})
})
})
})
}
// genTest('rest')
// genTest('graphql')
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*

44
scripts/cypress/integration/common/2b_table_with_m2m_column.js

@ -1,5 +1,4 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
export const genTest = (type, xcdb) => {
@ -7,8 +6,9 @@ export const genTest = (type, xcdb) => {
describe(`${type.toUpperCase()} api - M2M Column validation`, () => {
before(() => {
// loginPage.loginAndOpenProject(type)
cy.openTableTab('Actor')
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 25)
})
after(() => {
@ -20,7 +20,7 @@ export const genTest = (type, xcdb) => {
// column name validation
cy.get(`.project-tab:contains(Actor):visible`).should('exist')
// URL validation
cy.url().should('contain', `?name=Actor&`)
cy.url().should('contain', `name=Actor`)
})
it('Expand m2m column', () => {
@ -38,35 +38,31 @@ export const genTest = (type, xcdb) => {
it('Expand "Link to" record, validate', () => {
cy.getActiveModal().find('button:contains(Link to \'Film\')').click()
cy.wait(1000)
// Link record form validation
cy.getActiveModal().contains('Link Record').should('exist')
cy.getActiveModal().find('button.mdi-reload').should('exist')
cy.getActiveModal().find('button:contains("New Record")').should('exist')
cy.getActiveModal().find('.child-card').eq(0).contains('ACE GOLDFINGER').should('exist')
cy.get('body').type('{esc}')
.then(() => {
// Link record form validation
cy.getActiveModal().contains('Link Record').should('exist')
cy.getActiveModal().find('button.mdi-reload').should('exist')
cy.getActiveModal().find('button:contains("New Record")').should('exist')
cy.getActiveModal().find('.child-card').eq(0).contains('ACE GOLDFINGER').should('exist')
cy.get('body').type('{esc}')
})
})
it('Expand first linked card, validate', () => {
cy.getActiveModal().find('.child-card').eq(0).contains('ACADEMY DINOSAUR', {timeout: 2000}).click()
cy.wait(1000)
// Link card validation
cy.getActiveModal().find('h5').contains("ACADEMY DINOSAUR").should('exist')
cy.getActiveModal().find('button:contains("Save Row")').should('exist')
cy.getActiveModal().find('button:contains("Cancel")').should('exist')
cy.getActiveModal().find('button:contains("Cancel")').click()
cy.getActiveModal().find('button.mdi-close').click()
.then(() => {
// Link card validation
cy.getActiveModal().find('h5').contains("ACADEMY DINOSAUR").should('exist')
cy.getActiveModal().find('button:contains("Save Row")').should('exist')
cy.getActiveModal().find('button:contains("Cancel")').should('exist')
cy.getActiveModal().find('button:contains("Cancel")').click()
cy.getActiveModal().find('button.mdi-close').click()
})
})
})
}
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*

37
scripts/cypress/integration/common/3a_filter_sort_fields_operations.js

@ -1,6 +1,5 @@
import { mainPage } from "../../support/page_objects/mainPage"
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
export const genTest = (type, xcdb) => {
@ -8,12 +7,10 @@ export const genTest = (type, xcdb) => {
describe(`${type.toUpperCase()} api - Filter, Fields, Sort`, () => {
before(() => {
// loginPage.loginAndOpenProject(type)
// open country table
cy.openTableTab('Country');
cy.wait(2000)
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 25)
})
after(() => {
@ -46,6 +43,8 @@ export const genTest = (type, xcdb) => {
cy.get('#data-table-form-Country > input').first().type('Test Country');
cy.contains('Save Row').filter('button').click()
cy.toastWait('updated successfully')
// verify
mainPage.getPagination(5).click()
mainPage.getCell("Country", 10).contains("Test Country").should('exist')
@ -58,6 +57,8 @@ export const genTest = (type, xcdb) => {
mainPage.getCell("Country", 10).rightclick()
cy.getActiveMenu().contains('Delete Row').click()
cy.toastWait('Deleted row successfully')
// verify
mainPage.getCell("Country", 10).should('not.exist')
})
@ -65,19 +66,18 @@ export const genTest = (type, xcdb) => {
// create new row using right click menu option
//
it('Add row using rightclick menu option', () => {
// mainPage.getPagination(5).click({ force: true })
// wait before proceeding further to ensure reload is completed
// cy.wait(1000)
mainPage.getCell("Country", 9).rightclick({force: true})
cy.getActiveMenu().contains('Insert New Row').click({force: true})
mainPage.getCell("Country", 10).dblclick().find('input').type('Test Country-1{enter}')
cy.toastWait('saved successfully')
mainPage.getCell("Country", 10).rightclick({force: true})
cy.getActiveMenu().contains('Insert New Row').click({force: true})
mainPage.getCell("Country", 11).dblclick().find('input').type('Test Country-2{enter}')
cy.toastWait('saved successfully')
// verify
mainPage.getCell("Country", 10).contains("Test Country-1").should('exist')
mainPage.getCell("Country", 11).contains("Test Country-2").should('exist')
@ -92,11 +92,12 @@ export const genTest = (type, xcdb) => {
mainPage.getCell("Country", 10).rightclick({force: true})
cy.getActiveMenu().contains('Delete Selected Row').click({force: true})
cy.toastWait('Deleted selected rows successfully')
// verify
mainPage.getCell("Country", 10).should('not.exist')
mainPage.getCell("Country", 11).should('not.exist')
cy.wait(1000)
mainPage.getPagination(1).click()
})
@ -126,9 +127,6 @@ export const genTest = (type, xcdb) => {
describe('Field Operation', () => {
// before(() => {
// cy.get('.nc-fields-menu-btn').click()
// })
it('Hide field', () => {
cy.get('th:contains(LastUpdate)').should('be.visible')
@ -159,18 +157,16 @@ export const genTest = (type, xcdb) => {
cy.get('.nc-filter-operation-select').last().click();
cy.getActiveMenu().find('.v-list-item:contains("is equal")').click()
cy.get('.nc-filter-value-select input:text').last().type('India');
// cy.getActiveMenu().find('button:contains("Apply changes")').click()
cy.get('.nc-filter-menu-btn').click()
cy.wait(1000)
cy.get('td:contains(India)').should('exist')
.then(() => {
cy.get('td:contains(India)').should('exist')
})
})
it('Delete Filter', () => {
// remove sort and check
cy.get('.nc-filter-menu-btn').click()
cy.get('.nc-filter-item-remove-btn').click()
// cy.getActiveMenu().find('button:contains("Apply changes")').click()
cy.get('.nc-filter-menu-btn').click()
cy.contains('td:contains(India)').should('not.exist')
})
@ -178,9 +174,6 @@ export const genTest = (type, xcdb) => {
})
}
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*

17
scripts/cypress/integration/common/3b_formula_column.js

@ -1,5 +1,4 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
export const genTest = (type, xcdb) => {
@ -10,11 +9,11 @@ export const genTest = (type, xcdb) => {
// Run once before test- create project (rest/graphql)
//
before(() => {
// loginPage.loginAndOpenProject(type)
// 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)
})
after(() => {
@ -58,14 +57,13 @@ export const genTest = (type, xcdb) => {
// click on Save
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy.wait(1000)
cy.toastWait('Formula column saved successfully')
// Verify if column exists.
//
cy.get(`th:contains(${columnName})`)
.should('exist');
cy.wait(500)
}
// routine to delete column
@ -88,7 +86,6 @@ export const genTest = (type, xcdb) => {
// validate if deleted (column shouldnt exist)
cy.get(`th:contains(${columnName})`)
.should('not.exist');
}
@ -114,6 +111,8 @@ export const genTest = (type, xcdb) => {
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy.toastWait('Formula column updated successfully')
// validate if deleted (column shouldnt exist)
cy.get(`th:contains(${oldName})`)
.should('not.exist');
@ -189,10 +188,6 @@ export const genTest = (type, xcdb) => {
})
}
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*

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

@ -1,5 +1,4 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
export const genTest = (type, xcdb) => {
@ -19,11 +18,11 @@ export const genTest = (type, xcdb) => {
// Run once before test- create project (rest/graphql)
//
before(() => {
// loginPage.loginAndOpenProject(type)
// 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)
})
after(() => {
@ -55,14 +54,11 @@ export const genTest = (type, xcdb) => {
// click on Save
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy.wait(1000)
// Verify if column exists.
//
cy.get(`th:contains(${childCol})`)
.should('exist');
cy.wait(500)
}
// routine to delete column
@ -114,9 +110,7 @@ export const genTest = (type, xcdb) => {
.should('exist')
deleteColumnByName('CountryId')
})
});
}

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

@ -1,4 +1,4 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
export const genTest = (type, xcdb) => {
@ -18,11 +18,11 @@ export const genTest = (type, xcdb) => {
// Run once before test- create project (rest/graphql)
//
before(() => {
// loginPage.loginAndOpenProject(type)
// 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)
})
after(() => {
@ -58,14 +58,11 @@ export const genTest = (type, xcdb) => {
// click on Save
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy.wait(1000)
// Verify if column exists.
//
cy.get(`th:contains(${columnName})`)
.should('exist');
cy.wait(500)
}
// routine to delete column
@ -88,7 +85,6 @@ export const genTest = (type, xcdb) => {
// validate if deleted (column shouldnt exist)
cy.get(`th:contains(${columnName})`)
.should('not.exist');
}
@ -110,12 +106,13 @@ export const genTest = (type, xcdb) => {
cy.get('.nc-column-name-input input').clear().type(newName)
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy.toastWait('Successfully updated alias')
// validate if deleted (column shouldnt exist)
cy.get(`th:contains(${oldName})`)
.should('not.exist');
cy.get(`th:contains(${newName})`)
.should('exist');
}
///////////////////////////////////////////////////
@ -151,13 +148,9 @@ export const genTest = (type, xcdb) => {
deleteColumnByName('RollUpCol_New')
})
});
}
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

1
scripts/cypress/integration/test/restTableOps.js

@ -24,7 +24,6 @@ const nocoTestSuite = (type, xcdb) => {
t1a.genTest(type, xcdb)
t1b.genTest(type, xcdb)
// merged with t1b: t1c.genTest(type, xcdb)
t2a.genTest(type, xcdb)
t2b.genTest(type, xcdb)
t3a.genTest(type, xcdb)

22
scripts/cypress/support/commands.js

@ -67,6 +67,9 @@ Cypress.Commands.add('signinOrSignup', (_args) => {
}
})
})
// indicates page-load complete
cy.get('.nc-noco-brand-icon', { timeout: 12000 }).should('exist')
});
// for opening/creating a rest project
@ -193,9 +196,9 @@ Cypress.Commands.add('createTable', (name) => {
cy.get('.nc-create-table-card .nc-table-name input[type="text"]').first().click().clear().type(name)
cy.get('.nc-create-table-card .nc-table-name-alias input[type="text"]').first().should('have.value', name.toLowerCase())
cy.get('.nc-create-table-card .nc-create-table-submit').first().click()
cy.toastWait(`Create table.${name} successful`)
cy.get(`.project-tab:contains(${name})`).should('exist')
cy.url().should('contain', `name=${name}`)
cy.wait(3000)
})
Cypress.Commands.add('deleteTable', (name) => {
@ -205,7 +208,7 @@ Cypress.Commands.add('deleteTable', (name) => {
cy.get(`.project-tab:contains(${name}):visible`).should('exist')
cy.get('.nc-table-delete-btn:visible').click()
cy.get('button:contains(Submit)').click()
cy.get(`.project-tab:contains(${name}):visible`).first().should('not.exist')
cy.toastWait(`Delete table.${name} successful`)
})
Cypress.Commands.add('renameTable', (oldName, newName) => {
@ -238,15 +241,15 @@ Cypress.Commands.add('renameTable', (oldName, newName) => {
.find('button')
.contains('Submit')
.click()
cy.toastWait('Table renamed successfully')
// close expanded project tree
cy.get('.nc-project-tree')
.find('.v-list-item__title:contains(Tables)', { timeout: 10000 })
.first()
.click()
cy.wait(2000)
})
})
Cypress.Commands.add('createColumn', (table, columnName) => {
cy.get('.nc-project-tree').find('.v-list-item__title:contains(Tables)', {timeout: 10000})
@ -261,6 +264,15 @@ Cypress.Commands.add('createColumn', (table, columnName) => {
.should('exist');
})
Cypress.Commands.add('toastWait', (msg) => {
cy.get('.toasted:visible', { timout: 6000 })
.contains(msg)
.should('exist')
cy.get('.toasted:visible', { timout: 6000 })
.contains(msg)
.should('not.exist')
})
// Drag n Drop
// refer: https://stackoverflow.com/a/55409853

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

@ -154,6 +154,7 @@ export class _mainPage {
cy.get('.v-window-item--active .nc-grid tr > th:last button').click({ force: true });
cy.get('.nc-column-name-input input', { timeout: 3000 }).clear().type(colName)
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy.toastWait('Update table.tablex successful')
}
addColumnWithType = (colName, colType) => {

Loading…
Cancel
Save