Skip to content

Commit

Permalink
test(cypress): Add tests to copy/move page in/between collectives
Browse files Browse the repository at this point in the history
Signed-off-by: Jonas <[email protected]>
  • Loading branch information
mejo- committed Oct 24, 2023
1 parent 0c03b31 commit abf4d8f
Showing 1 changed file with 108 additions and 7 deletions.
115 changes: 108 additions & 7 deletions cypress/e2e/page-list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,24 @@ describe('Page list', function() {
})
})

describe('Move a page using the modal', function() {
it('Moves page to a subpage', function() {
cy.seedPage('Move me', '', 'Readme.md')
describe('Copy/move a page using the modal', function() {
before(function() {
cy.seedPage('Move me internal', '', 'Readme.md')
cy.seedPage('Target', '', 'Readme.md')
cy.seedPage('Target Subpage', '', 'Target.md')
cy.seedPage('Copy me internal', '', 'Readme.md')
cy.seedPage('Move me external', '', 'Readme.md')
cy.seedPage('Copy me external', '', 'Readme.md')
cy.deleteAndSeedCollective('CopyMoveTargetCollective')
cy.seedPage('Target external', '', 'Readme.md')
cy.seedPage('Target Subpage external', '', 'Target external.md')
})

it('Moves page to a subpage', function() {
cy.visit('/apps/collectives/Our%20Garden')
cy.openPageMenu('Move me')
cy.clickMenuButton('Move page')
cy.get('.picker-page-list li')
cy.openPageMenu('Move me internal')
cy.clickMenuButton('Copy or move page')
cy.get('.picker-list li')
.contains('Target')
.click()
cy.get('.picker-move-buttons button .arrow-down-icon')
Expand All @@ -106,7 +115,99 @@ describe('Page list', function() {
cy.contains('.page-list-drag-item', 'Target')
.get('.page-list-indent .app-content-list-item')
.last()
.contains('Move me')
.contains('Move me internal')
})

it('Copies page to a subpage', function() {
cy.visit('/apps/collectives/Our%20Garden')
cy.openPageMenu('Copy me internal')
cy.clickMenuButton('Copy or move page')
cy.get('.picker-list li')
.contains('Target')
.click()
cy.get('.picker-move-buttons button .arrow-down-icon')
.click()
cy.get('.picker-buttons button')
.contains('Copy page here')
.click()

cy.openPage('Target')
cy.contains('.page-list-drag-item', 'Target')
.get('.page-list-indent .app-content-list-item')
.first()
.contains('Target Subpage')
cy.contains('.page-list-drag-item', 'Target')
.get('.page-list-indent .app-content-list-item')
.eq(1)
.contains('Copy me internal')
cy.contains('.page-list-drag-item', 'Target')
.get('.page-list-indent .app-content-list-item')
.last()
.contains('Move me internal')
})

it('Moves page to a subpage in another collective', function() {
cy.visit('/apps/collectives/Our%20Garden')
cy.openPageMenu('Move me external')
cy.clickMenuButton('Copy or move page')
cy.get('.crumbs-home')
.click()
cy.get('.picker-list li')
.contains('CopyMoveTargetCollective')
.click()
cy.get('.picker-list li')
.contains('Target external')
.click()
cy.get('.picker-move-buttons button .arrow-down-icon')
.click()
cy.get('.picker-buttons button')
.contains('Move page here')
.click()

cy.visit('/apps/collectives/CopyMoveTargetCollective')
cy.openPage('Target external')
cy.contains('.page-list-drag-item', 'Target external')
.get('.page-list-indent .app-content-list-item')
.first()
.contains('Target Subpage external')
cy.contains('.page-list-drag-item', 'Target external')
.get('.page-list-indent .app-content-list-item')
.last()
.contains('Move me external')
})

it('Copies page to a subpage in another collective', function() {
cy.visit('/apps/collectives/Our%20Garden')
cy.openPageMenu('Copy me external')
cy.clickMenuButton('Copy or move page')
cy.get('.crumbs-home')
.click()
cy.get('.picker-list li')
.contains('CopyMoveTargetCollective')
.click()
cy.get('.picker-list li')
.contains('Target external')
.click()
cy.get('.picker-move-buttons button .arrow-down-icon')
.click()
cy.get('.picker-buttons button')
.contains('Copy page here')
.click()

cy.visit('/apps/collectives/CopyMoveTargetCollective')
cy.openPage('Target external')
cy.contains('.page-list-drag-item', 'Target external')
.get('.page-list-indent .app-content-list-item')
.first()
.contains('Target Subpage external')
cy.contains('.page-list-drag-item', 'Target external')
.get('.page-list-indent .app-content-list-item')
.eq(1)
.contains('Copy me external')
cy.contains('.page-list-drag-item', 'Target external')
.get('.page-list-indent .app-content-list-item')
.last()
.contains('Move me external')
})
})

Expand Down

0 comments on commit abf4d8f

Please sign in to comment.