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

[stable30] fix(deps): update tiptap to ^2.6.2 (main) #6212

Merged
merged 4 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 44 additions & 32 deletions cypress/e2e/conflict.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,45 @@ const variants = [

variants.forEach(function({ fixture, mime }) {
const fileName = fixture
const prefix = mime.replaceAll('/', '-')
describe(`${mime} (${fileName})`, function() {
const getWrapper = () => cy.get('.text-editor__wrapper.has-conflicts')

before(() => {
initUserAndFiles(user, fileName)
initUserAndFiles(user)
})

beforeEach(function() {
cy.login(user)
cy.isolateTest({ sourceFile: fileName })
})

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.getContent().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(prefix + ': no actual conflict - just reload', function() {
cy.testName().then(testName => {
// start with different content
cy.uploadFile('frontmatter.md', mime, `${testName}/${fileName}`)
// just a read only session opened
cy.shareFile(`${testName}/${fileName}`)
.then((token) => {
cy.visit(`/s/${token}`)
})
cy.getContent().should('contain', 'Heading')

cy.uploadFile(fileName, mime, testName + '/' + fileName)
cy.get('#editor-container .document-status', { timeout: 40000 })
.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() {
it(prefix + ': displays conflicts', function() {
createConflict(fileName, mime)

cy.openFile(fileName)
Expand All @@ -65,10 +70,13 @@ variants.forEach(function({ fixture, mime }) {
.should('contain', 'cruel conflicting')
})

it('resolves conflict using current editing session', function() {
it(prefix + ': resolves conflict using current editing session', function() {
createConflict(fileName, mime)

cy.openFile(fileName)
cy.intercept({ method: 'POST', url: '**/session/*/push' })
.as('push')
cy.wait('@push')
cy.get('[data-cy="resolveThisVersion"]').click()

getWrapper().should('not.exist')
Expand All @@ -78,7 +86,7 @@ variants.forEach(function({ fixture, mime }) {
cy.getContent().should('contain', 'cruel conflicting')
})

it('resolves conflict using server version', function() {
it(prefix + ': resolves conflict using server version', function() {
createConflict(fileName, mime)

cy.openFile(fileName)
Expand All @@ -94,13 +102,15 @@ variants.forEach(function({ fixture, mime }) {
cy.getContent().should('not.contain', 'cruel conflicting')
})

it('hides conflict in read only session', function() {
it(prefix + ': hides conflict in read only session', function() {
createConflict(fileName, mime)
cy.shareFile(`/${fileName}`)
.then((token) => {
cy.logout()
cy.visit(`/s/${token}`)
})
cy.testName().then(testName => {
cy.shareFile(`/${testName}/${fileName}`)
.then((token) => {
cy.logout()
cy.visit(`/s/${token}`)
})
})
cy.getContent().should('contain', 'cruel conflicting')
getWrapper().should('not.exist')
})
Expand All @@ -113,12 +123,14 @@ variants.forEach(function({ fixture, mime }) {
* @param {string} mime - mimetype
*/
function createConflict(fileName, mime) {
cy.visit('/apps/files')
cy.openFile(fileName)
cy.log('Inspect editor')
cy.getEditor().find('.ProseMirror').should('have.attr', 'contenteditable', 'true')
cy.getContent()
.type('Hello you cruel conflicting world')
cy.uploadFile(fileName, mime)
cy.testName().then(testName => {
cy.uploadFile(fileName, mime, testName + '/' + fileName)
})
cy.get('#viewer .modal-header button.header-close').click()
cy.get('#viewer').should('not.exist')
}
Loading
Loading