diff --git a/cypress/e2e/conflict.spec.js b/cypress/e2e/conflict.spec.js
index 6c194275f87..cd7d8ff6b71 100644
--- a/cypress/e2e/conflict.spec.js
+++ b/cypress/e2e/conflict.spec.js
@@ -15,7 +15,7 @@ const variants = [
variants.forEach(function({ fixture, mime }) {
const fileName = fixture
describe(`${mime} (${fileName})`, function() {
- const getWrapper = () => cy.get('.viewer__content .text-editor__wrapper.has-conflicts')
+ const getWrapper = () => cy.get('.text-editor__wrapper.has-conflicts')
before(() => {
initUserAndFiles(user, fileName)
@@ -25,6 +25,34 @@ variants.forEach(function({ fixture, mime }) {
cy.login(user)
})
+ it('no actual conflict - just reload', function() {
+ // start with different content
+ cy.uploadFile('frontmatter.md', mime, fileName)
+ // just a read only session opened
+ cy.shareFile(`/${fileName}`)
+ .then((token) => {
+ cy.visit(`/s/${token}`)
+ })
+ cy.get('.text-editor__main')
+ .should('contain', 'Heading')
+ cy.intercept({ method: 'POST', url: '**/session/*/push' })
+ .as('push')
+ cy.wait('@push')
+ cy.uploadFile(fileName, mime)
+ cy.get('#editor-container .document-status', { timeout: 30000 })
+ .should('contain', 'session has expired')
+ // Reload button works
+ cy.get('#editor-container .document-status a.button')
+ .contains('Reload')
+ .click()
+ getWrapper()
+ .should('not.exist')
+ cy.getContent()
+ .should('contain', 'Hello world')
+ cy.getContent()
+ .should('not.contain', 'Heading')
+ })
+
it('displays conflicts', function() {
createConflict(fileName, mime)
@@ -77,6 +105,20 @@ variants.forEach(function({ fixture, mime }) {
cy.get('.text-editor__main')
.should('not.contain', 'cruel conflicting')
})
+
+ it('hides conflict in read only session', function() {
+ createConflict(fileName, mime)
+ cy.shareFile(`/${fileName}`)
+ .then((token) => {
+ cy.logout()
+ cy.visit(`/s/${token}`)
+ })
+ cy.get('.text-editor__main')
+ .should('contain', 'cruel conflicting')
+ getWrapper()
+ .should('not.exist')
+ })
+
})
})
diff --git a/src/components/Editor.vue b/src/components/Editor.vue
index 6965c5135f8..711353b9843 100644
--- a/src/components/Editor.vue
+++ b/src/components/Editor.vue
@@ -13,13 +13,14 @@