Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax <max@nextcloud.com>2022-06-20 12:34:35 +0300
committerVinicius Reis <vinicius.reis@nextcloud.com>2022-06-30 20:35:24 +0300
commit9956041e75c180dfb0c6acc03bdd0bc208eed3e3 (patch)
tree91a4d3ec408d01436362f49114f6086c25a20487 /cypress
parentce9b52dad5c8a03c547c80fe115eed81de42e28b (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.js7
-rw-r--r--cypress/utils/index.js8
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')
})
}