Browse Source

test: [cypress] stability & error scenario handling

Signed-off-by: Raju Udava <sivadstala@gmail.com>
pull/559/head
Raju Udava 3 years ago
parent
commit
f246c7f87c
  1. 39
      cypress/integration/common/1a_table_operations.js
  2. 25
      cypress/integration/common/3a_filter_sort_fields_operations.js
  3. 2
      cypress/integration/common/3d_rollup_column.js
  4. 4
      cypress/integration/common/4a_table_view_grid_gallery.js
  5. 2
      cypress/integration/common/4b_table_view_share.js
  6. 21
      cypress/integration/common/5a_user_role.js
  7. 2
      cypress/integration/common/5b_preview_role.js
  8. 10
      cypress/support/page_objects/navigation.js

39
cypress/integration/common/1a_table_operations.js

@ -1,27 +1,12 @@
import { loginPage, projectsPage } from "../../support/page_objects/navigation"; import { loginPage } from "../../support/page_objects/navigation";
import { roles, staticProjects } from "../../support/page_objects/projectConstants";
const genTest = (type, meta) => { const genTest = (type, xcdb) => {
describe(`${meta ? 'Meta - ' : ''}${type.toUpperCase()} api - Table`, () => { describe(`${xcdb ? 'Meta - ' : ''}${type.toUpperCase()} api - Table`, () => {
before(() => { before(() => {
loginPage.signIn(roles.owner.credentials) loginPage.loginAndOpenProject(type, xcdb)
if(!meta)
{
if(type=='rest')
projectsPage.openProject(staticProjects.externalREST.basic.name)
else
projectsPage.openProject(staticProjects.externalGQL.basic.name)
}
else
{
if(type=='rest')
projectsPage.openProject(staticProjects.sampleREST.basic.name)
else
projectsPage.openProject(staticProjects.sampleGQL.basic.name)
}
}) })
const name = 'Test' + Date.now(); const name = 'Test' + Date.now();
@ -29,16 +14,20 @@ const genTest = (type, meta) => {
// create a new random table // create a new random table
it('Create Table', () => { it('Create Table', () => {
cy.get('.add-btn').click(); cy.get('.add-btn').click();
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 input[type="text"]')
if (!meta) { .first().click().clear().type(name)
cy.get('.nc-create-table-card .nc-table-name-alias input[type="text"]').first().should('have.value', name.toLowerCase())
if (!xcdb) {
cy.get('.nc-create-table-card .nc-table-name-alias input[type="text"]')
.first().should('have.value', name.toLowerCase())
} }
cy.wait(5000) cy.wait(5000)
cy.get('.nc-create-table-card .nc-create-table-submit').first().click() cy.get('.nc-create-table-card .nc-create-table-submit').first().click()
cy.get(`.project-tab:contains(${name})`).should('exist') cy.get(`.project-tab:contains(${name})`).should('exist')
cy.url().should('contain', `?name=${name}&`) cy.url().should('contain', `?name=${name}&`)
cy.wait(3000) cy.wait(5000)
}) })
@ -58,8 +47,8 @@ const genTest = (type, meta) => {
} }
genTest('rest') genTest('rest', false)
genTest('graphql') genTest('graphql', false)
genTest('rest', true) genTest('rest', true)
genTest('graphql', true) genTest('graphql', true)

25
cypress/integration/common/3a_filter_sort_fields_operations.js

@ -86,6 +86,9 @@ const genTest = (type) => {
// verify // verify
mainPage.getCell("Country", 10).should('not.exist') mainPage.getCell("Country", 10).should('not.exist')
mainPage.getCell("Country", 11).should('not.exist') mainPage.getCell("Country", 11).should('not.exist')
cy.wait(1000)
mainPage.getPagination(1).click()
}) })
}) })
@ -114,20 +117,24 @@ const genTest = (type) => {
describe('Field Operation', () => { describe('Field Operation', () => {
before(() => { // before(() => {
cy.get('.nc-fields-menu-btn').click() // cy.get('.nc-fields-menu-btn').click()
}) // })
if ('Hide field', () => { it('Hide field', () => {
cy.get('th:contains(LastUpdate)').should('be.visible') cy.get('th:contains(LastUpdate)').should('be.visible')
// toggle and confirm it's hidden // toggle and confirm it's hidden
cy.get('.nc-fields-menu-btn').click()
cy.get('.menuable__content__active .v-list-item label:contains(LastUpdate)').click() cy.get('.menuable__content__active .v-list-item label:contains(LastUpdate)').click()
cy.get('.nc-fields-menu-btn').click()
cy.get('th:contains(LastUpdate)').should('not.be.visible') cy.get('th:contains(LastUpdate)').should('not.be.visible')
}) })
it('Show field', () => { it('Show field', () => {
cy.get('.nc-fields-menu-btn').click()
cy.get('.menuable__content__active .v-list-item label:contains(LastUpdate)').click() cy.get('.menuable__content__active .v-list-item label:contains(LastUpdate)').click()
cy.get('.nc-fields-menu-btn').click()
cy.get('th:contains(LastUpdate)').should('be.visible') cy.get('th:contains(LastUpdate)').should('be.visible')
}) })
}) })
@ -139,17 +146,23 @@ const genTest = (type) => {
cy.contains('Add Filter').click(); cy.contains('Add Filter').click();
cy.get('.nc-filter-field-select').last().click(); cy.get('.nc-filter-field-select').last().click();
cy.get('.menuable__content__active .v-list-item:contains(Country)').click() cy.getActiveMenu().find('.v-list-item:contains(Country)').click()
cy.get('.nc-filter-operation-select').last().click(); cy.get('.nc-filter-operation-select').last().click();
cy.get('.menuable__content__active .v-list-item:contains("is equal")').click() cy.getActiveMenu().find('.v-list-item:contains("is equal")').click()
cy.get('.nc-filter-value-select input:text').last().type('India'); 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') cy.get('td:contains(India)').should('exist')
}) })
it('Delete Filter', () => { it('Delete Filter', () => {
// remove sort and check // remove sort and check
cy.get('.nc-filter-menu-btn').click()
cy.get('.nc-filter-item-remove-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') cy.contains('td:contains(India)').should('not.exist')
}) })
}) })

