-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
118 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
//Tests a user's ability to create, edit, and delete a custom role in the EDA UI. | ||
import { randomString } from '../../../../framework/utils/random-string'; | ||
|
||
describe('EDA Custom Roles- Create', () => { | ||
const name = 'E2E Custom Role ' + randomString(4); | ||
before(() => { | ||
cy.edaLogin(); | ||
}); | ||
|
||
after(() => { | ||
cy.navigateTo('eda', 'roles'); | ||
cy.get('h1').should('contain', 'Roles'); | ||
cy.clickTableRow(name, true); | ||
cy.verifyPageTitle(name); | ||
cy.clickPageAction('delete-role'); | ||
cy.clickModalConfirmCheckbox(); | ||
cy.clickModalButton('Delete role'); | ||
cy.verifyPageTitle('Roles'); | ||
}); | ||
|
||
it('can create a custom role', () => { | ||
cy.navigateTo('eda', 'roles'); | ||
cy.get('h1').should('contain', 'Roles'); | ||
cy.get('[id="create-role"]').click(); | ||
cy.get('[data-cy="name"]').type(name); | ||
cy.get('[data-cy="description"]').type('This is a Custom Role.'); | ||
cy.get('[data-cy="content-type-form-group"]').click(); | ||
cy.get('[id="activation"]').click(); | ||
cy.get('[data-cy="permissions"]').click(); | ||
cy.get('[data-cy="view-activation"] input').click(); | ||
cy.clickButton(/^Create role$/); | ||
cy.hasDetail('Name', name); | ||
cy.hasDetail('Description', 'This is a Custom Role.'); | ||
}); | ||
}); | ||
|
||
describe('EDA Custom Roles- Edit & Delete', () => { | ||
const name = 'E2E Custom Role ' + randomString(4); | ||
before(() => { | ||
cy.edaLogin(); | ||
cy.navigateTo('eda', 'roles'); | ||
cy.get('h1').should('contain', 'Roles'); | ||
cy.get('[id="create-role"]').click(); | ||
cy.get('[data-cy="name"]').type(name); | ||
cy.get('[data-cy="description"]').type('This is a Custom Role.'); | ||
cy.get('[data-cy="content-type-form-group"]').click(); | ||
cy.get('[id="activation"]').click(); | ||
cy.get('[data-cy="permissions"]').click(); | ||
cy.get('[data-cy="view-activation"] input').click(); | ||
cy.clickButton(/^Create role$/); | ||
cy.hasDetail('Name', name); | ||
}); | ||
|
||
it('can edit a custom role', () => { | ||
cy.navigateTo('eda', 'roles'); | ||
cy.get('h1').should('contain', 'Roles'); | ||
cy.clickTableRow(name, true); | ||
cy.clickButton(/^Edit role$/); | ||
cy.verifyPageTitle(`Edit Role`); | ||
cy.get('[data-cy="description"]').type('this custom role has been changed'); | ||
cy.clickButton(/^Save role$/); | ||
cy.hasDetail('Description', 'this custom role has been changed'); | ||
}); | ||
|
||
it('can delete a custom role', () => { | ||
cy.navigateTo('eda', 'roles'); | ||
cy.get('h1').should('contain', 'Roles'); | ||
cy.clickTableRow(name); | ||
cy.verifyPageTitle(name); | ||
cy.clickPageAction('delete-role'); | ||
cy.clickModalConfirmCheckbox(); | ||
cy.clickModalButton('Delete role'); | ||
cy.verifyPageTitle('Roles'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,24 @@ | ||
// describe('Eda Role Details', () => { | ||
// before(() => { | ||
// cy.edaLogin(); | ||
// }); | ||
describe('Eda Role Details', () => { | ||
before(() => { | ||
cy.edaLogin(); | ||
}); | ||
|
||
// it('Role Details Pages Should Show', () => { | ||
// cy.getEdaRoles().then((roles) => { | ||
// roles.forEach((role) => { | ||
// cy.navigateTo('eda', 'roles'); | ||
// cy.clickLink(role.name); | ||
// cy.verifyPageTitle(role.name); | ||
// cy.get('[data-cy=name]').should('have.text', role.name); | ||
// cy.get('[data-cy=description]').should('have.text', role.description); | ||
// cy.getEdaRoleDetail(role.id).then((roleDetail) => { | ||
// cy.get('[data-cy=permissions-description-list]').within(() => { | ||
// for (const detail of roleDetail.permissions) { | ||
// cy.get(`[data-cy=${detail.resource_type}]`).should('be.visible'); | ||
// cy.get(`[data-cy=${detail.resource_type}]`) | ||
// .parent() | ||
// .within(() => { | ||
// for (const action of detail.action) { | ||
// cy.get(`[data-cy=${action}]`).should('be.visible'); | ||
// } | ||
// }); | ||
// } | ||
// }); | ||
// }); | ||
// }); | ||
// }); | ||
// }); | ||
// }); | ||
it('Role Details Pages Should Show', () => { | ||
cy.getEdaRoles().then((roles) => { | ||
roles.forEach((role) => { | ||
cy.navigateTo('eda', 'roles'); | ||
cy.clickTableRow(role.name, true); | ||
cy.get('[data-cy=name]').should('have.text', role.name); | ||
cy.get('[data-cy=description]').should('have.text', role.description); | ||
cy.getEdaRoleDetail(role.id).then((roleDetail) => { | ||
if (roleDetail.permissions.length > 3) { | ||
cy.get('[data-cy="permissions-description-list"] button').click(); | ||
} | ||
for (const detail of roleDetail.permissions) { | ||
cy.get(`[data-cy="${detail}"]`).should('be.visible'); | ||
} | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
/** The Roles endpoint is going to change with the EDA server's RBAC branch and these tests will need to be updated to reflect the new endpoint */ | ||
//Tests a user's ability to perform certain actions on the Roles list in the EDA UI. | ||
|
||
// describe('EDA Roles List', () => { | ||
// before(() => { | ||
// cy.edaLogin(); | ||
// }); | ||
describe('EDA Roles List', () => { | ||
before(() => { | ||
cy.edaLogin(); | ||
}); | ||
|
||
// it('can render the Roles list view and utilize the Roles links to view details', () => { | ||
// cy.navigateTo('eda', 'roles'); | ||
// cy.verifyPageTitle('Roles'); | ||
// cy.getEdaRoles().then((roles) => { | ||
// cy.get('tbody').find('tr').should('have.length', roles.length); | ||
// roles.forEach((role) => { | ||
// cy.verifyPageTitle('Roles'); | ||
// cy.clickLink(role.name); | ||
// cy.verifyPageTitle(role.name); | ||
// cy.get('#description').should('contain', role.description); | ||
// cy.clickLink(/^Roles$/); | ||
// }); | ||
// }); | ||
// }); | ||
// }); | ||
it('can render the Roles list view and utilize the Roles links to view details', () => { | ||
cy.navigateTo('eda', 'roles'); | ||
cy.verifyPageTitle('Roles'); | ||
cy.getEdaRoles().then((roles) => { | ||
cy.setTablePageSize('20'); | ||
cy.get('tbody').find('tr').should('have.length', roles.length); | ||
roles.forEach((role) => { | ||
cy.verifyPageTitle('Roles'); | ||
cy.clickTableRow(role.name, true); | ||
cy.verifyPageTitle(role.name); | ||
cy.get('#description').should('contain', role.description); | ||
cy.clickLink(/^Roles$/); | ||
}); | ||
}); | ||
}); | ||
}); |