Browse Source

[test] cypress: run-time optimization/ phase-1: by reducing file specific logins

Signed-off-by: Raju Udava <sivadstala@gmail.com>
pull/653/head
Raju Udava 3 years ago
parent
commit
d224edd68e
  1. 24
      cypress.json
  2. 100
      cypress/integration/common/00_pre_configurations.js
  3. 6
      cypress/integration/common/0a_project_operations.js
  4. 10
      cypress/integration/common/1a_table_operations.js
  5. 8
      cypress/integration/common/1b_table_column_operations.js
  6. 8
      cypress/integration/common/1c_table_row_operations.js
  7. 12
      cypress/integration/common/2a_table_with_belongs_to_colulmn.js
  8. 15
      cypress/integration/common/2b_table_with_m2m_column.js
  9. 12
      cypress/integration/common/3a_filter_sort_fields_operations.js
  10. 12
      cypress/integration/common/3b_formula_column.js
  11. 12
      cypress/integration/common/3c_lookup_column.js
  12. 11
      cypress/integration/common/3d_rollup_column.js
  13. 11
      cypress/integration/common/4a_table_view_grid_gallery_form.js
  14. 11
      cypress/integration/common/4b_table_view_share.js
  15. 19
      cypress/integration/common/4c_form_view_detailed.js
  16. 14
      cypress/integration/common/4d_table_view_grid_locked.js
  17. 12
      cypress/integration/common/4e_form_view_share.js
  18. 26
      cypress/integration/common/5a_user_role.js
  19. 13
      cypress/integration/common/5b_preview_role.js
  20. 6
      cypress/integration/common/6a_audit.js
  21. 4
      cypress/integration/common/6c_swagger_api.js
  22. 105
      cypress/integration/common/6d_language_validation.js
  23. 48
      cypress/integration/test/explicitLogin.js
  24. 84
      cypress/integration/test/masterSuite.js
  25. 17
      cypress/support/commands.js

24
cypress.json

