Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce complexity of cypress commands #998

Merged
merged 10 commits into from
Nov 9, 2023
4 changes: 3 additions & 1 deletion cypress/e2e/circle-with-group.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ describe('Pages are accessible via group membership to circle', function() {
cy.loginAs('jane')
cy.visit('apps/collectives')
cy.deleteAndSeedCollective('Group Collective')
cy.seedCircleMember('Group Collective', 'Bobs Group', 2, 8)
cy.circleFind('Group Collective')
.circleAddMember('Bobs Group', 2)
.circleSetMemberLevel(8)
})

it('Lists the collective', function() {
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/collective-members.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ describe('Collective members', function() {
before(function() {
cy.loginAs('bob')
cy.visit('apps/collectives')
cy.deleteCollective('Members Collective')
cy.deleteAndSeedCollective('Members Collective')
})

Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/collective-readonly.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ describe('Read-only collective', function() {
cy.deleteAndSeedCollective('PermissionCollective')
cy.seedPage('SecondPage', '', 'Readme.md')
cy.seedCollectivePermissions('PermissionCollective', 'edit', 4)
cy.seedCircleMember('PermissionCollective', 'bob')
cy.circleFind('PermissionCollective')
.circleAddMember('bob')
})

describe('in read-only collective', function() {
Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/collective.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ describe('Collective', function() {
cy.deleteCollective('History Club')
cy.deleteCollective(specialCollective)
cy.deleteAndSeedCollective('Preexisting Collective')
cy.seedCircleMember('Preexisting Collective', 'jane')
cy.circleFind('Preexisting Collective')
.circleAddMember('jane')
cy.seedCircle('Preexisting Circle')
cy.seedCircle('History Club', { visible: true, open: true })
cy.loginAs('jane')
Expand Down
5 changes: 2 additions & 3 deletions cypress/e2e/page-details.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ describe('Page details', function() {
.find('.editor--toc .editor--toc__item')
.should('contain', 'Second-Level Heading')

// Switch to edit mode
cy.switchPageMode(1)
cy.switchToEditMode()

cy.getEditor()
.find('.editor--toc .editor--toc__item')
Expand All @@ -68,7 +67,7 @@ describe('Page details', function() {
.click()

// Switch back to view mode
cy.switchPageMode(0)
cy.switchToViewMode()

cy.get('.editor--toc')
.should('not.exist')
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/page-landingpage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ describe('Page landing page', function() {
cy.loginAs('bob')
cy.visit('/apps/collectives')
cy.deleteAndSeedCollective(collective)
cy.seedCircleMember(collective, 'alice')
cy.seedCircleMember(collective, 'jane')
cy.seedCircleMember(collective, 'john')
cy.circleFind(collective).circleAddMember('alice')
cy.circleFind(collective).circleAddMember('jane')
cy.circleFind(collective).circleAddMember('john')
cy.seedPage('Page 1', '', 'Readme.md')
cy.seedPage('Page 2', '', 'Readme.md')
cy.seedPage('Page 3', '', 'Readme.md')
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/page-list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ describe('Page list', function() {
cy.getEditor()
.should('be.visible')
.type('text')
cy.switchPageMode(0)
cy.switchToViewMode()

// Trash page
cy.openPageMenu('Day 1')
Expand Down
3 changes: 1 addition & 2 deletions cypress/e2e/pages-links.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ describe('Page Link Handling', function() {

const clickLink = function(href, edit) {
if (edit) {
// Change to edit mode
cy.switchPageMode(1)
cy.switchToEditMode()
cy.getEditor()
.should('be.visible')
.find(`a[href="${href}"]`)
Expand Down
5 changes: 2 additions & 3 deletions cypress/e2e/pages.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ describe('Page', function() {
cy.wait(1000) // eslint-disable-line cypress/no-unnecessary-waiting

// Switch back to view mode
cy.switchPageMode(0)
cy.switchToViewMode()

cy.getEditor()
.should('not.be.visible')
Expand All @@ -205,8 +205,7 @@ describe('Page', function() {
it('Lists attachments for the page and allows restore', function() {
cy.openPage('Day 1')

// Switch to edit mode
cy.switchPageMode(1)
cy.switchToEditMode()

// Open attachment list
cy.get('button.action-item .icon-menu-sidebar').click()
Expand Down
Loading