Browse Source

test(cypress): reduce dependency on static wait (cy.wait)

Signed-off-by: Raju Udava <sivadstala@gmail.com>
pull/865/head
Raju Udava 3 years ago
parent
commit
0616b48bf6
  1. 1
      packages/nc-gui/pages/projects/index.vue
  2. 16
      scripts/cypress/integration/common/4a_table_view_grid_gallery_form.js
  3. 18
      scripts/cypress/integration/common/4b_table_view_share.js
  4. 58
      scripts/cypress/integration/common/4c_form_view_detailed.js
  5. 11
      scripts/cypress/integration/common/4d_table_view_grid_locked.js
  6. 335
      scripts/cypress/integration/common/4e_form_view_share.js
  7. 250
      scripts/cypress/integration/common/4f_grid_view_share.js
  8. 4
      scripts/cypress/integration/common/5a_user_role.js
  9. 11
      scripts/cypress/integration/common/5b_preview_role.js
  10. 67
      scripts/cypress/integration/common/6a_audit.js
  11. 26
      scripts/cypress/integration/common/6c_swagger_api.js
  12. 38
      scripts/cypress/integration/common/6e_project_operations.js
  13. 25
      scripts/cypress/integration/common/6f_attachments.js
  14. 9
      scripts/cypress/integration/common/6g_base_share.js
  15. 7
      scripts/cypress/integration/common/7a_create_project_from_excel.js
  16. 4
      scripts/cypress/integration/spec/roleValidation.spec.js
  17. 8
      scripts/cypress/support/commands.js
  18. 37
      scripts/cypress/support/page_objects/mainPage.js
  19. 53
      scripts/cypress/support/page_objects/navigation.js

1
packages/nc-gui/pages/projects/index.vue

@ -120,6 +120,7 @@
outlined
data-v-step="1"
color="primary"
class="nc-new-project-menu"
v-on="on"
>
<!-- New Project -->

16
scripts/cypress/integration/common/4a_table_view_grid_gallery_form.js

