-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add Cypress tests for usergroup column
Signed-off-by: Cleopatra Enjeck M <[email protected]>
- Loading branch information
Showing
2 changed files
with
140 additions
and
91 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,66 @@ | ||
let localUser | ||
let nonLocalUser | ||
const columnTitle = 'usergroup' | ||
const tableTitlePrefix = 'Test usergroup' | ||
let tableTitle = tableTitlePrefix | ||
let testNumber = 0 | ||
|
||
describe('Test column ' + columnTitle, () => { | ||
|
||
before(function() { | ||
cy.createRandomUser().then(user => { | ||
localUser = user | ||
}) | ||
|
||
cy.createRandomUser().then(user => { | ||
nonLocalUser = user | ||
}) | ||
}) | ||
|
||
beforeEach(function() { | ||
testNumber += 1 | ||
tableTitle = `${tableTitlePrefix} ${testNumber}` | ||
cy.login(localUser) | ||
cy.visit('apps/tables') | ||
}) | ||
|
||
it('Create column and rows with default values', () => { | ||
cy.createTable(tableTitle) | ||
cy.loadTable(tableTitle) | ||
cy.createUsergroupColumn(columnTitle, true, true, true, [localUser.userId, nonLocalUser.userId], true) | ||
cy.get('button').contains('Create row').click() | ||
cy.get('[data-cy="createRowSaveButton"]').click() | ||
cy.get('[data-cy="ncTable"] table tr td .userInfo').contains(localUser.userId).should('be.visible') | ||
cy.get('[data-cy="ncTable"] table tr td .userInfo').contains(nonLocalUser.userId).should('be.visible') | ||
}) | ||
|
||
it('Create column and rows without default values', () => { | ||
cy.createTable(tableTitle) | ||
cy.loadTable(tableTitle) | ||
cy.createUsergroupColumn(columnTitle, true, false, false, [], true) | ||
|
||
cy.get('button').contains('Create row').click() | ||
cy.get('[data-cy="usergroupRowSelect"] input').type(nonLocalUser.userId) | ||
cy.get(`.vs__dropdown-menu [id="${nonLocalUser.userId}"]`).click() | ||
cy.get('[data-cy="createRowSaveButton"]').click() | ||
cy.get('[data-cy="ncTable"] table tr td .userInfo').contains(nonLocalUser.userId).should('be.visible') | ||
}) | ||
|
||
it('Create and edit rows', () => { | ||
cy.createTable(tableTitle) | ||
cy.loadTable(tableTitle) | ||
cy.createUsergroupColumn(columnTitle, true, true, true, [localUser.userId], true) | ||
cy.get('button').contains('Create row').click() | ||
cy.get('[data-cy="createRowSaveButton"]').click() | ||
cy.get('[data-cy="ncTable"] table tr td .userInfo').contains(localUser.userId).should('be.visible') | ||
|
||
cy.get('[data-cy="ncTable"] [data-cy="editRowBtn"]').click() | ||
cy.get('[data-cy="usergroupRowSelect"] input').clear().type(nonLocalUser.userId) | ||
cy.get(`.vs__dropdown-menu [id="${nonLocalUser.userId}"]`).click() | ||
cy.get('[data-cy="editRowSaveButton"]').click() | ||
cy.get('[data-cy="ncTable"] table tr td .userInfo').contains(localUser.userId).should('not.exist') | ||
cy.get('[data-cy="ncTable"] table tr td .userInfo').contains(nonLocalUser.userId).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