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

fix(cy): avoid double upload to prevent lock error #6760

Merged
merged 1 commit into from
Dec 10, 2024
Merged
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
17 changes: 10 additions & 7 deletions cypress/e2e/conflict.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @copyright Copyright (c) 2019 John Molakvoæ <[email protected]>
* @copyright Copyright (c) 2022 Nextcloud GmbH and Nextcloud contributors
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
* @author Max <max@nextcloud.com>
*
* @license AGPL-3.0-or-later
*
Expand All @@ -20,28 +20,27 @@
*
*/

import { initUserAndFiles, randUser } from '../utils/index.js'

const user = randUser()
import { randUser } from '../utils/index.js'

const variants = [
{ fixture: 'lines.txt', mime: 'text/plain' },
{ fixture: 'test.md', mime: 'text/markdown' },
]

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

before(() => {
initUserAndFiles(user)
cy.createUser(user)
})

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

it(prefix + ': no actual conflict - just reload', function() {
Expand Down Expand Up @@ -140,6 +139,10 @@ variants.forEach(function({ fixture, mime }) {
* @param {string} mime - mimetype
*/
function createConflict(fileName, mime) {
cy.testName().then(testName => {
cy.uploadFile(fileName, mime, `${testName}/${fileName}`)
})
cy.visitTestFolder()
cy.openFile(fileName)
cy.log('Inspect editor')
cy.getEditor().find('.ProseMirror').should('have.attr', 'contenteditable', 'true')
Expand Down
Loading