@ -1,4 +1,4 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
export const genTest = (type, xcdb) => {
@ -11,11 +11,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(() => {
@ -34,6 +34,7 @@ export const genTest = (type, xcdb) => {
// Pop up window, click Submit (accepting default name for view)
cy.getActiveModal().find('button:contains(Submit)').click()
cy.toastWait('View created successfully')
// validate if view was creted && contains default name 'Country1'
cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country1').should('exist')
@ -47,7 +48,7 @@ export const genTest = (type, xcdb) => {
// feed new name
cy.get(`.nc-${viewType}-view-item input`).type(`${viewType}View-1{enter}`)
cy.wait(1000)
cy.toastWait('View renamed successfully')
// validate
cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains(`${viewType}View-1`).should('exist')
@ -61,7 +62,7 @@ export const genTest = (type, xcdb) => {
// click on delete icon (becomes visible on hovering mouse)
cy.get('.nc-view-delete-icon').click({ force: true })
cy.wait(1000)
cy.toastWait('View deleted successfully')
// confirm if the number of veiw entries is reduced by 1
cy.get('.nc-view-item').its('length').should('eq', 1)
@ -77,11 +78,6 @@ export const genTest = (type, xcdb) => {
})
}
// invoke for different API types supported
//
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

18
scripts/cypress/integration/common/4b_table_view_share.js

@ -1,5 +1,4 @@
import { mainPage } from "../../support/page_objects/mainPage"
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
let storedURL = ''
@ -12,14 +11,13 @@ const generateLinkWithPwd = () => {
.contains('Share View')
.click()
// wait, as URL initially will be /undefined
cy.wait(500)
// enable checkbox & feed pwd, save
cy.getActiveModal().find('[role="switch"][type="checkbox"]').click( {force: true} )
cy.getActiveModal().find('input[type="password"]').type('1')
cy.getActiveModal().find('button:contains("Save password")').click()
cy.toastWait('Successfully updated')
// copy link text, visit URL
cy.getActiveModal().find('.share-link-box')
.then(($obj) => {
@ -38,6 +36,8 @@ export const genTest = (type, xcdb) => {
//
before(() => {
cy.openTableTab('City')
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 25)
// store base URL- to re-visit and delete form view later
cy.url().then((url) => {
storedURL = url
@ -58,12 +58,12 @@ export const genTest = (type, xcdb) => {
cy.visit(linkText, {
baseUrl: null
})
// wait for share view page to load!
cy.wait(1000)
cy.getActiveModal().should('exist')
// feed password
cy.getActiveModal().find('input[type="password"]').type('a')
cy.getActiveModal().find('button:contains("Unlock")').click()
cy.wait(1000)
// if pwd is incorrect, active modal requesting to feed in password again will persist
cy.get('body').find('.v-dialog.v-dialog--active').should('exist')
@ -74,12 +74,10 @@ export const genTest = (type, xcdb) => {
// cy.visit(linkText, {
// baseUrl: null
// })
// // wait for share view page to load!
// cy.wait(1000)
// feed password
cy.getActiveModal().find('input[type="password"]').clear().type('1')
cy.getActiveModal().find('button:contains("Unlock")').click()
cy.wait(1000)
// if pwd is incorrect, active modal requesting to feed in password again will persist
cy.get('body').find('.v-dialog.v-dialog--active').should('not.exist')

58
scripts/cypress/integration/common/4c_form_view_detailed.js

@ -1,4 +1,3 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { mainPage } from "../../support/page_objects/mainPage"
@ -14,23 +13,23 @@ 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');
// 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)
})
beforeEach(() => {
cy.restoreLocalStorage();
cy.restoreLocalStorage();
})
afterEach(() => {
cy.saveLocalStorage();
cy.saveLocalStorage();
})
after(() => {
cy.closeTableTab('Country')
cy.closeTableTab('Country')
})
// Common routine to create/edit/delete GRID & GALLERY view
@ -45,6 +44,8 @@ export const genTest = (type, xcdb) => {
// Pop up window, click Submit (accepting default name for view)
cy.getActiveModal().find('button:contains(Submit)').click()
cy.toastWait('View created successfully')
// validate if view was creted && contains default name 'Country1'
cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country1').should('exist')
})
@ -142,6 +143,7 @@ export const genTest = (type, xcdb) => {
// submit button & validate
cy.get('.nc-form').find('button').contains('Submit').click()
cy.toastWait('Saved successfully')
cy.get('.v-alert').contains('Successfully submitted form data').should('exist')
// end of test removes newly added rows from table. that step validates if row was successfully added.
@ -163,6 +165,7 @@ export const genTest = (type, xcdb) => {
// submit button & validate
cy.get('.nc-form').find('button').contains('Submit').click()
cy.toastWait('Congratulations')
cy.get('.v-alert').contains('Congratulations').should('exist')
// end of test removes newly added rows from table. that step validates if row was successfully added.
@ -184,17 +187,17 @@ export const genTest = (type, xcdb) => {
// submit button & validate
cy.get('.nc-form').find('button').contains('Submit').click()
cy.toastWait('Congratulations')
cy.get('.v-alert').contains('Congratulations').should('exist')
cy.get('button').contains('Submit Another Form').should('exist')
cy.get('button').contains('Submit Another Form').click()
cy.wait(2000).then(() => {
// New form appeared? Header & description should exist
cy.get('.nc-form').find('[placeholder="Form Title"]').contains('A B C D').should('exist')
cy.get('.nc-form').find('[placeholder="Add form description"]').contains('Some description about form comes here').should('exist')
cy.get('.nc-form').should('exist')
// New form appeared? Header & description should exist
cy.get('.nc-form').find('[placeholder="Form Title"]').contains('A B C D').should('exist')
cy.get('.nc-form').find('[placeholder="Add form description"]').contains('Some description about form comes here').should('exist')
// end of test removes newly added rows from table. that step validates if row was successfully added.
})
// end of test removes newly added rows from table. that step validates if row was successfully added.
})
it(`Validate ${viewType}: Submit default, Enable checkbox "blank form after 5 seconds"`, () => {
@ -212,10 +215,10 @@ export const genTest = (type, xcdb) => {
// submit button & validate
cy.get('.nc-form').find('button').contains('Submit').click()
cy.toastWait('Congratulations')
cy.get('.v-alert').contains('Congratulations').should('exist').then(() => {
// wait for 5 seconds
cy.wait(5000)
cy.get('.v-alert').contains('Congratulations').should('not.exist')
cy.get('.nc-form').should('exist')
// validate if form has appeared again
cy.get('.nc-form').find('[placeholder="Form Title"]').contains('A B C D').should('exist')
@ -230,9 +233,7 @@ export const genTest = (type, xcdb) => {
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 })
// validate if toaster pops up requesting to activate SMTP
cy.get('.toasted:visible', { timout: 6000 })
.contains('Please activate SMTP plugin in App store for enabling email notification')
.should('exist')
cy.toastWait('Please activate SMTP plugin in App store for enabling email notification')
})
it(`Validate ${viewType}: Email me verification, with SMTP configuration`, () => {
@ -242,6 +243,9 @@ export const genTest = (type, xcdb) => {
// 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.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 })
// validate if toaster pops up informing installation of email notification
@ -252,6 +256,8 @@ export const genTest = (type, xcdb) => {
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)
})
it(`Validate ${viewType}: Add/ remove field verification"`, () => {
@ -302,7 +308,7 @@ export const genTest = (type, xcdb) => {
// click on delete icon (becomes visible on hovering mouse)
cy.get('.nc-view-delete-icon').click({ force: true })
cy.wait(1000)
cy.toastWait('View deleted successfully')
// confirm if the number of veiw entries is reduced by 1
cy.get('.nc-view-item').its('length').should('eq', 1)
@ -310,7 +316,7 @@ export const genTest = (type, xcdb) => {
// clean up newly added rows into Country table operations
// this auto verifies successfull addition of rows to table as well
mainPage.getPagination(5).click()
cy.wait(3000)
cy.get('.nc-grid-row').should('have.length', 13)
mainPage.getRow(10).find('.mdi-checkbox-blank-outline').click({ force: true })
mainPage.getRow(11).find('.mdi-checkbox-blank-outline').click({ force: true })
mainPage.getRow(12).find('.mdi-checkbox-blank-outline').click({ force: true })
@ -318,6 +324,7 @@ export const genTest = (type, xcdb) => {
mainPage.getCell("Country", 10).rightclick()
cy.getActiveMenu().contains('Delete Selected Row').click()
// cy.toastWait('Deleted selected rows successfully')
})
}
@ -325,15 +332,8 @@ export const genTest = (type, xcdb) => {
viewTest('form')
})
}
// invoke for different API types supported
//
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

11
scripts/cypress/integration/common/4d_table_view_grid_locked.js

@ -1,4 +1,4 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { mainPage } from "../../support/page_objects/mainPage"
@ -9,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('Country');
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 25)
})
after(() => {
@ -68,11 +68,6 @@ export const genTest = (type, xcdb) => {
})
}
// invoke for different API types supported
//
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

335
scripts/cypress/integration/common/4e_form_view_share.js

@ -1,179 +1,178 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { mainPage } from "../../support/page_objects/mainPage"
let storedURL = ''
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - FORM view (Share)`, () => {
const name = 'Test' + Date.now();
// Run once before test- create project (rest/graphql)
//
before(() => {
// loginPage.loginAndOpenProject(type)
// open a table to work on views
//
cy.openTableTab('City');
})
beforeEach(() => {
cy.restoreLocalStorage();
})
afterEach(() => {
cy.saveLocalStorage();
})
after(() => {
cy.closeTableTab('City')
})
// Common routine to create/edit/delete GRID & GALLERY view
// Input: viewType - 'grid'/'gallery'
//
const viewTest = (viewType) => {
it(`Create ${viewType} view`, () => {
// click on 'Grid/Gallery' button on Views bar
cy.get(`.nc-create-${viewType}-view`).click();
// Pop up window, click Submit (accepting default name for view)
cy.getActiveModal().find('button:contains(Submit)').click()
// Prepare form
// add header, description
// add post submission message
// swap position for City, LastUpdate fields
// remove City=>Address field
cy.get('.nc-form').find('[placeholder="Form Title"]').type('A B C D')
cy.get('.nc-form').find('[placeholder="Add form description"]').type('Some description about form comes here')
cy.get('.nc-form > .mx-auto').find('textarea').type('Congratulations!')
cy.get('#data-table-form-City').drag('#data-table-form-LastUpdate')
cy.get('[title="City => Address"]').drag('.nc-drag-n-drop-to-hide')
cy.get('.nc-form > .mx-auto').find('[type="checkbox"]').eq(1).click()
cy.wait(2000)
// store base URL- to re-visit and delete form view later
cy.url().then((url) => {
storedURL = url
})
})
it(`Share form view`, () => {
cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('City1').click()
cy.get('.v-navigation-drawer__content > .container')
.find('.v-list > .v-list-item')
.contains('Share View')
.click()
// copy link text, visit URL
cy.getActiveModal().find('.share-link-box')
.contains('/nc/form/', {timeout: 10000})
.then(($obj) => {
let linkText = $obj.text().trim()
cy.log(linkText)
cy.visit(linkText, {
baseUrl: null
})
// wait for share view page to load!
cy.wait(5000)
// New form appeared? Header & description should exist
cy.get('.nc-form', { timeout: 10000 })
.find('h2')
.contains('A B C D')
.should('exist')
cy.get('.nc-form', { timeout: 10000 })
.find('.body-1')
.contains('Some description about form comes here')
.should('exist')
// all fields, barring removed field should exist
cy.get('[title="City"]').should('exist')
cy.get('[title="LastUpdate"]').should('exist')
cy.get('[title="Country <= City"]').should('exist')
cy.get('[title="City => Address"]').should('not.exist')
// order of LastUpdate & City field is retained
cy.get('.nc-field-wrapper').eq(0).contains('LastUpdate').should('exist')
cy.get('.nc-field-wrapper').eq(1).contains('City').should('exist')
// submit form, to read message
cy.get('#data-table-form-City').type('_abc')
cy.get('#data-table-form-LastUpdate').click()
cy.getActiveModal().find('button').contains('19').click()
cy.getActiveModal().find('button').contains('OK').click()
cy.get('button').contains("Link to 'Country'").click()
cy.getActiveModal().find('.child-card').contains('Afghanistan').click()
// submit button & validate
cy.get('.nc-form').find('button').contains('Submit').click()
cy.get('.v-alert').contains('Congratulations').should('exist').then(() => {
// wait for 5 seconds
cy.wait(5000)
cy.get('.v-alert').contains('Congratulations').should('not.exist')
// validate if form has appeared again
cy.get('.nc-form', { timeout: 10000 })
.find('h2')
.contains('A B C D')
.should('exist')
cy.get('.nc-form', { timeout: 10000 })
.find('.body-1')
.contains('Some description about form comes here')
.should('exist')
})
})
})
it(`Delete ${viewType} view`, () => {
// go back to base page
cy.visit(storedURL, {
baseUrl: null
})
// number of view entries should be 2 before we delete
cy.get('.nc-view-item').its('length').should('eq', 2)
// click on delete icon (becomes visible on hovering mouse)
cy.get('.nc-view-delete-icon').click({ force: true })
cy.wait(1000)
// confirm if the number of veiw entries is reduced by 1
cy.get('.nc-view-item').its('length').should('eq', 1)
// clean up newly added rows into Country table operations
// this auto verifies successfull addition of rows to table as well
mainPage.getPagination(25).click()
cy.wait(3000)
mainPage.getRow(1).find('.mdi-checkbox-blank-outline').click({ force: true })
mainPage.getCell("City", 1).rightclick()
cy.getActiveMenu().contains('Delete Selected Row').click()
})
}
// below scenario's will be invoked twice, once for rest & then for graphql
viewTest('form')
})
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - FORM view (Share)`, () => {
const name = 'Test' + Date.now();
// Run once before test- create project (rest/graphql)
//
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)
})
beforeEach(() => {
cy.restoreLocalStorage();
})
afterEach(() => {
cy.saveLocalStorage();
})
after(() => {
cy.closeTableTab('City')
})
// Common routine to create/edit/delete GRID & GALLERY view
// Input: viewType - 'grid'/'gallery'
//
const viewTest = (viewType) => {
it(`Create ${viewType} view`, () => {
// click on 'Grid/Gallery' button on Views bar
cy.get(`.nc-create-${viewType}-view`).click();
// Pop up window, click Submit (accepting default name for view)
cy.getActiveModal().find('button:contains(Submit)').click()
cy.toastWait('View created successfully')
// Prepare form
// add header, description
// add post submission message
// swap position for City, LastUpdate fields
// remove City=>Address field
cy.get('.nc-form > .mx-auto').find('[type="checkbox"]').eq(1).click()
cy.get('.nc-form > .mx-auto').find('[type="checkbox"]').eq(1).should('be.checked')
cy.get('.nc-form').find('[placeholder="Form Title"]').type('A B C D')
cy.get('.nc-form').find('[placeholder="Add form description"]').type('Some description about form comes here')
cy.get('.nc-form > .mx-auto').find('textarea').type('Congratulations!')
cy.get('#data-table-form-City').drag('#data-table-form-LastUpdate')
cy.get('[title="City => Address"]').drag('.nc-drag-n-drop-to-hide')
cy.get('.nc-form > .mx-auto').find('[type="checkbox"]').eq(1).should('be.checked')
// store base URL- to re-visit and delete form view later
cy.url().then((url) => {
storedURL = url
})
})
it(`Share form view`, () => {
cy.get('.nc-form > .mx-auto').find('[type="checkbox"]').eq(1).should('be.checked')
cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('City1').click()
cy.get('.v-navigation-drawer__content > .container')
.find('.v-list > .v-list-item')
.contains('Share View')
.click()
// copy link text, visit URL
cy.getActiveModal().find('.share-link-box')
.contains('/nc/form/', {timeout: 10000})
.then(($obj) => {
let linkText = $obj.text().trim()
cy.log(linkText)
cy.visit(linkText, {
baseUrl: null
})
// wait for share view page to load!
cy.get('.nc-form').should('exist')
// New form appeared? Header & description should exist
cy.get('.nc-form', { timeout: 10000 })
.find('h2')
.contains('A B C D')
.should('exist')
cy.get('.nc-form', { timeout: 10000 })
.find('.body-1')
.contains('Some description about form comes here')
.should('exist')
// all fields, barring removed field should exist
cy.get('[title="City"]').should('exist')
cy.get('[title="LastUpdate"]').should('exist')
cy.get('[title="Country <= City"]').should('exist')
cy.get('[title="City => Address"]').should('not.exist')
// order of LastUpdate & City field is retained
cy.get('.nc-field-wrapper').eq(0).contains('LastUpdate').should('exist')
cy.get('.nc-field-wrapper').eq(1).contains('City').should('exist')
// submit form, to read message
cy.get('#data-table-form-City').type('_abc')
cy.get('#data-table-form-LastUpdate').click()
cy.getActiveModal().find('button').contains('19').click()
cy.getActiveModal().find('button').contains('OK').click()
cy.get('button').contains("Link to 'Country'").click()
cy.getActiveModal().find('.child-card').contains('Afghanistan').click()
// submit button & validate
cy.get('.nc-form').find('button').contains('Submit').click()
cy.toastWait('Congratulations')
cy.get('.v-alert').contains('Congratulations').should('exist').then(() => {
cy.get('.nc-form').should('exist')
// validate if form has appeared again
cy.get('.nc-form', { timeout: 10000 })
.find('h2')
.contains('A B C D')
.should('exist')
cy.get('.nc-form', { timeout: 10000 })
.find('.body-1')
.contains('Some description about form comes here')
.should('exist')
})
})
})
it(`Delete ${viewType} view`, () => {
// go back to base page
cy.visit(storedURL, {
baseUrl: null
})
// number of view entries should be 2 before we delete
cy.get('.nc-view-item').its('length').should('eq', 2)
// click on delete icon (becomes visible on hovering mouse)
cy.get('.nc-view-delete-icon').click({ force: true })
cy.toastWait('View deleted successfully')
// confirm if the number of veiw entries is reduced by 1
cy.get('.nc-view-item').its('length').should('eq', 1)
// clean up newly added rows into Country table operations
// this auto verifies successfull addition of rows to table as well
mainPage.getPagination(25).click()
cy.get('.nc-grid-row').should('have.length', 1)
mainPage.getRow(1).find('.mdi-checkbox-blank-outline').click({ force: true })
mainPage.getCell("City", 1).rightclick()
cy.getActiveMenu().contains('Delete Selected Row').click()
// cy.toastWait('Deleted selected rows successfully')
})
}
// below scenario's will be invoked twice, once for rest & then for graphql
viewTest('form')
})
}
// invoke for different API types supported
//
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

250
scripts/cypress/integration/common/4f_grid_view_share.js

@ -1,4 +1,4 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { mainPage } from "../../support/page_objects/mainPage"
@ -23,7 +23,8 @@ export const genTest = (type, xcdb) => {
.click()
// wait, as URL initially will be /undefined
cy.wait(1000)
cy.getActiveModal().find('.share-link-box')
.contains('/nc/view/', {timeout: 10000}).should('exist')
// copy link text, visit URL
cy.getActiveModal().find('.share-link-box')
@ -32,7 +33,6 @@ export const genTest = (type, xcdb) => {
cy.get('body').type('{esc}')
// viewURL.push($obj.text())
viewURL[viewName] = $obj.text().trim()
cy.wait(1000)
})
}
@ -43,6 +43,9 @@ export const genTest = (type, xcdb) => {
// 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.saveLocalStorage()
})
@ -69,22 +72,7 @@ export const genTest = (type, xcdb) => {
// create a normal public view
cy.get(`.nc-create-${viewType}-view`).click();
cy.getActiveModal().find('button:contains(Submit)').click()
cy.wait(1000)
// // create view for fields verification
// cy.get(`.nc-create-${viewType}-view`).click();
// cy.getActiveModal().find('button:contains(Submit)').click()
// cy.wait(1000)
// // create view for Sort verification
// cy.get(`.nc-create-${viewType}-view`).click();
// cy.getActiveModal().find('button:contains(Submit)').click()
// cy.wait(1000)
// // create view for Filter verification
// cy.get(`.nc-create-${viewType}-view`).click();
// cy.getActiveModal().find('button:contains(Submit)').click()
// cy.wait(1000)
cy.toastWait('View created successfully')
// store base URL- to re-visit and delete form view later
cy.url().then((url) => {
@ -114,9 +102,7 @@ export const genTest = (type, xcdb) => {
cy.getActiveMenu().find('.v-list-item').contains('Views List').click()
cy.wait(1000)
// cy.get('.container').find('button.mdi-delete-outline')
cy.get('th:contains("View Link")').should('exist')
cy.get('th:contains("View Link")').parent().parent()
.next().find('tr').its('length').should('eq', 1)
@ -131,8 +117,8 @@ export const genTest = (type, xcdb) => {
baseUrl: null
})
// wait for public view page to load!
cy.wait(5000)
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 18)
// verify title
cy.get('div.model-name').contains('Address1').should('exist')
@ -179,110 +165,6 @@ export const genTest = (type, xcdb) => {
mainPage.hideUnhideField('LastUpdate')
})
// it(`Share ${viewType} view generate URL with all fields enabled`, () => {
// cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country1').click()
// generateViewLink('default')
// cy.log(viewURL['default'])
// })
// it(`Share ${viewType} view generate URL with a field hidden`, () => {
// cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country2').click()
// mainPage.hideUnhideField('LastUpdate')
// generateViewLink('hide')
// })
// it(`Share ${viewType} view generate URL with a field sorted`, () => {
// cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country3').click()
// mainPage.sortField('Country', 'Z -> A')
// generateViewLink('sort')
// })
// it(`Share ${viewType} view generate URL with a field filtered`, () => {
// cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country4').click()
// mainPage.filterField('Country', 'is equal', 'India')
// generateViewLink('filter')
// })
// it(`Share ${viewType} view : Access URL with a field hidden`, () => {
// // visit public view
// cy.visit(viewURL['hide'])
// // wait for public view page to load!
// cy.wait(5000)
// // verify title
// cy.get('div.model-name').contains('Country2').should('exist')
// // verify column headers
// cy.get('[data-col="Country"]').should('exist')
// cy.get('[data-col="LastUpdate"]').should('not.exist')
// cy.get('[data-col="Country => City"]').should('exist')
// // country column content verification before sort
// mainPage.getCell("Country", 1).contains("Afghanistan").should('exist')
// mainPage.getCell("Country", 2).contains("Algeria").should('exist')
// mainPage.getCell("Country", 3).contains("American Samoa").should('exist')
// })
// it(`Share ${viewType} view : Access URL with a field sorted`, () => {
// // visit public view
// cy.visit(viewURL['sort'])
// // wait for public view page to load!
// cy.wait(5000)
// // verify title
// cy.get('div.model-name').contains('Country3').should('exist')
// // verify column headers
// cy.get('[data-col="Country"]').should('exist')
// cy.get('[data-col="LastUpdate"]').should('exist')
// cy.get('[data-col="Country => City"]').should('exist')
// // country column content verification before sort
// mainPage.getCell("Country", 1).contains("Zambia").should('exist')
// })
// it(`Share ${viewType} view : Access URL with a field filtered`, () => {
// // visit public view
// cy.visit(viewURL['filter'])
// // wait for public view page to load!
// cy.wait(5000)
// // verify title
// cy.get('div.model-name').contains('Country4').should('exist')
// // verify column headers
// cy.get('[data-col="Country"]').should('exist')
// cy.get('[data-col="LastUpdate"]').should('exist')
// cy.get('[data-col="Country => City"]').should('exist')
// // country column content verification before sort
// mainPage.getCell("Country", 1).contains("India").should('exist')
// })
// it(`Share ${viewType} view : Access URL with all fields enabled`, () => {
// // visit public view
// cy.visit(viewURL['default'])
// // wait for public view page to load!
// cy.wait(5000)
// // verify title
// cy.get('div.model-name').contains('Country1').should('exist')
// // verify column headers
// cy.get('[data-col="Country"]').should('exist')
// cy.get('[data-col="LastUpdate"]').should('exist')
// cy.get('[data-col="Country => City"]').should('exist')
// // country column content verification before sort
// mainPage.getCell("Country", 1).contains("Afghanistan").should('exist')
// mainPage.getCell("Country", 2).contains("Algeria").should('exist')
// mainPage.getCell("Country", 3).contains("American Samoa").should('exist')
// })
it(`Share ${viewType.toUpperCase()} view : Disable sort`, () => {
// remove sort and validate
mainPage.clearSort()
@ -291,7 +173,6 @@ export const genTest = (type, xcdb) => {
it(`Share ${viewType.toUpperCase()} view : Enable sort`, () => {
// Sort menu operations (Country Column, Z->A)
//cy.wait(5000)
mainPage.sortField('District', 'Z -> A')
mainPage.getCell("District", 1).contains("West Bengali").should('exist')
})
@ -299,7 +180,8 @@ export const genTest = (type, xcdb) => {
it(`Share ${viewType.toUpperCase()} view : Create Filter`, () => {
// add filter & validate
mainPage.filterField('District', 'is like', 'Tamil')
cy.wait(1000)
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 2)
mainPage.getCell("District", 1).contains("Tamil").should('exist')
})
@ -369,8 +251,6 @@ export const genTest = (type, xcdb) => {
cy.getActiveModal().find('button.mdi-reload').should('exist')
cy.getActiveModal().find('button').contains('Link to').should('not.exist')
// cy.getActiveModal().find('.child-card').contains('Mike').should('exist')
//cy.getActiveModal().find('.child-card').find('button').should('not.exist')
cy.get('body').type('{esc}')
})
@ -383,18 +263,8 @@ export const genTest = (type, xcdb) => {
// number of view entries should be 2 before we delete
cy.get('.nc-view-item').its('length').should('eq', 2)
// // click on delete icon (becomes visible on hovering mouse)
// cy.get('.nc-view-delete-icon').eq(3).click({ force: true })
// cy.wait(1000)
// cy.get('.nc-view-delete-icon').eq(2).click({ force: true })
// cy.wait(1000)
// cy.get('.nc-view-delete-icon').eq(1).click({ force: true })
// cy.wait(1000)
cy.get('.nc-view-delete-icon').eq(0).click({ force: true })
cy.wait(1000)
cy.toastWait('View deleted successfully')
// confirm if the number of veiw entries is reduced by 1
cy.get('.nc-view-item').its('length').should('eq', 1)
@ -405,85 +275,13 @@ export const genTest = (type, xcdb) => {
viewTest('grid')
})
// describe(`${type.toUpperCase()} api - Grid view/ Virtual column verification`, () => {
// before(() => {
// // Address table has belongs to, has many & many-to-many
// cy.openTableTab('Address');
// cy.saveLocalStorage()
// // store base URL- to re-visit and delete form view later
// cy.url().then((url) => {
// baseURL = url
// generateViewLink('virtualColumn')
// })
// })
// beforeEach(() => {
// cy.restoreLocalStorage();
// })
// afterEach(() => {
// cy.saveLocalStorage();
// })
// after(() => {
// // close table
// cy.visit(baseURL)
// mainPage.deleteCreatedViews()
// cy.closeTableTab('Address')
// })
// it(`Generate default Shared GRID view URL`, () => {
// // visit public view
// cy.visit(viewURL['virtualColumn'])
// // wait for public view page to load!
// cy.wait(5000)
// })
// it(`Share GRID view : Virtual column validation > has many`, () => {
// // verify column headers
// cy.get('[data-col="Address => Customer"]').should('exist')
// cy.get('[data-col="Address => Staff"]').should('exist')
// cy.get('[data-col="City <= Address"]').should('exist')
// cy.get('[data-col="Address <=> Staff"]').should('exist')
// // has many field validation
// mainPage.getCell("Address => Staff", 3).click().find('button.mdi-close-thick').should('not.exist')
// mainPage.getCell("Address => Staff", 3).click().find('button.mdi-plus').should('not.exist')
// mainPage.getCell("Address => Staff", 3).click().find('button.mdi-arrow-expand').click()
// cy.getActiveModal().find('button.mdi-reload').should('exist')
// cy.getActiveModal().find('button').contains('Link to').should('not.exist')
// cy.getActiveModal().find('.child-card').contains('Mike').should('exist')
// cy.getActiveModal().find('.child-card').find('button').should('not.exist')
// cy.get('body').type('{esc}')
// })
// it(`Share GRID view : Virtual column validation > belongs to`, () => {
// // belongs to field validation
// mainPage.getCell("City <= Address", 1).click().find('button.mdi-close-thick').should('not.exist')
// mainPage.getCell("City <= Address", 1).click().find('button.mdi-arrow-expand').should('not.exist')
// mainPage.getCell("City <= Address", 1).find('.v-chip').contains('Lethbridge').should('exist')
// })
// it(`Share GRID view : Virtual column validation > many to many`, () => {
// // many-to-many field validation
// mainPage.getCell("Address <=> Staff", 1).click().find('button.mdi-close-thick').should('not.exist')
// mainPage.getCell("Address <=> Staff", 1).click().find('button.mdi-plus').should('not.exist')
// mainPage.getCell("Address <=> Staff", 1).click().find('button.mdi-arrow-expand').click()
// cy.getActiveModal().find('button.mdi-reload').should('exist')
// cy.getActiveModal().find('button').contains('Link to').should('not.exist')
// cy.getActiveModal().find('.child-card').contains('Mike').should('exist')
// cy.getActiveModal().find('.child-card').find('button').should('not.exist')
// cy.get('body').type('{esc}')
// })
// })
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.saveLocalStorage()
// store base URL- to re-visit and delete form view later
cy.url().then((url) => {
@ -501,7 +299,8 @@ export const genTest = (type, xcdb) => {
// delete row
mainPage.getPagination(5).click()
cy.wait(3000)
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 10)
mainPage.getRow(10).find('.mdi-checkbox-blank-outline').click({ force: true })
mainPage.getCell("Country", 10).rightclick()
cy.getActiveMenu().contains('Delete Selected Row').click()
@ -513,6 +312,8 @@ export const genTest = (type, xcdb) => {
cy.get('.nc-column-delete').click()
cy.get('button:contains(Confirm)').click()
cy.toastWait('Update table.Country successful')
mainPage.deleteCreatedViews()
// close table
@ -536,13 +337,15 @@ export const genTest = (type, xcdb) => {
baseUrl: null
}) //5
// wait for public view page to load!
cy.wait(5000)
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 25)
})
it(`Share GRID view : new row visible`, () => {
// verify row
cy.get(`.v-pagination > li:contains('5') button`).click()
cy.wait(3000)
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 10)
mainPage.getCell('Country', 10).contains('a').should('exist')
})
@ -553,11 +356,6 @@ export const genTest = (type, xcdb) => {
})
}
// invoke for different API types supported
//
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

4
scripts/cypress/integration/common/5a_user_role.js

@ -48,16 +48,14 @@ export const genTest = (type, xcdb) => {
cy.visit(mainPage.roleURL[roleType], {
baseUrl: null
})
cy.wait(3000)
// Redirected to new URL, feed details
//
cy.get('input[type="text"]').type(roles[roleType].credentials.username)
cy.get('input[type="text"]').should('exist').type(roles[roleType].credentials.username)
cy.get('input[type="password"]').type(roles[roleType].credentials.password)
cy.get('button:contains("SIGN")').click()
cy.url({ timeout: 6000 }).should('contain', '#/project')
cy.wait(1000)
if('rest' == type)
projectsPage.openProject(staticProjects.externalREST.basic.name)

11
scripts/cypress/integration/common/5b_preview_role.js

@ -23,7 +23,12 @@ export const genTest = (type, xcdb, roleType) => {
after(() => {
cy.get('.nc-preview-reset').click({ force: true })
cy.wait(20000)
// cy.wait(20000)
// wait for page rendering to complete
cy.get('.nc-grid-row', { timeout: 25000 }).should('have.length', 25)
// cy.get('.nc-preview-reset:visible').should('not-exist')
// mainPage.navigationDraw(mainPage.ROLE_VIEW).contains('Reset Preview').should('not.exist')
// cy.get('.nc-preview-reset').should('not-exist')
@ -34,8 +39,10 @@ export const genTest = (type, xcdb, roleType) => {
it(`Role preview: ${roleType}: Enable preview`, () => {
cy.get(`.nc-preview-${roleType}`).click()
cy.wait(3000)
cy.openTableTab('City')
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 25)
})
it(`Role preview: ${roleType}: Advance settings`, () => {

67
scripts/cypress/integration/common/6a_audit.js

@ -1,67 +0,0 @@
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) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} Audit`, () => {
before(() => {
loginPage.loginAndOpenProject(type)
cy.get('.mdi-close').click({ multiple: true })
})
const getAuditCell = (row, col) => {
return cy.get('table > tbody > tr').eq(row).find('td').eq(col)
}
it('Open Audit tab', ()=> {
cy.createTable('tablex')
cy.deleteTable('tablex')
cy.wait(2000)
mainPage.navigationDraw(mainPage.AUDIT).click()
cy.wait(2000)
// Audit table entries
// [Header] Operation Type, Operation Sub Type, Description, User, Created
// [0] TABLE, DELETED, delete table table-x, user@nocodb.com, ...
// [1] TABLE, Created, created table table-x, user@nocodb.com, ...
getAuditCell(0,0).contains('TABLE').should('exist')
getAuditCell(0,1).contains('DELETED').should('exist')
getAuditCell(0,3).contains('user@nocodb.com').should('exist')
getAuditCell(1,0).contains('TABLE').should('exist')
getAuditCell(1,1).contains('CREATED').should('exist')
getAuditCell(1,3).contains('user@nocodb.com').should('exist')
})
})
}
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*
* @author Pranav C Balan <pranavxc@gmail.com>
* @author Raju Udava <sivadstala@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

26
scripts/cypress/integration/common/6c_swagger_api.js

@ -62,11 +62,10 @@ export const genTest = (type, xcdb) => {
}).then(() => {
// wait to allow time for SWAGGER Library loading to finish
cy.wait(5000)
cy.log(Token)
// validate; API order assumed
cy.get('#operations-tag-Authentication', {timeout: 10000}).next().find('.opblock').should('has.length', 9)
cy.get('#operations-tag-Authentication', {timeout: 20000}).should('exist').next().find('.opblock').should('has.length', 9)
getSwaggerButton("Authentication", 0, "User login").should('exist')
getSwaggerButton("Authentication", 1, "User signup").should('exist')
getSwaggerButton("Authentication", 2, "Password Forgot").should('exist')
@ -184,4 +183,25 @@ export const genTest = (type, xcdb) => {
}
}
// genTest('rest', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*
* @author Raju Udava <sivadstala@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

38
scripts/cypress/integration/common/6e_project_operations.js

@ -11,76 +11,62 @@ export const genTest = (type, xcdb) => {
loginPage.signIn(roles.owner.credentials)
})
// beforeEach(() => {
// cy.restoreLocalStorage();
// });
// afterEach(() => {
// cy.saveLocalStorage();
// });
// it('Create Project', () => {
// cy.contains('New Project').trigger('onmouseover').trigger('mouseenter');
// cy.get('.create-external-db-project').click()
// cy.url({timeout: 50000}).should('contain', '#/project/')
// if (type === 'graphql') {
// cy.contains('GRAPHQL APIs').closest('label').click()
// }
// cy.get('.database-field input').click().clear().type('dummy_db')
// cy.contains('Test Database Connection').click()
// cy.contains('Ok & Save Project', {timeout: 3000}).click()
// cy.url({timeout: 50000}).should('contain', '#/nc/')
// });
it('Stop Project', () => {
//cy.visit('./#/projects')
cy.get(`.nc-${type}-project-row .mdi-stop-circle-outline`, { timeout: 10000 })
.should('exist')
.last()
.invoke('show')
.click();
cy.contains('Submit')
.closest('button')
.click();
cy.toastWait('stopped successfully')
})
it('Start Project', () => {
//cy.visit('./#/projects')
cy.get(`.nc-${type}-project-row .mdi-play-circle-outline`, { timeout: 10000 })
.should('exist')
.last()
.invoke('show')
.click();
cy.contains('Submit').closest('button').click();
cy.toastWait('started successfully')
})
it('Restart Project', () => {
//cy.visit('./#/projects')
cy.wait(1000)
cy.get(`.nc-${type}-project-row .mdi-restart`, { timeout: 10000 })
.should('exist')
.last()
.invoke('show')
.click();
cy.contains('Submit')
.closest('button')
.click();
cy.toastWait('restarted successfully')
})
it('Delete Project', () => {
//cy.visit('./#/projects')
cy.wait(1000)
cy.get(`.nc-${type}-project-row .mdi-delete-circle-outline`, { timeout: 10000 })
.should('exist')
.last()
.invoke('show')
.click();
cy.contains('Submit')
.closest('button')
.click();
cy.toastWait('deleted successfully')
})
})
}
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*

25
scripts/cypress/integration/common/6f_attachments.js

@ -9,6 +9,8 @@ export const genTest = (type, xcdb) => {
before(() => {
loginPage.loginAndOpenProject(type)
cy.openTableTab('Country');
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 25)
})
after(() => {
@ -17,7 +19,8 @@ export const genTest = (type, xcdb) => {
// clean up newly added rows into Country table operations
// this auto verifies successfull addition of rows to table as well
mainPage.getPagination(5).click()
cy.wait(3000)
// wait for page rendering to complete
cy.get('.nc-grid-row').should('have.length', 10)
mainPage.getRow(10).find('.mdi-checkbox-blank-outline').click({force: true})
mainPage.getCell("Country", 10).rightclick()
@ -27,12 +30,12 @@ export const genTest = (type, xcdb) => {
})
it(`Add column of type attachments`, () => {
mainPage.addColumnWithType('testAttach', 'Attachment')
cy.wait(4000)
mainPage.addColumnWithType('testAttach', 'Attachment', 'Country')
for (let i = 1; i <= 2; i++) {
let filepath = `sampleFiles/${i}.json`
mainPage.getCell('testAttach', i).click().find('input[type="file"]').attachFile(filepath)
cy.wait(4000)
mainPage.getCell('testAttach', i).find('.mdi-file').should('exist')
}
})
@ -40,9 +43,13 @@ export const genTest = (type, xcdb) => {
// create form-view
cy.get(`.nc-create-form-view`).click();
cy.getActiveModal().find('button:contains(Submit)').click()
cy.toastWait('View created successfully')
cy.get(`.nc-view-item.nc-form-view-item`).contains('Country1').click()
cy.wait(1000)
cy.get('.v-navigation-drawer__content > .container')
.should('exist')
.find('.v-list > .v-list-item')
.contains('Share View')
.click()
@ -59,9 +66,8 @@ export const genTest = (type, xcdb) => {
})
// wait for share view page to load!
cy.wait(5000)
cy.get('#data-table-form-Country').type('_abc')
cy.get('#data-table-form-Country').should('exist').type('_abc')
cy.get('#data-table-form-LastUpdate').click()
cy.getActiveModal().find('button').contains('19').click()
cy.getActiveModal().find('button').contains('OK').click()
@ -73,7 +79,7 @@ export const genTest = (type, xcdb) => {
// submit button & validate
cy.get('.nc-form').find('button').contains('Submit').click()
cy.wait(3000)
cy.toastWait('Saved successfully')
})
})
@ -81,9 +87,10 @@ export const genTest = (type, xcdb) => {
// 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)
mainPage.filterField('testAttach', 'is not null', null)
cy.wait(1000)
mainPage.hideUnhideField('LastUpdate')
const verifyCsv = (retrievedRecords) => {

9
scripts/cypress/integration/common/6g_base_share.js

@ -46,15 +46,6 @@ export const genTest = (type, xcdb) => {
}
describe(`${type.toUpperCase()} Base VIEW share`, () => {
// before(() => {
// cy.waitForSpinners();
// cy.signinOrSignup(roles.owner.credentials)
// cy.wait(2000)
// })
// after(() => {
// cy.closeTableTab('Country')
// })
it(`Generate base share URL`, () => {
// click SHARE

7
scripts/cypress/integration/common/7a_create_project_from_excel.js

@ -66,9 +66,6 @@ export const genTest = (type, xcdb) => {
describe(`Import from excel`, () => {
before(() => {
// cy.waitForSpinners()
// cy.signinOrSignup(roles.owner.credentials)
// cy.wait(2000)
cy.task('readSheetList', { file: `./scripts/cypress/fixtures/${filepath}` })
.then((rows) => {
@ -182,8 +179,8 @@ export const genTest = (type, xcdb) => {
// delete project once all operations are completed
mainPage.toolBarTopLeft(mainPage.HOME).click()
cy.wait(1000)
cy.get(`.nc-${type}-project-row .mdi-delete-circle-outline`, { timeout: 10000 })
.should('exist')
.last()
.invoke('show')
.click();
@ -277,8 +274,8 @@ export const genTest = (type, xcdb) => {
after(() => {
// delete project once all operations are completed
mainPage.toolBarTopLeft(mainPage.HOME).click()
cy.wait(1000)
cy.get(`.nc-${type}-project-row .mdi-delete-circle-outline`, { timeout: 10000 })
.should('exist')
.last()
.invoke('show')
.click();

4
scripts/cypress/integration/spec/roleValidation.spec.js

@ -143,13 +143,13 @@ export function _editComment(roleType, previewMode) {
else {
cy.getActiveModal().find('.mdi-comment-multiple-outline').should('exist').click()
cy.getActiveModal().find('.comment-box').type('Comment-1{enter}')
// cy.toastWait('Comment added successfully')
cy.getActiveModal().find('.mdi-door-open').click()
cy.get('body').contains(validationString, { timeout: 2000 }).should('exist')
cy.wait(1000)
}
cy.getActiveModal().find('button').contains('Cancel').click()
cy.getActiveModal().find('button').contains('Cancel').should('exist').click()
cy.get('body').type('{esc}')
}

8
scripts/cypress/support/commands.js

@ -46,7 +46,7 @@ Cypress.Commands.add('signinOrSignup', (_args) => {
// signin/signup
cy.get('body').then(($body) => {
cy.wait(1000)
// cy.wait(1000)
cy.url().then(url => {
if (!url.includes('/projects')) {
// handle initial load
@ -78,7 +78,7 @@ Cypress.Commands.add('openOrCreateRestProject', (_args) => {
// signin/signup
cy.signinOrSignup()
cy.wait(2000);
cy.get('.nc-new-project-menu').should('exist')
cy.get('body').then($body => {
const filter = args.meta ? '.nc-meta-project-row' : ':not(.nc-meta-project-row)';
// if project exist open
@ -109,6 +109,7 @@ Cypress.Commands.add('openOrCreateRestProject', (_args) => {
Cypress.Commands.add('openTableTab', (tn) => {
cy.get('.nc-project-tree')
.find('.v-list-item__title:contains(Tables)', { timeout: 10000 })
.should('exist')
.first().click()
cy.get('.nc-project-tree')
@ -124,7 +125,6 @@ Cypress.Commands.add('openTableTab', (tn) => {
.first().click()
// wait for page to load
cy.wait(500)
})
Cypress.Commands.add('closeTableTab', (tn) => {
@ -136,7 +136,7 @@ Cypress.Commands.add('openOrCreateGqlProject', (_args) => {
cy.signinOrSignup()
cy.wait(2000);
cy.get('.nc-new-project-menu').should('exist')
cy.get('body').then($body => {
const filter = args.meta ? '.nc-meta-project-row' : ':not(.nc-meta-project-row)';
// if project exist open

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

@ -93,6 +93,8 @@ export class _mainPage {
cy.getActiveMenu().contains(roleType).click()
cy.get('.nc-invite-or-save-btn').click()
cy.toastWait('Successfully updated the user details')
// get URL, invoke
cy.getActiveModal().find('.v-alert').then(($obj) => {
linkText = $obj.text().trim()
@ -100,19 +102,6 @@ export class _mainPage {
this.roleURL[roleType] = linkText
cy.get('body').click('right')
// cy.visit(linkText)
// cy.wait(3000)
// // Redirected to new URL, feed details
// //
// cy.get('input[type="text"]').type(userCred.username)
// cy.get('input[type="password"]').type(userCred.password)
// cy.get('button:contains("SIGN UP")').click()
// cy.url({ timeout: 6000 }).should('contain', '#/project')
// cy.wait(1000)
})
}
@ -128,7 +117,7 @@ export class _mainPage {
//
cy.getActiveMenu().contains(role).click()
cy.get('.nc-invite-or-save-btn').click()
cy.wait(1000)
cy.toastWait('Successfully updated the user details')
this.roleURL[role] = "http://localhost:3000/#/user/authentication/signin"
}
@ -157,7 +146,7 @@ export class _mainPage {
cy.toastWait(`Update table.${tableName} successful`)
}
addColumnWithType = (colName, colType) => {
addColumnWithType = (colName, colType, tableName) => {
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)
@ -166,7 +155,7 @@ export class _mainPage {
cy.getActiveMenu().contains(colType).click()
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
cy.wait(500)
cy.toastWait(`Update table.${tableName} successful`)
}
deleteColumn = (colName) => {
@ -195,6 +184,7 @@ export class _mainPage {
cy.getActiveModal().find('[placeholder="Port"]').click().type(port)
cy.getActiveModal().find('[placeholder="Secure"]').click().type(secure)
cy.getActiveModal().find('button').contains('Save').click()
cy.toastWait('Successfully installed and email notification will use SMTP configuration')
}
resetSMTP = () => {
@ -205,6 +195,7 @@ export class _mainPage {
.contains(" Reset ")
.click({ force: true })
cy.getActiveModal().find('button').contains('Submit').click()
cy.toastWait('Plugin uninstalled successfully')
}
hideUnhideField = (field) => {
@ -240,6 +231,10 @@ export class _mainPage {
if ((operation != 'is null') && (operation != 'is not null')) {
cy.get('.nc-filter-value-select input:text').last().type(`${value}`);
}
cy.get('.nc-filter-field-select').find('.v-select__slot').contains(field).should('exist')
cy.get('.nc-filter-operation-select').find('.v-select__slot').contains(operation).should('exist')
cy.get('.nc-filter-menu-btn').click()
}
@ -263,7 +258,7 @@ export class _mainPage {
// cy.get('.container').find('button.mdi-delete-outline')
cy.get('th:contains("View Link")').parent().parent()
cy.get('th:contains("View Link")').should('exist').parent().parent()
.next().find('tr').each(($tableRow) => {
cy.log($tableRow[0].childElementCount)
@ -275,6 +270,7 @@ export class _mainPage {
})
.then(() => {
cy.get('.v-overlay__content > .d-flex > .v-icon').click()
cy.toastWait('Deleted shared view successfully')
})
}
@ -288,12 +284,7 @@ export class _mainPage {
cy.get('.nc-actions-menu-btn').click()
cy.get(`.menuable__content__active .v-list-item span:contains("Download as CSV")`).click()
// Toast verification disabled as for larger table, multiple toasts appear before success one
// for each partitioned file
// cy.get('.toasted', { timeout: 5000 })
// .contains('Successfully exported all table data')
// .should('exist')
cy.wait(5000)
cy.toastWait('Successfully exported all table data')
.then(() => {
// download folder path, read from config file

53
scripts/cypress/support/page_objects/navigation.js

@ -49,7 +49,7 @@ export class _loginPage {
//
waitProjectPageLoad() {
cy.url({ timeout: 6000 }).should('contain', '#/project')
cy.wait(1000)
cy.get('.nc-new-project-menu').should('exist')
}
// standard pre-project activity
@ -88,7 +88,7 @@ export class _projectsPage {
// TODO: add projectName validation
//
openProject(projectName) {
cy.get('tbody').contains('tr', projectName).click()
cy.get('tbody').contains('tr', projectName).should('exist').click()
// takes a while to load project
this.waitHomePageLoad()
@ -153,11 +153,6 @@ export class _projectsPage {
cy.contains('GRAPHQL APIs').closest('label').click();
}
// External database credentials
// cy.contains('Database Type').parent().find('input').eq(1).click()
// cy.wait(100)
// cy.get('body').contains(' MySQL ').parents('div').click()
if (cred.hostAddress != '') cy.contains('Host Address').parent().find('input').clear().type(cred.hostAddress)
if (cred.portNumber != '') cy.contains('Port Number').parent().find('input').clear().type(cred.portNumber)
if (cred.username != '') cy.contains('Username').parent().find('input').clear().type(cred.username)
@ -193,7 +188,6 @@ export class _projectsPage {
//
refreshProject() {
cy.contains('My Projects').parent().find('button').click();
cy.wait(1000)
}
// search project with given key
@ -225,7 +219,8 @@ export class _projectsPage {
// delete icon
cy.get('tbody').contains('tr', name).find('.mdi-delete-circle-outline').click()
this.waitDeletePageLoad()
cy.toastWait('deleted successfully')
// this.waitDeletePageLoad()
// pop-up, submit
cy.get('body').then((body) => {
@ -238,37 +233,33 @@ export class _projectsPage {
// 1. read all project names to be deleted, store in array
// 2. invoke delete project for each entry in array
//
deleteAllProject() {
// deleteAllProject() {
const projectName = []
// const projectName = []
cy.get('table tr').each((tableRow) => {
// cy.get('table tr').each((tableRow) => {
cy.wrap(tableRow).find('td').eq(0).find('.title').then((input) => {
projectName.push(input.text())
})
})
.then(() => {
console.log(projectName)
projectName.forEach(element => {
// cy.wrap(tableRow).find('td').eq(0).find('.title').then((input) => {
// projectName.push(input.text())
// })
// })
// .then(() => {
// console.log(projectName)
// projectName.forEach(element => {
// bring back the DOM to normalcy
cy.get('div').parentsUntil('body')
this.deleteProject(element)
// // bring back the DOM to normalcy
// cy.get('div').parentsUntil('body')
// this.deleteProject(element)
// wait needed for pop up to disapper
this.waitDeletePageLoad()
})
})
}
// // wait needed for pop up to disapper
// this.waitDeletePageLoad()
// })
// })
// }
waitHomePageLoad() {
cy.url({ timeout: 50000 }).should('contain', '&dbalias=')
}
waitDeletePageLoad() {
cy.wait(1000)
}
}
export const loginPage = new _loginPage;

Loading…
Cancel
Save