2
cypress/integration/common/3d_rollup_column.js

@ -1,3 +1,5 @@
import { loginPage } from "../../support/page_objects/navigation"
const genTest = (type) => { const genTest = (type) => {
describe(`${type.toUpperCase()} api - RollUp column`, () => { describe(`${type.toUpperCase()} api - RollUp column`, () => {

4
cypress/integration/common/4a_table_view_grid_gallery.js

@ -1,3 +1,5 @@
import { loginPage } from "../../support/page_objects/navigation"
const genTest = (dbType) => { const genTest = (dbType) => {
describe(`${dbType.toUpperCase()} api - Table views`, () => { describe(`${dbType.toUpperCase()} api - Table views`, () => {
@ -7,7 +9,7 @@ const genTest = (dbType) => {
// Run once before test- create project (rest/graphql) // Run once before test- create project (rest/graphql)
// //
before(() => { before(() => {
loginPage.loginAndOpenProject(type) loginPage.loginAndOpenProject(dbType)
// open a table to work on views // open a table to work on views
// //

2
cypress/integration/common/4b_table_view_share.js

@ -12,7 +12,7 @@ const shareViewWithPwd = (pwdCorrect, pwd) => {
// copy link text, visit URL // copy link text, visit URL
cy.getActiveModal().find('.share-link-box') cy.getActiveModal().find('.share-link-box')
.contains('http', {timeout: 2000}) .contains('http', {timeout: 10000})
.then(($obj) => { .then(($obj) => {
let linkText = $obj.text() let linkText = $obj.text()

21
cypress/integration/common/5a_user_role.js

@ -1,6 +1,6 @@
import { loginPage } from "../../support/page_objects/navigation" import { loginPage, projectsPage } from "../../support/page_objects/navigation"
import { mainPage } from "../../support/page_objects/mainPage" import { mainPage } from "../../support/page_objects/mainPage"
import { roles } from "../../support/page_objects/projectConstants" import { roles, staticProjects } from "../../support/page_objects/projectConstants"
const genTest = (apiType, roleType) => { const genTest = (apiType, roleType) => {
@ -20,7 +20,7 @@ const genTest = (apiType, roleType) => {
mainPage.navigationDraw(mainPage.TEAM_N_AUTH).should(validationString) mainPage.navigationDraw(mainPage.TEAM_N_AUTH).should(validationString)
mainPage.navigationDraw(mainPage.PROJ_METADATA).should(validationString) mainPage.navigationDraw(mainPage.PROJ_METADATA).should(validationString)
mainPage.navigationDraw(mainPage.ROLE_VIEW).should(validationString) // mainPage.navigationDraw(mainPage.ROLE_VIEW).should(validationString)
if ('exist' == validationString) { if ('exist' == validationString) {
mainPage.navigationDraw(mainPage.ROLE_VIEW).contains('editor') mainPage.navigationDraw(mainPage.ROLE_VIEW).contains('editor')
mainPage.navigationDraw(mainPage.ROLE_VIEW).contains('commenter') mainPage.navigationDraw(mainPage.ROLE_VIEW).contains('commenter')
@ -28,7 +28,6 @@ const genTest = (apiType, roleType) => {
} }
cy.get('button:contains("New User")').should(validationString) cy.get('button:contains("New User")').should(validationString)
} }
@ -81,7 +80,7 @@ const genTest = (apiType, roleType) => {
// update row option (right click) // update row option (right click)
// //
cy.get(`tbody > :nth-child(4) > [data-col="City"]`).rightclick() cy.get(`tbody > :nth-child(8) > [data-col="City"]`).rightclick()
cy.get('.menuable__content__active').should(validationString) cy.get('.menuable__content__active').should(validationString)
@ -113,7 +112,7 @@ const genTest = (apiType, roleType) => {
// double click cell entries to edit // double click cell entries to edit
// //
cy.get(`tbody > :nth-child(4) > [data-col="City"]`).dblclick().find('input').should(validationString) cy.get(`tbody > :nth-child(8) > [data-col="City"]`).dblclick().find('input').should(validationString)
} }
@ -131,7 +130,7 @@ const genTest = (apiType, roleType) => {
// click on comment icon & type comment // click on comment icon & type comment
// //
cy.get('.v-input.row-checkbox').eq(4).next().next().click({ force: true }) cy.get('.v-input.row-checkbox').eq(8).next().next().click({ force: true })
//cy.get('.nc-row-expand-icon').eq(4).click({ force: true }) //cy.get('.nc-row-expand-icon').eq(4).click({ force: true })
cy.getActiveModal().find('.mdi-comment-multiple-outline').should('exist').click() cy.getActiveModal().find('.mdi-comment-multiple-outline').should('exist').click()
cy.getActiveModal().find('.comment-box').type('Comment-1{enter}') cy.getActiveModal().find('.comment-box').type('Comment-1{enter}')
@ -180,9 +179,11 @@ const genTest = (apiType, roleType) => {
// Test suite // Test suite
it(`[${roles[roleType].name}] SignIn, Open project`, () => { it(`[${roles[roleType].name}] SignIn, Open project`, () => {
//loginPage.signIn(roles[roleType].credentials) loginPage.signIn(roles[roleType].credentials)
//projectsPage.openProject('sakilaDb') if('rest' == apiType)
loginPage.loginAndOpenProject(apiType) projectsPage.openProject(staticProjects.externalREST.basic.name)
else
projectsPage.openProject(staticProjects.externalGQL.basic.name)
}) })
it(`[${roles[roleType].name}] Left navigation menu, New User add`, () => { it(`[${roles[roleType].name}] Left navigation menu, New User add`, () => {

2
cypress/integration/common/5b_preview_role.js

@ -237,7 +237,7 @@ describe('Role preview validations', () => {
// Sign in/ open project // Sign in/ open project
before(() => { before(() => {
loginPage.signIn(roles.owner.credentials) loginPage.signIn(roles.owner.credentials)
projectsPage.openProject('sakilaDb') projectsPage.openProject('externalREST')
}) })
const genTest = (roleType) => { const genTest = (roleType) => {

10
cypress/support/page_objects/navigation.js

@ -54,13 +54,21 @@ export class _loginPage {
// standard pre-project activity // standard pre-project activity
// //
loginAndOpenProject(apiType) { loginAndOpenProject(apiType, xcdb) {
loginPage.signIn(roles.owner.credentials) loginPage.signIn(roles.owner.credentials)
if(!xcdb) {
if ('rest' == apiType) if ('rest' == apiType)
projectsPage.openProject(staticProjects.externalREST.basic.name) projectsPage.openProject(staticProjects.externalREST.basic.name)
else else
projectsPage.openProject(staticProjects.externalGQL.basic.name) projectsPage.openProject(staticProjects.externalGQL.basic.name)
}
else {
if ('rest' == apiType)
projectsPage.openProject(staticProjects.sampleREST.basic.name)
else
projectsPage.openProject(staticProjects.sampleGQL.basic.name)
}
} }
} }

Loading…
Cancel
Save