From b35325485b4f5667488f8c076bd31a55cbce39dc 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 | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/cypress/e2e/conflict.spec.js b/cypress/e2e/conflict.spec.js index dace4d00cf2..844bbb2e540 100644 --- a/cypress/e2e/conflict.spec.js +++ b/cypress/e2e/conflict.spec.js @@ -1,7 +1,7 @@ /** - * @copyright Copyright (c) 2019 John Molakvoæ + * @copyright Copyright (c) 2022 Nextcloud GmbH and Nextcloud contributors * - * @author John Molakvoæ + * @author Max * * @license AGPL-3.0-or-later * @@ -20,9 +20,7 @@ * */ -import { initUserAndFiles, randUser } from '../utils/index.js' - -const user = randUser() +import { randUser } from '../utils/index.js' const variants = [ { fixture: 'lines.txt', mime: 'text/plain' }, @@ -30,16 +28,18 @@ const variants = [ ] variants.forEach(function({ fixture, mime }) { + const user = randUser() const fileName = fixture describe(`${mime} (${fileName})`, function() { const getWrapper = () => cy.get('.text-editor__wrapper.has-conflicts') before(() => { - initUserAndFiles(user, fileName) + cy.createUser(user) }) beforeEach(function() { cy.login(user) + cy.createTestFolder() }) it('no actual conflict - just reload', function() { @@ -130,7 +130,10 @@ variants.forEach(function({ fixture, mime }) { * @param {string} mime - mimetype */ function createConflict(fileName, mime) { - cy.visit('/apps/files') + cy.testName().then(testName => { + cy.uploadFile(fileName, mime, `${testName}/${fileName}`) + }) + cy.visitTestFolder() cy.openFile(fileName) cy.log('Inspect editor') cy.getContent()