|
|
@ -3,14 +3,128 @@ import { mainPage } from "../../support/page_objects/mainPage" |
|
|
|
import { roles, staticProjects } from "../../support/page_objects/projectConstants" |
|
|
|
import { roles, staticProjects } from "../../support/page_objects/projectConstants" |
|
|
|
import { isTestSuiteActive } from "../../support/page_objects/projectConstants" |
|
|
|
import { isTestSuiteActive } from "../../support/page_objects/projectConstants" |
|
|
|
|
|
|
|
|
|
|
|
export const genTest = (type, roleType) => { |
|
|
|
// let roleURL = {}
|
|
|
|
if(!isTestSuiteActive(type, false)) return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const genTest = (type, xcdb) => { |
|
|
|
|
|
|
|
if (!isTestSuiteActive(type, xcdb)) return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe('Static user creations (different roles)', () => { |
|
|
|
|
|
|
|
// beforeEach(() => {
|
|
|
|
|
|
|
|
// loginPage.signIn(roles.owner.credentials)
|
|
|
|
|
|
|
|
// projectsPage.openProject(getPrimarySuite().basic.name)
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
before(() => { |
|
|
|
|
|
|
|
mainPage.navigationDraw(mainPage.TEAM_N_AUTH).click() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const addUser = (user) => { |
|
|
|
|
|
|
|
it(`RoleType: ${user.name}`, () => { |
|
|
|
|
|
|
|
//let cred = { username: 'user4@nocodb.com', password: 'Password123.' }
|
|
|
|
|
|
|
|
//mainPage.addNewUserToProject(cred, user.name)
|
|
|
|
|
|
|
|
mainPage.addNewUserToProject(user.credentials, user.name) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addUser(roles.creator) |
|
|
|
|
|
|
|
addUser(roles.editor) |
|
|
|
|
|
|
|
addUser(roles.commenter) |
|
|
|
|
|
|
|
addUser(roles.viewer) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it(`Logging purpose`, () => { |
|
|
|
|
|
|
|
cy.log(mainPage.roleURL) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const roleValidation = (roleType) => { |
|
|
|
describe(`User role validation`, () => { |
|
|
|
describe(`User role validation`, () => { |
|
|
|
|
|
|
|
|
|
|
|
// project configuration settings
|
|
|
|
if (roleType != 'owner') { |
|
|
|
|
|
|
|
it(`[${roles[roleType].name}] SignIn, Open project`, () => { |
|
|
|
|
|
|
|
cy.visit(mainPage.roleURL[roleType]) |
|
|
|
|
|
|
|
cy.wait(3000) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Redirected to new URL, feed details
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
cy.get('input[type="text"]').type(roles[roleType].credentials.username) |
|
|
|
|
|
|
|
cy.get('input[type="password"]').type(roles[roleType].credentials.password) |
|
|
|
|
|
|
|
cy.get('button:contains("SIGN UP")').click() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cy.url({ timeout: 6000 }).should('contain', '#/project') |
|
|
|
|
|
|
|
cy.wait(1000) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if('rest' == type) |
|
|
|
|
|
|
|
projectsPage.openProject(staticProjects.externalREST.basic.name) |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
projectsPage.openProject(staticProjects.externalGQL.basic.name)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// Test suite
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// it(`[${roles[roleType].name}] SignIn, Open project`, () => {
|
|
|
|
|
|
|
|
// loginPage.signIn(roles[roleType].credentials)
|
|
|
|
|
|
|
|
// if('rest' == type)
|
|
|
|
|
|
|
|
// projectsPage.openProject(staticProjects.externalREST.basic.name)
|
|
|
|
|
|
|
|
// else
|
|
|
|
|
|
|
|
// projectsPage.openProject(staticProjects.externalGQL.basic.name)
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it(`[${roles[roleType].name}] Left navigation menu, New User add`, () => { |
|
|
|
|
|
|
|
advancedSettings(roleType) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it(`[${roles[roleType].name}] Schema: create table, add/modify/delete column`, () => { |
|
|
|
|
|
|
|
editSchema(roleType) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it(`[${roles[roleType].name}] Data: add/modify/delete row, update cell contents`, (/*done*/) => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// known issue: to be fixed
|
|
|
|
|
|
|
|
// right click raising alarm 'not allowed' for viewer
|
|
|
|
//
|
|
|
|
//
|
|
|
|
const advancedSettings = (roleType) => { |
|
|
|
// cy.on('uncaught:exception', (err, runnable) => {
|
|
|
|
|
|
|
|
// expect(err.message).to.include('Not allowed')
|
|
|
|
|
|
|
|
// done()
|
|
|
|
|
|
|
|
// return false
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (roleType != 'editor') |
|
|
|
|
|
|
|
editData(roleType) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// done()
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it(`[${roles[roleType].name}] Comments: view/add`, () => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Fix me!
|
|
|
|
|
|
|
|
if (roleType != 'viewer') |
|
|
|
|
|
|
|
editComment(roleType) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it(`[${roles[roleType].name}] Right navigation menu, share view`, () => { |
|
|
|
|
|
|
|
viewMenu(roleType) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
after(() => { |
|
|
|
|
|
|
|
if ('viewer' == roleType) { |
|
|
|
|
|
|
|
loginPage.loginAndOpenProject(type)
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// skip owner validation as rest of the cases pretty much cover the same
|
|
|
|
|
|
|
|
// roleValidation('owner')
|
|
|
|
|
|
|
|
roleValidation('creator') |
|
|
|
|
|
|
|
roleValidation('editor') |
|
|
|
|
|
|
|
roleValidation('commenter') |
|
|
|
|
|
|
|
roleValidation('viewer') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// project configuration settings
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
const advancedSettings = (roleType) => { |
|
|
|
|
|
|
|
|
|
|
|
// let validationString = (true == roleValidation[roleIdx].advSettings) ? 'exist' : 'not.exist'
|
|
|
|
// let validationString = (true == roleValidation[roleIdx].advSettings) ? 'exist' : 'not.exist'
|
|
|
|
let validationString = (true == roles[roleType].validations.advSettings) ? 'exist' : 'not.exist' |
|
|
|
let validationString = (true == roles[roleType].validations.advSettings) ? 'exist' : 'not.exist' |
|
|
@ -30,14 +144,14 @@ export const genTest = (type, roleType) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cy.get('button:contains("New User")').should(validationString) |
|
|
|
cy.get('button:contains("New User")').should(validationString) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Schema related validations
|
|
|
|
// Schema related validations
|
|
|
|
// - Add/delete table
|
|
|
|
// - Add/delete table
|
|
|
|
// - Add/Update/delete column
|
|
|
|
// - Add/Update/delete column
|
|
|
|
//
|
|
|
|
//
|
|
|
|
const editSchema = (roleType) => { |
|
|
|
const editSchema = (roleType) => { |
|
|
|
|
|
|
|
|
|
|
|
let columnName = 'City' |
|
|
|
let columnName = 'City' |
|
|
|
let validationString = (true == roles[roleType].validations.editSchema) ? 'exist' : 'not.exist' |
|
|
|
let validationString = (true == roles[roleType].validations.editSchema) ? 'exist' : 'not.exist' |
|
|
@ -63,13 +177,13 @@ export const genTest = (type, roleType) => { |
|
|
|
//
|
|
|
|
//
|
|
|
|
cy.get(`th:contains(${columnName}) .mdi-menu-down`).should(validationString) |
|
|
|
cy.get(`th:contains(${columnName}) .mdi-menu-down`).should(validationString) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Table data related validations
|
|
|
|
// Table data related validations
|
|
|
|
// - Add/delete/modify row
|
|
|
|
// - Add/delete/modify row
|
|
|
|
//
|
|
|
|
//
|
|
|
|
const editData = (roleType) => { |
|
|
|
const editData = (roleType) => { |
|
|
|
|
|
|
|
|
|
|
|
let columnName = 'City' |
|
|
|
let columnName = 'City' |
|
|
|
let validationString = (true == roles[roleType].validations.editData) ? 'exist' : 'not.exist' |
|
|
|
let validationString = (true == roles[roleType].validations.editData) ? 'exist' : 'not.exist' |
|
|
@ -115,14 +229,14 @@ export const genTest = (type, roleType) => { |
|
|
|
// double click cell entries to edit
|
|
|
|
// double click cell entries to edit
|
|
|
|
//
|
|
|
|
//
|
|
|
|
cy.get(`tbody > :nth-child(8) > [data-col="City"]`).dblclick().find('input').should(validationString) |
|
|
|
cy.get(`tbody > :nth-child(8) > [data-col="City"]`).dblclick().find('input').should(validationString) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// read &/ update comment
|
|
|
|
// read &/ update comment
|
|
|
|
// Viewer: only allowed to read
|
|
|
|
// Viewer: only allowed to read
|
|
|
|
// Everyone else: read &/ update
|
|
|
|
// Everyone else: read &/ update
|
|
|
|
//
|
|
|
|
//
|
|
|
|
const editComment = (roleType) => { |
|
|
|
const editComment = (roleType) => { |
|
|
|
|
|
|
|
|
|
|
|
let columnName = 'City' |
|
|
|
let columnName = 'City' |
|
|
|
let validationString = (true == roles[roleType].validations.editComment) ? 'Comment added successfully' : 'Not allowed' |
|
|
|
let validationString = (true == roles[roleType].validations.editComment) ? 'Comment added successfully' : 'Not allowed' |
|
|
@ -143,12 +257,12 @@ export const genTest = (type, roleType) => { |
|
|
|
//
|
|
|
|
//
|
|
|
|
cy.get('body').contains(validationString, { timeout: 2000 }).should('exist') |
|
|
|
cy.get('body').contains(validationString, { timeout: 2000 }).should('exist') |
|
|
|
cy.get('body').type('{esc}') |
|
|
|
cy.get('body').type('{esc}') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// right navigation menu bar
|
|
|
|
// right navigation menu bar
|
|
|
|
// Editor/Viewer/Commenter : can only view 'existing' views
|
|
|
|
// Editor/Viewer/Commenter : can only view 'existing' views
|
|
|
|
// Rest: can create/edit
|
|
|
|
// Rest: can create/edit
|
|
|
|
const viewMenu = (roleType) => { |
|
|
|
const viewMenu = (roleType) => { |
|
|
|
|
|
|
|
|
|
|
|
let columnName = 'City' |
|
|
|
let columnName = 'City' |
|
|
|
let navDrawListCnt = 2 |
|
|
|
let navDrawListCnt = 2 |
|
|
@ -173,75 +287,8 @@ export const genTest = (type, roleType) => { |
|
|
|
|
|
|
|
|
|
|
|
// cy.get(`.nc-create-grid-view`).should(validationString)
|
|
|
|
// cy.get(`.nc-create-grid-view`).should(validationString)
|
|
|
|
// cy.get(`.nc-create-gallery-view`).should(validationString)
|
|
|
|
// cy.get(`.nc-create-gallery-view`).should(validationString)
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// Test suite
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it(`[${roles[roleType].name}] SignIn, Open project`, () => { |
|
|
|
|
|
|
|
loginPage.signIn(roles[roleType].credentials) |
|
|
|
|
|
|
|
if('rest' == type) |
|
|
|
|
|
|
|
projectsPage.openProject(staticProjects.externalREST.basic.name) |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
projectsPage.openProject(staticProjects.externalGQL.basic.name) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it(`[${roles[roleType].name}] Left navigation menu, New User add`, () => { |
|
|
|
|
|
|
|
advancedSettings(roleType) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it(`[${roles[roleType].name}] Schema: create table, add/modify/delete column`, () => { |
|
|
|
|
|
|
|
editSchema(roleType) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it(`[${roles[roleType].name}] Data: add/modify/delete row, update cell contents`, (/*done*/) => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// known issue: to be fixed
|
|
|
|
|
|
|
|
// right click raising alarm 'not allowed' for viewer
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// cy.on('uncaught:exception', (err, runnable) => {
|
|
|
|
|
|
|
|
// expect(err.message).to.include('Not allowed')
|
|
|
|
|
|
|
|
// done()
|
|
|
|
|
|
|
|
// return false
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (roleType != 'editor') |
|
|
|
|
|
|
|
editData(roleType) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// done()
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it(`[${roles[roleType].name}] Comments: view/add`, () => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Fix me!
|
|
|
|
|
|
|
|
if (roleType != 'viewer') |
|
|
|
|
|
|
|
editComment(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')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd |
|
|
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd |
|
|
|
* |
|
|
|
* |
|
|
|