diff options
author | Max <max@nextcloud.com> | 2022-06-20 12:34:35 +0300 |
---|---|---|
committer | Vinicius Reis <vinicius.reis@nextcloud.com> | 2022-06-30 20:35:24 +0300 |
commit | 9956041e75c180dfb0c6acc03bdd0bc208eed3e3 (patch) | |
tree | 91a4d3ec408d01436362f49114f6086c25a20487 /cypress | |
parent | ce9b52dad5c8a03c547c80fe115eed81de42e28b (diff) |
test: try to make image test retryable
Use a unique filename so retries work on different files.
Uploading the existing file again would cause a conflict
resulting in retries failing.
Signed-off-by: Max <max@nextcloud.com>
Diffstat (limited to 'cypress')
-rw-r--r-- | cypress/e2e/images.spec.js | 7 | ||||
-rw-r--r-- | cypress/utils/index.js | 8 |
2 files changed, 8 insertions, 7 deletions
diff --git a/cypress/e2e/images.spec.js b/cypress/e2e/images.spec.js index 357cf1570..2066a36c8 100644 --- a/cypress/e2e/images.spec.js +++ b/cypress/e2e/images.spec.js @@ -135,6 +135,7 @@ const waitForRequestAndCheckImage = (requestAlias, index) => { describe('Test all image insertion methods', () => { before(() => { initUserAndFiles(randUser, 'test.md', 'empty.md') + cy.uploadFile('github.png', 'image/png') cy.nextcloudCreateUser(randUser2, 'password') @@ -192,8 +193,10 @@ describe('Test all image insertion methods', () => { }) it('Upload images with the same name', () => { - cy.uploadFile('empty.md', 'text/markdown') - cy.openFile('empty.md') + // make sure we start from an emtpy file even on retries + const filename = randHash() + '.md' + cy.uploadFile('empty.md', 'text/markdown', filename) + cy.openFile(filename) const assertImage = index => { return clickOnImageAction(ACTION_UPLOAD_LOCAL_FILE) diff --git a/cypress/utils/index.js b/cypress/utils/index.js index f25aa306a..b6a547993 100644 --- a/cypress/utils/index.js +++ b/cypress/utils/index.js @@ -35,17 +35,15 @@ export const getSearchParams = url => { * Can be used e.g. for a `before()` * * @param {string} userName Username of the user to create - * @param {...string} file one ore more markdown file names to create + * @param {...string} files one ore more markdown file names to create */ -export function initUserAndFiles(userName, file) { - const files = [...arguments].slice(1) - +export function initUserAndFiles(userName, ...files) { // Init user cy.nextcloudCreateUser(userName, 'password') cy.login(userName, 'password') // Upload test files - files.forEach(file => { + ;(files || []).forEach(file => { cy.uploadFile(file, 'text/markdown') }) } |