Skip to content

Commit

Permalink
fix(cy): avoid double upload to prevent lock error
Browse files Browse the repository at this point in the history
`isolateTest` in `beforeEach` already uploads the file.
Uploading it again in the `no actual conflict - just reload` case
sometimes led to 423 - Locked responses.

Use `cy.createTestDir()` instead and upload only once.

Signed-off-by: Max <max@nextcloud.com>
  • Loading branch information
max-nextcloud authored and mejo- committed Dec 10, 2024
1 parent eb094a2 commit 8d365d2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cypress/e2e/conflict.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,27 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

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 @@ -123,6 +122,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

0 comments on commit 8d365d2

Please sign in to comment.