-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]>
- Loading branch information
1 parent
e738295
commit b353254
Showing
1 changed file
with
10 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
* | ||
|
@@ -20,26 +20,26 @@ | |
* | ||
*/ | ||
|
||
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 | ||
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() | ||
|