Browse Source

[test] cypress: user role validation- try/catch errors

Signed-off-by: Raju Udava <sivadstala@gmail.com>
pull/697/head
Raju Udava 3 years ago
parent
commit
1634bd534e
  1. 55
      cypress/integration/common/5a_user_role.js
  2. 3
      cypress/integration/common/5b_preview_role.js
  3. 10
      cypress/integration/common/6c_swagger_api.js
  4. 4
      cypress/support/page_objects/navigation.js

55
cypress/integration/common/5a_user_role.js

@ -70,12 +70,26 @@ export const genTest = (type, xcdb) => {
// projectsPage.openProject(staticProjects.externalGQL.basic.name)
// })
it(`[${roles[roleType].name}] Left navigation menu, New User add`, () => {
it(`[${roles[roleType].name}] Left navigation menu, New User add`, (done) => {
cy.on('uncaught:exception', (err, runnable) => {
expect(err.message).to.include('Not allowed')
done()
return false
})
advancedSettings(roleType)
done()
})
it(`[${roles[roleType].name}] Schema: create table, add/modify/delete column`, () => {
it(`[${roles[roleType].name}] Schema: create table, add/modify/delete column`, (done) => {
cy.on('uncaught:exception', (err, runnable) => {
expect(err.message).to.include('Not allowed')
done()
return false
})
editSchema(roleType)
done()
})
it(`[${roles[roleType].name}] Data: add/modify/delete row, update cell contents`, (done) => {
@ -95,22 +109,43 @@ export const genTest = (type, xcdb) => {
done()
})
it(`[${roles[roleType].name}] Comments: view/add`, () => {
it(`[${roles[roleType].name}] Comments: view/add`, (done) => {
cy.on('uncaught:exception', (err, runnable) => {
expect(err.message).to.include('Not allowed')
done()
return false
})
// Fix me!
if (roleType != 'viewer')
editComment(roleType)
done()
})
it(`[${roles[roleType].name}] Right navigation menu, share view`, () => {
it(`[${roles[roleType].name}] Right navigation menu, share view`, (done) => {
cy.on('uncaught:exception', (err, runnable) => {
expect(err.message).to.include('Not allowed')
done()
return false
})
viewMenu(roleType)
})
after(() => {
if ('viewer' == roleType) {
loginPage.loginAndOpenProject(type)
}
done()
})
// after(() => {
// if ('viewer' == roleType) {
// loginPage.loginAndOpenProject('graphql', false)
// }
// })
// it(`Reset`, () => {
// if ('viewer' == roleType) {
// loginPage.loginAndOpenProject('graphql', false)
// }
// })
})
}

3
cypress/integration/common/5b_preview_role.js

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

10
cypress/integration/common/6c_swagger_api.js

@ -173,11 +173,11 @@ export const genTest = (type, xcdb) => {
})
// clean-up created file (shared.json)
after(() => {
cy.exec("del shared.json").then(()=> {
cy.log("file cleaned up!")
})
})
// after(() => {
// cy.exec("del shared.json").then(()=> {
// cy.log("file cleaned up!")
// })
// })
})
}
}

4
cypress/support/page_objects/navigation.js

@ -26,7 +26,7 @@ export class _loginPage {
signIn(userCredentials) {
this.go(urlPool.ncUrlSignIn)
cy.get('input[type="text"]', {timeout: 6000}).type(userCredentials.username)
cy.get('input[type="text"]', {timeout: 20000}).type(userCredentials.username)
cy.get('input[type="password"]').type(userCredentials.password)
cy.get('button:contains("SIGN IN")').click()
@ -38,7 +38,7 @@ export class _loginPage {
signUp(userCredentials) {
this.go(urlPool.ncUrlSignUp)
cy.get('input[type="text"]', {timeout: 6000}).type(userCredentials.username)
cy.get('input[type="text"]', {timeout: 20000}).type(userCredentials.username)
cy.get('input[type="password"]').type(userCredentials.password)
cy.get('button:contains("SIGN UP")').click()

Loading…
Cancel
Save