Skip to content

Commit 155ac8e

Browse files
committed
chore(test): conflict and sync with autoreload
Signed-off-by: Max <max@nextcloud.com>
1 parent 1ade042 commit 155ac8e

2 files changed

Lines changed: 9 additions & 21 deletions

File tree

cypress/e2e/conflict.spec.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,9 @@ variants.forEach(function ({ fixture, mime }) {
3636
cy.getContent().should('contain', 'Heading')
3737

3838
cy.uploadFile(fileName, mime, testName + '/' + fileName)
39-
cy.get('#editor-container .document-status', {
40-
timeout: 40000,
41-
}).should('contain', 'session has expired')
42-
43-
// Reload button works
44-
cy.get('#editor-container .document-status a.button')
45-
.contains('Reload')
46-
.click()
39+
cy.intercept({ method: 'POST', url: '**/session/*/push' }).as('push')
40+
cy.wait('@push', { timeout: 20_000 })
41+
// Autoreload works
4742
getWrapper().should('not.exist')
4843
cy.getContent().should('contain', 'Hello world')
4944
cy.getContent().should('not.contain', 'Heading')

cypress/e2e/sync.spec.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ describe('Sync', () => {
108108
'contain',
109109
'The document could not be loaded.',
110110
)
111+
cy.intercept('**/apps/text/session/*/create').as('create')
111112
cy.get('#editor-container .document-status').find('.button.primary').click()
113+
// let first attempt fail
114+
cy.wait('@create', { timeout: 10000 })
112115
cy.get('#editor-container .document-status', { timeout: 30000 }).should(
113116
'contain',
114117
'The document could not be loaded.',
@@ -117,7 +120,6 @@ describe('Sync', () => {
117120
cy.intercept('**/apps/text/session/*/*', (req) => {
118121
req.continue()
119122
}).as('alive')
120-
cy.intercept('**/apps/text/session/*/create').as('create')
121123
cy.get('#editor-container .document-status').find('.button.primary').click()
122124
cy.wait('@alive', { timeout: 30000 })
123125
cy.wait('@create', { timeout: 10000 })
@@ -176,18 +178,9 @@ describe('Sync', () => {
176178
cy.wait('@save')
177179
cy.uploadTestFile('test.md')
178180

179-
cy.get('#editor-container .document-status', { timeout: 30000 }).should(
180-
'contain',
181-
'Editing session has expired.',
182-
)
183-
184-
// Reload button works
185-
cy.get('#editor-container .document-status a.button')
186-
.contains('Reload')
187-
.click()
188-
189-
cy.getContent()
190-
cy.get('#editor-container .document-status .notecard').should('not.exist')
181+
cy.getContent().should('not.exist')
182+
cy.getContent().find('h2').should('contain', 'Hello world')
183+
cy.getContent().find('li').should('not.exist') // was overwritten after the save
191184
})
192185

193186
it('passes the doc content from one session to the next', () => {

0 commit comments

Comments
 (0)