diff --git a/cypress/e2e/page-list.spec.js b/cypress/e2e/page-list.spec.js index 5bff0b0e6..d19aca2bf 100644 --- a/cypress/e2e/page-list.spec.js +++ b/cypress/e2e/page-list.spec.js @@ -148,15 +148,18 @@ describe('Page list', function() { }) describe('Page trash', function() { - it('allows to trash and restore page with subpage and attachment', function() { - cy.visit('/apps/collectives/Our%20Garden/Day%201') - // Insert attachment + // Insert attachment once + before(function() { + cy.visit('/apps/collectives/Our%20Garden/Day%201') cy.intercept({ method: 'POST', url: '**/text/attachment/upload*' }).as('attachmentUpload') cy.get('input[data-text-el="attachment-file-input"]') .selectFile('cypress/fixtures/test.png', { force: true }) cy.wait('@attachmentUpload') cy.switchPageMode(0) + }) + + it('allows to trash and restore page with subpage and attachment', function() { // Trash page cy.contains('.page-list .app-content-list-item', 'Day 1') diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 6a5718eff..9d6c74cdd 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -360,3 +360,11 @@ Cypress.Commands.add('seedCircleMember', (name, userId, type = 1, level) => { } }) }) + +/** + * Fail the test on the initial run to check if retries work + */ +Cypress.Commands.add('testRetry', () => { + cy.wrap(cy.state('test').currentRetry()) + .should('be.equal', 2) +})