@ -1,30 +1,8 @@
{
"baseUrl": "http://localhost:3000/",
"testFiles": [
"common/00_pre_configurations.js",
"common/0a_project_operations.js",
"common/1a_table_operations.js",
"common/1b_table_column_operations.js",
"common/1c_table_row_operations.js",
"common/2a_table_with_belongs_to_colulmn.js",
"common/2b_table_with_m2m_column.js",
"common/3a_filter_sort_fields_operations.js",
"common/3b_formula_column.js",
"common/3c_lookup_column.js",
"common/3d_rollup_column.js",
"common/4a_table_view_grid_gallery_form.js",
"common/4c_form_view_detailed.js",
"common/4d_table_view_grid_locked.js",
"common/4e_form_view_share.js",
"common/5a_user_role.js",
"common/5b_preview_role.js",
"common/6a_audit.js",
"common/6c_swagger_api.js",
"common/6d_language_validation.js"
"test/masterSuite.js"
],
"onholdFiles": [
"cypress/integration/common/4c_form_view_detailed.js"
],
"defaultCommandTimeout": 13000,
"pageLoadTimeout": 600000,
"viewportWidth": 1980,

100
cypress/integration/common/00_pre_configurations.js

@ -6,70 +6,72 @@ import { loginPage, projectsPage } from "../../support/page_objects/navigation"
import { mainPage } from "../../support/page_objects/mainPage"
import { staticProjects, roles, isTestSuiteActive, getPrimarySuite, isSecondarySuite } from "../../support/page_objects/projectConstants"
describe(`Project pre-configurations`, () => {
export const genTest = () => {
it('Admin SignUp', ()=> {
cy.waitForSpinners();
cy.signinOrSignup(roles.owner.credentials)
cy.wait(2000)
})
const createProject = (proj) => {
it(`Create ${proj.basic.name} project`, () => {
describe(`Project pre-configurations`, () => {
// click home button
mainPage.toolBarTopLeft(mainPage.HOME).click()
// create requested project
projectsPage.createProject( proj.basic, proj.config )
})
}
it('Admin SignUp', () => {
cy.waitForSpinners();
cy.signinOrSignup(roles.owner.credentials)
cy.wait(2000)
})
if( isTestSuiteActive('rest', true) ) createProject(staticProjects.sampleREST)
if( isTestSuiteActive('graphql', true) ) createProject(staticProjects.sampleGQL)
if( isTestSuiteActive('rest', false) ) createProject(staticProjects.externalREST)
if( isTestSuiteActive('graphql', false) ) createProject(staticProjects.externalGQL)
})
const createProject = (proj) => {
it(`Create ${proj.basic.name} project`, () => {
describe('Static user creations (different roles)', () => {
// click home button
mainPage.toolBarTopLeft(mainPage.HOME).click()
// create requested project
projectsPage.createProject(proj.basic, proj.config)
})
}
beforeEach(()=> {
loginPage.signIn(roles.owner.credentials)
projectsPage.openProject(getPrimarySuite().basic.name)
if (isTestSuiteActive('rest', true)) createProject(staticProjects.sampleREST)
if (isTestSuiteActive('graphql', true)) createProject(staticProjects.sampleGQL)
if (isTestSuiteActive('rest', false)) createProject(staticProjects.externalREST)
if (isTestSuiteActive('graphql', false)) createProject(staticProjects.externalGQL)
})
const addUser = (user) => {
it(`RoleType: ${user.name}`, () => {
mainPage.addNewUserToProject(user.credentials, user.name)
describe('Static user creations (different roles)', () => {
beforeEach(() => {
loginPage.signIn(roles.owner.credentials)
projectsPage.openProject(getPrimarySuite().basic.name)
})
}
addUser(roles.creator)
addUser(roles.editor)
addUser(roles.commenter)
addUser(roles.viewer)
})
const addUser = (user) => {
it(`RoleType: ${user.name}`, () => {
mainPage.addNewUserToProject(user.credentials, user.name)
})
}
describe('Static users- add to other static projects', () => {
addUser(roles.creator)
addUser(roles.editor)
addUser(roles.commenter)
addUser(roles.viewer)
})
const addUserToProject = (proj) => {
it(`Add users to ${proj.basic.name}`, () => {
loginPage.signIn(roles.owner.credentials)
projectsPage.openProject(proj.basic.name)
describe('Static users- add to other static projects', () => {
mainPage.addExistingUserToProject(roles.creator.credentials.username, roles.creator.name)
mainPage.addExistingUserToProject(roles.editor.credentials.username, roles.editor.name)
mainPage.addExistingUserToProject(roles.commenter.credentials.username, roles.commenter.name)
mainPage.addExistingUserToProject(roles.viewer.credentials.username, roles.viewer.name)
})
}
const addUserToProject = (proj) => {
it(`Add users to ${proj.basic.name}`, () => {
loginPage.signIn(roles.owner.credentials)
projectsPage.openProject(proj.basic.name)
if( isSecondarySuite('rest', true) ) addUserToProject(staticProjects.sampleREST)
if( isSecondarySuite('graphql', true) ) addUserToProject(staticProjects.sampleGQL)
if( isSecondarySuite('rest', false) ) addUserToProject(staticProjects.externalREST)
if( isSecondarySuite('graphql', false) ) addUserToProject(staticProjects.externalGQL)
})
mainPage.addExistingUserToProject(roles.creator.credentials.username, roles.creator.name)
mainPage.addExistingUserToProject(roles.editor.credentials.username, roles.editor.name)
mainPage.addExistingUserToProject(roles.commenter.credentials.username, roles.commenter.name)
mainPage.addExistingUserToProject(roles.viewer.credentials.username, roles.viewer.name)
})
}
if (isSecondarySuite('rest', true)) addUserToProject(staticProjects.sampleREST)
if (isSecondarySuite('graphql', true)) addUserToProject(staticProjects.sampleGQL)
if (isSecondarySuite('rest', false)) addUserToProject(staticProjects.externalREST)
if (isSecondarySuite('graphql', false)) addUserToProject(staticProjects.externalGQL)
})
}
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

6
cypress/integration/common/0a_project_operations.js

@ -2,7 +2,7 @@ import { loginPage } from "../../support/page_objects/navigation"
import { roles } from "../../support/page_objects/projectConstants"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
const genTest = (type, xcdb) => {
export const genTest = (type, xcdb) => {
describe(`${type.toUpperCase()} Project operations`, () => {
if(!isTestSuiteActive(type, xcdb)) return;
@ -59,8 +59,8 @@ const genTest = (type, xcdb) => {
})
}
genTest('rest', false)
genTest('graphql', false)
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

10
cypress/integration/common/1a_table_operations.js

@ -2,7 +2,7 @@
import { loginPage } from "../../support/page_objects/navigation";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
const genTest = (type, xcdb) => {
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${xcdb ? 'Meta - ' : ''}${type.toUpperCase()} api - Table`, () => {
@ -49,10 +49,10 @@ const genTest = (type, xcdb) => {
}
genTest('rest', false)
genTest('graphql', false)
genTest('rest', true)
genTest('graphql', true)
// genTest('rest', false)
// genTest('graphql', false)
// genTest('rest', true)
// genTest('graphql', true)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

8
cypress/integration/common/1b_table_column_operations.js

@ -3,7 +3,7 @@ import { loginPage } from "../../support/page_objects/navigation"
import { mainPage } from "../../support/page_objects/mainPage"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
const genTest = (type, xcdb) => {
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Table Column`, () => {
@ -12,7 +12,7 @@ const genTest = (type, xcdb) => {
const updatedColName = 'updated_column_name'
before(() => {
loginPage.loginAndOpenProject(type)
// loginPage.loginAndOpenProject(type)
cy.createTable(name)
});
@ -87,8 +87,8 @@ const genTest = (type, xcdb) => {
})
}
genTest('rest', false)
genTest('graphql', false)
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

8
cypress/integration/common/1c_table_row_operations.js

@ -2,7 +2,7 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
const genTest = (type, xcdb) => {
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Table Row`, () => {
@ -11,7 +11,7 @@ const genTest = (type, xcdb) => {
const name = 'Tablerow' + Date.now();
before(() => {
loginPage.loginAndOpenProject(type)
//loginPage.loginAndOpenProject(type)
cy.createTable(name)
});
@ -52,8 +52,8 @@ const genTest = (type, xcdb) => {
});
}
genTest('rest', false)
genTest('graphql', false)
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

12
cypress/integration/common/2a_table_with_belongs_to_colulmn.js

@ -2,11 +2,11 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
const genTest = (type, xcdb) => {
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Existing table`, () => {
before(() => loginPage.loginAndOpenProject(type))
// before(() => loginPage.loginAndOpenProject(type))
it('Table column header, URL validation', () => {
cy.openTableTab('Country')
@ -33,12 +33,16 @@ const genTest = (type, xcdb) => {
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('Batna').should('exist')
cy.getActiveModal().find('button.mdi-close').click()
cy.wait(200)
cy.getActiveModal().find('button.mdi-close').click()
})
})
}
genTest('rest')
genTest('graphql')
// genTest('rest')
// genTest('graphql')
/**

15
cypress/integration/common/2b_table_with_m2m_column.js

@ -2,14 +2,18 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
const genTest = (type, xcdb) => {
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - M2M Column validation`, () => {
before(() => {
loginPage.loginAndOpenProject(type)
// loginPage.loginAndOpenProject(type)
cy.openTableTab('Actor')
})
after(() => {
cy.get('[href="#table||db||Actor"]').find('button.mdi-close').click()
})
it('Table column header, URL validation', () => {
@ -52,12 +56,15 @@ const genTest = (type, xcdb) => {
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)
// genTest('rest', false)
// genTest('graphql', false)
/**

12
cypress/integration/common/3a_filter_sort_fields_operations.js

@ -3,12 +3,12 @@ import { mainPage } from "../../support/page_objects/mainPage"
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
const genTest = (type, xcdb) => {
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Filter, Fields, Sort`, () => {
before(() => {
loginPage.loginAndOpenProject(type)
// loginPage.loginAndOpenProject(type)
// open country table
cy.openTableTab('Country');
@ -16,6 +16,10 @@ const genTest = (type, xcdb) => {
})
after(() => {
cy.get('[href="#table||db||Country"]').find('button.mdi-close').click()
})
describe(`Pagination`, () => {
// check pagination
it('Check country table - Pagination', () => {
@ -171,8 +175,8 @@ const genTest = (type, xcdb) => {
})
}
genTest('rest', false)
genTest('graphql', false)
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

12
cypress/integration/common/3b_formula_column.js

@ -2,7 +2,7 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
const genTest = (type, xcdb) => {
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - FORMULA`, () => {
@ -10,13 +10,17 @@ const genTest = (type, xcdb) => {
// Run once before test- create project (rest/graphql)
//
before(() => {
loginPage.loginAndOpenProject(type)
// loginPage.loginAndOpenProject(type)
// open a table to work on views
//
cy.openTableTab('City');
})
after(() => {
cy.get('[href="#table||db||City"]').find('button.mdi-close').click()
})
// Given rowname & expected result for first 10 entries, validate
// NOTE: Scroll issue with Cypress automation, to fix
// validating partial data, row number 5 to 9
@ -184,8 +188,8 @@ const genTest = (type, xcdb) => {
})
}
genTest('rest', false)
genTest('graphql', false)
// genTest('rest', false)
// genTest('graphql', false)
/**

12
cypress/integration/common/3c_lookup_column.js

@ -2,7 +2,7 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
const genTest = (type, xcdb) => {
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - LookUp column`, () => {
@ -19,13 +19,17 @@ const genTest = (type, xcdb) => {
// Run once before test- create project (rest/graphql)
//
before(() => {
loginPage.loginAndOpenProject(type)
// loginPage.loginAndOpenProject(type)
// open a table to work on views
//
cy.openTableTab('City');
})
after(() => {
cy.get('[href="#table||db||City"]').find('button.mdi-close').click()
})
// Routine to create a new look up column
//
const addLookUpColumn = (childTable, childCol) => {
@ -117,8 +121,8 @@ const genTest = (type, xcdb) => {
}
genTest('rest', false)
genTest('graphql', false)
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

11
cypress/integration/common/3d_rollup_column.js

@ -1,7 +1,7 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
const genTest = (type, xcdb) => {
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - RollUp column`, () => {
@ -18,13 +18,16 @@ const genTest = (type, xcdb) => {
// Run once before test- create project (rest/graphql)
//
before(() => {
loginPage.loginAndOpenProject(type)
// loginPage.loginAndOpenProject(type)
// open a table to work on views
//
cy.openTableTab('Country');
})
after(() => {
cy.get('[href="#table||db||Country"]').find('button.mdi-close').click()
})
// Routine to create a new look up column
//
@ -152,8 +155,8 @@ const genTest = (type, xcdb) => {
});
}
genTest('rest', false)
genTest('graphql', false)
// genTest('rest', false)
// genTest('graphql', false)
/**

11
cypress/integration/common/4a_table_view_grid_gallery_form.js

@ -1,7 +1,7 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
const genTest = (type, xcdb) => {
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Table views`, () => {
@ -11,13 +11,16 @@ const genTest = (type, xcdb) => {
// Run once before test- create project (rest/graphql)
//
before(() => {
loginPage.loginAndOpenProject(type)
// loginPage.loginAndOpenProject(type)
// open a table to work on views
//
cy.openTableTab('Country');
})
after(() => {
cy.get('[href="#table||db||Country"]').find('button.mdi-close').click()
})
// Common routine to create/edit/delete GRID & GALLERY view
// Input: viewType - 'grid'/'gallery'
@ -76,8 +79,8 @@ const genTest = (type, xcdb) => {
// invoke for different API types supported
//
genTest('rest', false)
genTest('graphql', false)
// genTest('rest', false)
// genTest('graphql', false)
/**

11
cypress/integration/common/4b_table_view_share.js

@ -82,7 +82,7 @@ const deleteCreatedViews = () => {
})
}
const genTest = (type, xcdb) => {
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Clipboard access`, () => {
@ -90,7 +90,7 @@ const genTest = (type, xcdb) => {
// Run once before test- create project (rest/graphql)
//
beforeEach(() => {
loginPage.loginAndOpenProject(type)
// loginPage.loginAndOpenProject(type)
cy.openTableTab('City');
})
@ -108,6 +108,9 @@ const genTest = (type, xcdb) => {
it('Delete view', deleteCreatedViews )
after(() => {
cy.get('[href="#table||db||City"]').find('button.mdi-close').click()
})
// // clean up
// after( () => {
// loginPage.signIn({ username: 'user@nocodb.com', password: 'Password123.' })
@ -116,8 +119,8 @@ const genTest = (type, xcdb) => {
})
}
genTest('rest', false)
genTest('graphql', false)
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

19
cypress/integration/common/4c_form_view_detailed.js

@ -4,7 +4,7 @@ import { mainPage } from "../../support/page_objects/mainPage"
let formViewURL
const genTest = (type, xcdb) => {
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Table views`, () => {
@ -14,7 +14,7 @@ const genTest = (type, xcdb) => {
// Run once before test- create project (rest/graphql)
//
before(() => {
loginPage.loginAndOpenProject(type)
// loginPage.loginAndOpenProject(type)
// open a table to work on views
//
@ -28,7 +28,10 @@ const genTest = (type, xcdb) => {
afterEach(() => {
cy.saveLocalStorage();
})
after(() => {
cy.get('[href="#table||db||Country"]').find('button.mdi-close').click()
})
// Common routine to create/edit/delete GRID & GALLERY view
// Input: viewType - 'grid'/'gallery'
@ -242,9 +245,9 @@ 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 informing installation of email notification
cy.get('.toasted:visible', { timout: 6000 })
.contains('Successfully installed and email notification will use SMTP configuration')
.should('exist')
// cy.get('.toasted:visible', { timout: 6000 })
// .contains('Successfully installed and email notification will use SMTP configuration')
// .should('exist')
// reset SMPT config's
mainPage.navigationDraw(mainPage.APPSTORE).click()
mainPage.resetSMTP()
@ -326,8 +329,8 @@ const genTest = (type, xcdb) => {
// invoke for different API types supported
//
genTest('rest', false)
genTest('graphql', false)
// genTest('rest', false)
// genTest('graphql', false)
/**

14
cypress/integration/common/4d_table_view_grid_locked.js

@ -2,22 +2,26 @@ import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { mainPage } from "../../support/page_objects/mainPage"
const genTest = (type, xcdb) => {
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Table views`, () => {
// Run once before test- create project (rest/graphql)
//
before(() => {
loginPage.loginAndOpenProject(type)
// loginPage.loginAndOpenProject(type)
// open a table to work on views
//
cy.openTableTab('Country');
})
after(() => {
cy.get('[href="#table||db||Country"]').find('button.mdi-close').click()
})
const lockViewTest = (enabled) => {
it.only(`Grid: lock view set to ${enabled}: validation`, () => {
it(`Grid: lock view set to ${enabled}: validation`, () => {
let vString = enabled ? 'not.' : ''
let menuOption = enabled ? 1 : 0
@ -66,8 +70,8 @@ const genTest = (type, xcdb) => {
// invoke for different API types supported
//
genTest('rest', false)
genTest('graphql', false)
// genTest('rest', false)
// genTest('graphql', false)
/**

12
cypress/integration/common/4e_form_view_share.js

@ -4,7 +4,7 @@ import { mainPage } from "../../support/page_objects/mainPage"
let baseURL = ''
const genTest = (type, xcdb) => {
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Table views`, () => {
@ -14,7 +14,7 @@ const genTest = (type, xcdb) => {
// Run once before test- create project (rest/graphql)
//
before(() => {
loginPage.loginAndOpenProject(type)
// loginPage.loginAndOpenProject(type)
// open a table to work on views
//
@ -29,6 +29,10 @@ const genTest = (type, xcdb) => {
cy.saveLocalStorage();
})
after(() => {
cy.get('[href="#table||db||City"]').find('button.mdi-close').click()
})
// Common routine to create/edit/delete GRID & GALLERY view
// Input: viewType - 'grid'/'gallery'
@ -161,8 +165,8 @@ const genTest = (type, xcdb) => {
// invoke for different API types supported
//
genTest('rest', false)
genTest('graphql', false)
// genTest('rest', false)
// genTest('graphql', false)
/**

26
cypress/integration/common/5a_user_role.js

@ -3,7 +3,7 @@ import { mainPage } from "../../support/page_objects/mainPage"
import { roles, staticProjects } from "../../support/page_objects/projectConstants"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
const genTest = (type, roleType) => {
export const genTest = (type, roleType) => {
if(!isTestSuiteActive(type, false)) return;
describe(`User role validation`, () => {
@ -223,19 +223,23 @@ const genTest = (type, roleType) => {
it(`[${roles[roleType].name}] Right navigation menu, share view`, () => {
viewMenu(roleType)
})
after(() => {
loginPage.loginAndOpenProject(type)
})
})
}
genTest('rest', 'owner')
genTest('rest', 'creator')
genTest('rest', 'editor')
genTest('rest', 'commenter')
genTest('rest', 'viewer')
genTest('graphql', 'owner')
genTest('graphql', 'creator')
genTest('graphql', 'editor')
genTest('graphql', 'commenter')
genTest('graphql', 'viewer')
// genTest('rest', 'owner')
// genTest('rest', 'creator')
// genTest('rest', 'editor')
// genTest('rest', 'commenter')
// genTest('rest', 'viewer')
// genTest('graphql', 'owner')
// genTest('graphql', 'creator')
// genTest('graphql', 'editor')
// genTest('graphql', 'commenter')
// genTest('graphql', 'viewer')
/**

13
cypress/integration/common/5b_preview_role.js

@ -14,7 +14,7 @@ const reVerificationAfterReset = false
// should we verify permissions in owner mode before preview?
const baseVerificationBeforePreview = false
const genTest = (type, xcdb, roleType) => {
export const genTest = (type, xcdb, roleType) => {
if(!isTestSuiteActive(type, xcdb)) return;
// project configuration settings
@ -237,16 +237,17 @@ const genTest = (type, xcdb, roleType) => {
describe('Role preview validations', () => {
// Sign in/ open project
before(() => {
loginPage.signIn(roles.owner.credentials)
projectsPage.openProject('externalREST')
})
// before(() => {
// loginPage.signIn(roles.owner.credentials)
// projectsPage.openProject('externalREST')
// })
after(() => {
mainPage.navigationDraw(mainPage.ROLE_VIEW).contains('Reset Preview').click()
cy.wait(3000)
mainPage.navigationDraw(mainPage.ROLE_VIEW).contains('Reset Preview').should('not.exist')
cy.get('[href="#table||db||City"]').find('button.mdi-close').click()
})
const genTestSub = (roleType) => {
@ -283,7 +284,7 @@ const genTest = (type, xcdb, roleType) => {
})
}
genTest('rest', false)
// genTest('rest', false)

6
cypress/integration/common/6a_audit.js

@ -3,7 +3,7 @@ import { mainPage } from "../../support/page_objects/mainPage"
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
const genTest = (type, xcdb) => {
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} Audit`, () => {
@ -40,8 +40,8 @@ const genTest = (type, xcdb) => {
})
}
genTest('rest', false)
genTest('graphql', false)
// genTest('rest', false)
// genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

4
cypress/integration/common/6c_swagger_api.js

@ -4,7 +4,7 @@ import { mainPage } from "../../support/page_objects/mainPage"
import { roles } from "../../support/page_objects/projectConstants"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
const genTest = (type, xcdb) => {
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`Swagger API - Test preparation`, () => {
@ -169,4 +169,4 @@ const genTest = (type, xcdb) => {
})
}
genTest('rest', false)
// genTest('rest', false)

105
cypress/integration/common/6d_language_validation.js

@ -1,61 +1,66 @@
const { mainPage } = require("../../support/page_objects/mainPage")
const { loginPage } = require("../../support/page_objects/navigation")
const { roles } = require("../../support/page_objects/projectConstants")
describe(`Language support`, () => {
export const genTest = (type, xcdb) => {
before(()=> {
loginPage.signIn(roles.owner.credentials)
})
describe(`Language support`, () => {
before(() => {
loginPage.signIn(roles.owner.credentials)
//mainPage.toolBarTopLeft(mainPage.HOME).click()
})
const langVerification = (idx, lang) => {
// pick json from the file specified
it(`Language verification: ${ lang } > Projects page`, () => {
let json = require(`../../../packages/nc-gui/lang/${ lang }`);
const langVerification = (idx, lang) => {
// pick json from the file specified
it(`Language verification: ${lang} > Projects page`, () => {
let json = require(`../../../packages/nc-gui/lang/${lang}`);
// toggle menu as per index
cy.get('.nc-menu-translate').click()
cy.getActiveMenu().find('.v-list-item').eq(idx).click()
// toggle menu as per index
cy.get('.nc-menu-translate').click()
cy.getActiveMenu().find('.v-list-item').eq(idx).click()
// basic validations
// 1. Page title: "My Projects"
// 2. Button: "New Project"
// 3. Search box palceholder text: "Search Projects"
cy.get('b')
.contains(json.projects.my_projects)
.should('exist')
cy.get('button.v-btn')
.contains(json.projects.create_new_project_button.text)
.should('exist')
cy.get(`[placeholder="${ json.projects.search_project }"]`)
.should('exist')
})
}
// basic validations
// 1. Page title: "My Projects"
// 2. Button: "New Project"
// 3. Search box palceholder text: "Search Projects"
cy.get('b')
.contains(json.projects.my_projects)
.should('exist')
cy.get('button.v-btn')
.contains(json.projects.create_new_project_button.text)
.should('exist')
cy.get(`[placeholder="${json.projects.search_project}"]`)
.should('exist')
})
}
// Index is the order in which menu options appear
langVerification(0, 'da.json')
langVerification(1, 'de.json')
langVerification(2, 'en.json')
langVerification(3, 'es.json')
langVerification(4, 'fi.json')
langVerification(5, 'fr.json')
langVerification(6, 'hr.json')
langVerification(7, 'id.json')
langVerification(8, 'it_IT.json')
langVerification(9, 'iw.json')
langVerification(10, 'ja.json')
langVerification(11, 'ko.json')
langVerification(12, 'nl.json')
langVerification(13, 'no.json')
langVerification(14, 'pt_BR.json')
langVerification(15, 'ru.json')
langVerification(16, 'sv.json')
langVerification(17, 'th.json')
langVerification(18, 'uk.json')
langVerification(19, 'vi.json')
langVerification(20, 'zh_CN.json')
langVerification(21, 'zh_HK.json')
langVerification(22, 'zh_TW.json')
})
// Index is the order in which menu options appear
langVerification(0, 'da.json')
langVerification(1, 'de.json')
langVerification(2, 'en.json')
langVerification(3, 'es.json')
langVerification(4, 'fi.json')
langVerification(5, 'fr.json')
langVerification(6, 'hr.json')
langVerification(7, 'id.json')
langVerification(8, 'it_IT.json')
langVerification(9, 'iw.json')
langVerification(10, 'ja.json')
langVerification(11, 'ko.json')
langVerification(12, 'nl.json')
langVerification(13, 'no.json')
langVerification(14, 'pt_BR.json')
langVerification(15, 'ru.json')
langVerification(16, 'sv.json')
langVerification(17, 'th.json')
langVerification(18, 'uk.json')
langVerification(19, 'vi.json')
langVerification(20, 'zh_CN.json')
langVerification(21, 'zh_HK.json')
langVerification(22, 'zh_TW.json')
})
}
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

48
cypress/integration/test/explicitLogin.js

@ -0,0 +1,48 @@
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 - Login & Open project`, () => {
// Run once before test- create project (rest/graphql)
//
before(() => {
loginPage.loginAndOpenProject(type)
// open a table to work on views
//
// cy.openTableTab('City');
})
it(``, () => {
cy.log('Test-1')
})
})
}
// genTest('rest', 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/>.
*
*/

84
cypress/integration/test/masterSuite.js

@ -0,0 +1,84 @@
// For single file tests-
// let t0 = require('./explicitLogin')
// t0.genTest('rest', false)
let t00 = require('../common/00_pre_configurations')
let t0a = require('../common/0a_project_operations')
let t1a = require('../common/1a_table_operations')
let t1b = require('../common/1b_table_column_operations')
let t1c = require('../common/1c_table_row_operations')
let t2a = require('../common/2a_table_with_belongs_to_colulmn')
let t2b = require('../common/2b_table_with_m2m_column')
let t3a = require('../common/3a_filter_sort_fields_operations')
let t3b = require('../common/3b_formula_column')
let t3c = require('../common/3c_lookup_column')
let t3d = require('../common/3d_rollup_column')
let t4a = require('../common/4a_table_view_grid_gallery_form')
// disabled let t4b = require('../common/4b_table_view_share')
let t4c = require('../common/4c_form_view_detailed')
let t4d = require('../common/4d_table_view_grid_locked')
let t4e = require('../common/4e_form_view_share')
let t5a = require('../common/5a_user_role')
let t5b = require('../common/5b_preview_role')
let t6a = require('../common/6a_audit')
let t6c = require('../common/6c_swagger_api')
let t6d = require('../common/6d_language_validation')
const nocoTestSuite = (type, xcdb) => {
t00.genTest()
t0a.genTest(type, xcdb)
t1a.genTest(type, xcdb)
t1b.genTest(type, xcdb)
t1c.genTest(type, xcdb)
t2a.genTest(type, xcdb)
t2b.genTest(type, xcdb)
t3a.genTest(type, xcdb)
t3b.genTest(type, xcdb)
t3c.genTest(type, xcdb)
t3d.genTest(type, xcdb)
t4a.genTest(type, xcdb)
// disabled t4b.genTest(type, xcdb)
t4c.genTest(type, xcdb)
t4d.genTest(type, xcdb)
t4e.genTest(type, xcdb)
t5a.genTest(type, 'owner')
t5a.genTest(type, 'creator')
t5a.genTest(type, 'editor')
t5a.genTest(type, 'commenter')
t5a.genTest(type, 'viewer')
t5b.genTest(type, xcdb)
t6a.genTest(type, xcdb)
t6c.genTest(type, xcdb)
t6d.genTest(type, xcdb)
}
nocoTestSuite('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/>.
*
*/

17
cypress/support/commands.js

@ -102,14 +102,23 @@ Cypress.Commands.add('openOrCreateRestProject', (_args) => {
Cypress.Commands.add('openTableTab', (tn) => {
cy.get('.nc-project-tree').find('.v-list-item__title:contains(Tables)', {timeout: 10000})
cy.get('.nc-project-tree')
.find('.v-list-item__title:contains(Tables)', { timeout: 10000 })
.first().click()
cy.get('.nc-project-tree').contains(tn, {timeout: 6000}).first().click({force: true});
cy.get('.nc-project-tree')
.contains(tn, { timeout: 6000 })
.first()
.click({ force: true });
cy.get(`.project-tab:contains(${tn}):visible`).should('exist')
cy.get(`.project-tab:contains(${tn}):visible`)
.should('exist')
cy.get('.nc-project-tree')
.find('.v-list-item__title:contains(Tables)', { timeout: 10000 })
.first().click()
})
});
Cypress.Commands.add('openOrCreateGqlProject', (_args) => {
const args = Object.assign({new: false, meta: false}, _args)

Loading…
Cancel
Save