From 8d365d2765a356b7d19768c9deef9072b9be3a0c Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 9 Dec 2024 15:41:19 +0100 Subject: [PATCH] fix(cy): avoid double upload to prevent lock error `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 --- cypress/e2e/conflict.spec.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/conflict.spec.js b/cypress/e2e/conflict.spec.js index e3638500412..a22a1a14e16 100644 --- a/cypress/e2e/conflict.spec.js +++ b/cypress/e2e/conflict.spec.js @@ -3,9 +3,7 @@ * 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' }, @@ -13,18 +11,19 @@ const variants = [ ] 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() { @@ -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')