Skip to content

Commit

Permalink
fix: update tests to include teams usergroup option
Browse files Browse the repository at this point in the history
Signed-off-by: Cleopatra Enjeck M <[email protected]>
  • Loading branch information
enjeck committed Oct 30, 2024
1 parent 88c2be9 commit 75ad8e3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/ToDo list.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"title":"ToDo list","emoji":"\u2705","columns":[{"id":491,"tableId":132,"title":"Task","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"text","subtype":"line","mandatory":true,"description":"","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"showUserStatus":false},{"id":492,"tableId":132,"title":"Description","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"text","subtype":"rich","mandatory":false,"description":"Title or short description","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"showUserStatus":false},{"id":493,"tableId":132,"title":"Target","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"text","subtype":"rich","mandatory":false,"description":"Date, time or whatever","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"showUserStatus":false},{"id":494,"tableId":132,"title":"Progress","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"number","subtype":"progress","mandatory":false,"description":"","numberDefault":0,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"showUserStatus":false},{"id":495,"tableId":132,"title":"Comments","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"text","subtype":"rich","mandatory":false,"description":"","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"showUserStatus":false},{"id":496,"tableId":132,"title":"Proofed","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"selection","subtype":"check","mandatory":false,"description":"","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"showUserStatus":false}],"views":[],"description":"","tablesVersion":"0.8.0-beta.2"}
{"title":"ToDo list","emoji":"\u2705","columns":[{"id":491,"tableId":132,"title":"Task","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"text","subtype":"line","mandatory":true,"description":"","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"usergroupSelectTeams":false,"showUserStatus":false},{"id":492,"tableId":132,"title":"Description","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"text","subtype":"rich","mandatory":false,"description":"Title or short description","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"usergroupSelectTeams":false,"showUserStatus":false},{"id":493,"tableId":132,"title":"Target","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"text","subtype":"rich","mandatory":false,"description":"Date, time or whatever","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"usergroupSelectTeams":false,"showUserStatus":false},{"id":494,"tableId":132,"title":"Progress","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"number","subtype":"progress","mandatory":false,"description":"","numberDefault":0,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"usergroupSelectTeams":false,"showUserStatus":false},{"id":495,"tableId":132,"title":"Comments","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"text","subtype":"rich","mandatory":false,"description":"","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"usergroupSelectTeams":false,"showUserStatus":false},{"id":496,"tableId":132,"title":"Proofed","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"selection","subtype":"check","mandatory":false,"description":"","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"usergroupSelectTeams":false, "showUserStatus":false}],"views":[],"description":"","tablesVersion":"0.8.0-beta.2"}
6 changes: 3 additions & 3 deletions cypress/e2e/column-usergroup.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('Test column ' + columnTitle, () => {
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.createUsergroupColumn(columnTitle, true, 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 .user-bubble__name').contains(localUser.userId).should('be.visible')
Expand All @@ -41,7 +41,7 @@ describe('Test column ' + columnTitle, () => {
it('Create column and rows without default values', () => {
cy.createTable(tableTitle)
cy.loadTable(tableTitle)
cy.createUsergroupColumn(columnTitle, true, false, false, [], true)
cy.createUsergroupColumn(columnTitle, true, false, false, false, [], true)

cy.get('button').contains('Create row').click()
cy.get('[data-cy="usergroupRowSelect"] input').type(nonLocalUser.userId)
Expand All @@ -53,7 +53,7 @@ describe('Test column ' + columnTitle, () => {
it('Create and edit rows', () => {
cy.createTable(tableTitle)
cy.loadTable(tableTitle)
cy.createUsergroupColumn(columnTitle, true, true, true, [localUser.userId], true)
cy.createUsergroupColumn(columnTitle, true, 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 .user-bubble__name').contains(localUser.userId).should('be.visible')
Expand Down
17 changes: 10 additions & 7 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Cypress.Commands.add('unifiedSearch', (term) => {
cy.get('.unified-search__results .unified-search__result-line-one span').contains(term, { matchCase: false }).should('exist')
})

Cypress.Commands.add('createUsergroupColumn', (title, selectUsers, selectGroups, hasMultipleValues, defaultValue, isFirstColumn) => {
Cypress.Commands.add('createUsergroupColumn', (title, selectUsers, selectGroups, selectTeams, hasMultipleValues, defaultValue, isFirstColumn) => {
cy.openCreateColumnModal(isFirstColumn)
cy.get('[data-cy="columnTypeFormInput"]').clear().type(title)
cy.get('.columnTypeSelection .vs__open-indicator').click({ force: true })
Expand All @@ -128,12 +128,15 @@ Cypress.Commands.add('createUsergroupColumn', (title, selectUsers, selectGroups,
cy.get('[data-cy="usergroupMultipleSwitch"] .checkbox-content').click({ force: true })
}

if (selectUsers && selectGroups) {
cy.get('[data-cy="userAndGroupSwitch"] .checkbox-content').click()
} else if (selectUsers) {
cy.get('[data-cy="userSwitch"] .checkbox-content').click()
} else if (selectGroups) {
cy.get('[data-cy="groupSwitch"] .checkbox-content').click()
if (selectGroups) {
cy.get('[data-cy="groupsSwitch"] input').click({ force: true })
}
if (selectTeams) {
cy.get('[data-cy="teamsSwitch"] input').click({ force: true })
}
// Users is always checked by default, and we can only disable it if some other option is already enabled
if (!selectUsers & (selectGroups || selectTeams)) {
cy.get('[data-cy="usersSwitch"] input').click({ force: true })
}

defaultValue.forEach((value) => {
Expand Down
11 changes: 11 additions & 0 deletions tests/integration/features/APIv2.feature
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Feature: APIv2
| usergroupMultipleItems | true |
| usergroupSelectUsers | true |
| usergroupSelectGroups | false |
| usergroupSelectTeams | false |
Then node with node type "table" and node name "t2" has the following columns via v2
| Beautiful text column | Rich is cool | Counter | Progress | Checking | A single date |
Then print register
Expand Down Expand Up @@ -107,6 +108,7 @@ Feature: APIv2
| usergroupMultipleItems | true |
| usergroupSelectUsers | true |
| usergroupSelectGroups | true |
| usergroupSelectTeams | false |
Then node with node type "table" and node name "t5" has the following columns via v2
| ug column |
Then print register
Expand Down Expand Up @@ -579,6 +581,7 @@ Feature: APIv2
| usergroupMultipleItems | true |
| usergroupSelectUsers | true |
| usergroupSelectGroups | true |
| usergroupSelectTeams | false |
Then row exists with following values
| one | [{"id":"admin","type":0}] |
Then set following values for last created row
Expand Down Expand Up @@ -616,6 +619,7 @@ Feature: APIv2
| usergroupMultipleItems | true |
| usergroupSelectUsers | true |
| usergroupSelectGroups | false |
| usergroupSelectTeams | false |
When row exists using v2 with following values
| one | AHA |
| two | 161 |
Expand Down Expand Up @@ -654,6 +658,7 @@ Feature: APIv2
| usergroupMultipleItems | true |
| usergroupSelectUsers | true |
| usergroupSelectGroups | false |
| usergroupSelectTeams | false |
And user "participant1-v2" shares table with user "participant2-v2"
And user "participant2-v2" has the following permissions
| read | 1 |
Expand Down Expand Up @@ -699,6 +704,7 @@ Feature: APIv2
| usergroupMultipleItems | true |
| usergroupSelectUsers | true |
| usergroupSelectGroups | false |
| usergroupSelectTeams | false |
And user "participant1-v2" shares table with user "participant2-v2"
And user "participant1-v2" sets permission "create" to 0
And user "participant2-v2" has the following permissions
Expand Down Expand Up @@ -745,6 +751,7 @@ Feature: APIv2
| usergroupMultipleItems | true |
| usergroupSelectUsers | true |
| usergroupSelectGroups | false |
| usergroupSelectTeams | false |
When user "participant2-v2" tries to create a row using v2 with following values
| one | AHA |
| two | 161 |
Expand Down Expand Up @@ -783,6 +790,7 @@ Feature: APIv2
| usergroupMultipleItems | true |
| usergroupSelectUsers | true |
| usergroupSelectGroups | false |
| usergroupSelectTeams | false |
And user "participant1-v2" create view "v1" with emoji "⚡️" for "t1" as "v1"
And user "participant1-v2" sets columns "one,two,three,four,five" to view "v1"
When user "participant1-v2" tries to create a row using v2 on "view" "v1" with following values
Expand Down Expand Up @@ -829,6 +837,7 @@ Feature: APIv2
| usergroupMultipleItems | true |
| usergroupSelectUsers | true |
| usergroupSelectGroups | false |
| usergroupSelectTeams | false |
And user "participant1-v2" create view "v1" with emoji "⚡️" for "t1" as "v1"
And user "participant1-v2" sets columns "one,two,three,four,five" to view "v1"
And user "participant1-v2" shares view "v1" with "participant2-v2"
Expand Down Expand Up @@ -876,6 +885,7 @@ Feature: APIv2
| usergroupMultipleItems | true |
| usergroupSelectUsers | true |
| usergroupSelectGroups | false |
| usergroupSelectTeams | false |
And user "participant1-v2" create view "v1" with emoji "⚡️" for "t1" as "v1"
And user "participant1-v2" sets columns "one,two,three,four,five" to view "v1"
And user "participant1-v2" shares view "v1" with "participant2-v2"
Expand Down Expand Up @@ -918,6 +928,7 @@ Feature: APIv2
| usergroupMultipleItems | true |
| usergroupSelectUsers | true |
| usergroupSelectGroups | false |
| usergroupSelectTeams | false |
And user "participant1-v2" create view "v1" with emoji "⚡️" for "t1" as "v1"
And user "participant1-v2" sets columns "one,two,three,four,five" to view "v1"
When user "participant2-v2" tries to create a row using v2 on "view" "v1" with following values
Expand Down

0 comments on commit 75ad8e3

Please sign in to comment.