Skip to content
Merged
2 changes: 1 addition & 1 deletion cypress/e2e/apps.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('The apps', function() {
it('allows creating a new collective', function() {
cy.login('jane')
cy.get('#app-navigation-vue')
.should('contain', 'Create new collective')
.should('contain', 'New collective')
})
})

Expand Down
28 changes: 16 additions & 12 deletions cypress/e2e/collective.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ describe('Collective', function() {
it('Reports existing circle', function() {
cy.login('bob')
cy.createCollective('Foreign Circle')
cy.get('main .empty-content').should('contain', 'build shared knowledge')
cy.get('.toast-warning').should('contain', 'Could not create the collective')
cy.get('.toast-warning').should('contain', 'A circle with that name exists')
cy.get('.modal-collective-name-error').should('contain', 'A collective with this name already exists')
})
it('Reports existing collective', function() {
cy.login('bob')
Expand All @@ -78,10 +76,13 @@ describe('Collective', function() {
it('creates collectives by picking circle',
function() {
cy.login('bob')
cy.get('button.action-item span.circles-icon').click({ force: true })
cy.get('.multiselect__option').should('not.contain', 'Foreign')
cy.get('.multiselect__option [title*=History]').click()
cy.get('input.icon-confirm').click()
cy.get('button').contains('New collective').click()
cy.get('button span.circles-icon').click()
// cy.get('.circle-selector ul').should('not.contain', 'Foreign')
cy.get('.circle-selector li [title*=History]').click()
cy.get('button').contains('Add people').click()
cy.get('button').contains('Create').click()

cy.get('#titleform input').invoke('val').should('contain', 'History Club')
cy.get('.toast-info').should('contain',
'Created collective "History Club" for existing circle.'
Expand Down Expand Up @@ -129,7 +130,7 @@ describe('Collective', function() {
const randomName = 'Created just now ' + Math.random().toString(36).substr(2, 4)
it('has all the ui elements', function() {
cy.login('bob')
cy.createCollective(randomName)
cy.createCollective(randomName, ['jane', 'john'])
cy.log('Check name in the disabled titleform')
cy.get('#titleform input').invoke('val').should('contain', randomName)
cy.get('#titleform input').should('have.attr', 'disabled')
Expand All @@ -146,7 +147,7 @@ describe('Collective', function() {
})

describe('in non-admin collective', function() {
it.only('can leave collective and undo', function() {
it('can leave collective and undo', function() {
cy.login('jane')
cy.visit('/apps/collectives')

Expand Down Expand Up @@ -178,15 +179,18 @@ describe('Collective', function() {
.contains('li', 'Preexisting Collective')
.find('.action-item__menutoggle')
.click({ force: true })
cy.intercept('PUT', '**/apps/circles/circles/**/leave').as('leaveCircle')
cy.get('button.action-button')
.contains('Leave collective')
.click()
cy.get('.app-navigation-entry')
.contains('Preexisting Collective')
.should('not.be.visible')
cy.wait(10010) // eslint-disable-line cypress/no-unnecessary-waiting
cy.get('.app-navigation-entry')
.should('not.contain', 'Preexisting Collective')
// Wait 10 extra seconds for the request (undo period)
cy.wait('@leaveCircle', { requestTimeout: Cypress.config('requestTimeout') + 10010 })
cy.get('.app-navigation__list')
.contains('Preexisting Collective')
.should('not.exist')
})
})

Expand Down
14 changes: 11 additions & 3 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,18 @@ Cypress.Commands.add('seedCollective', (name) => {
/**
* Create a collective via UI
*/
Cypress.Commands.add('createCollective', (name) => {
Cypress.Commands.add('createCollective', (name, members = []) => {
cy.log(`Creating collective ${name}`)
cy.get('a [title="Create new collective"]').click()
cy.get('.collective-create input[type="text"]').type(`${name}{enter}`)
cy.get('button').contains('New collective').click()
cy.get('.collective-name input[type="text"]').type(`${name}{enter}`)
if (members.length > 0) {
for (const member of members) {
cy.get('.member-picker input[type="text"]').clear().type(`${member}`)
cy.get('.search-results .user-bubble__content').contains(member).click()
cy.get('.selected-members .user-bubble__content').should('contain', member)
}
}
cy.get('button').contains('Create').click()
})

/**
Expand Down
4 changes: 3 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@nextcloud/event-bus": "^3.0.2",
"@nextcloud/files": "^3.0.0-beta.7",
"@nextcloud/initial-state": "^2.0.0",
"@nextcloud/l10n": "^1.6.0",
"@nextcloud/moment": "^1.2.1",
"@nextcloud/notify_push": "^1.1.3",
"@nextcloud/paths": "^2.1.0",
Expand Down
Loading