]> source.dussan.org Git - nextcloud-server.git/commitdiff
Increase wait to ensure versions are created
authorLouis Chemineau <louis@chmn.me>
Wed, 22 Mar 2023 12:54:29 +0000 (13:54 +0100)
committerLouis Chemineau <louis@chmn.me>
Wed, 5 Apr 2023 09:51:44 +0000 (11:51 +0200)
In files_versions cypress tests, we wait for 1000ms between each versions uploads to make sure that the server properly create a version. Under 1s the serve does not create a version.

This commit increases the wait time as it might help to ensure that the time span is enough between two uploads.

Signed-off-by: Louis Chemineau <louis@chmn.me>
cypress/e2e/files_versions/filesVersionsUtils.ts
cypress/support/commands.ts

index 1aa7ebde316d5fb541b40da432999b22cac8ca1b..e22675384712521a12b03147a2239cc3f1a47cfd 100644 (file)
@@ -24,9 +24,9 @@ import path from "path"
 
 export function uploadThreeVersions(user) {
        cy.uploadContent(user, new Blob(['v1'], { type: 'text/plain' }), 'text/plain', '/test.txt')
-       cy.wait(1000)
+       cy.wait(1500)
        cy.uploadContent(user, new Blob(['v2'], { type: 'text/plain' }), 'text/plain', '/test.txt')
-       cy.wait(1000)
+       cy.wait(1500)
        cy.uploadContent(user, new Blob(['v3'], { type: 'text/plain' }), 'text/plain', '/test.txt')
        cy.login(user)
 }
index d214bb2b45eb522cc66e08b3706011c81e129067..1a9999343d53315e99cc7d7c6f8637158dff3de7 100644 (file)
@@ -99,33 +99,32 @@ Cypress.Commands.add('uploadFile', (user, fixture = 'image.jpg', mimeType = 'ima
  */
 Cypress.Commands.add('uploadContent', (user, blob, mimeType, target) => {
        cy.clearCookies()
-       .then(async () => {
-               const fileName = basename(target)
-
-               // Process paths
-               const rootPath = `${Cypress.env('baseUrl')}/remote.php/dav/files/${encodeURIComponent(user.userId)}`
-               const filePath = target.split('/').map(encodeURIComponent).join('/')
-               try {
-               const file = new File([blob], fileName, { type: mimeType })
-                       await axios({
-                               url: `${rootPath}${filePath}`,
-                               method: 'PUT',
-                               data: file,
-                               headers: {
-                                       'Content-Type': mimeType,
-                               },
-                               auth: {
-                                       username: user.userId,
-                                       password: user.password,
-                               },
-                       }).then(response => {
+               .then(async () => {
+                       const fileName = basename(target)
+
+                       // Process paths
+                       const rootPath = `${Cypress.env('baseUrl')}/remote.php/dav/files/${encodeURIComponent(user.userId)}`
+                       const filePath = target.split('/').map(encodeURIComponent).join('/')
+                       try {
+                               const file = new File([blob], fileName, { type: mimeType })
+                               const response = await axios({
+                                       url: `${rootPath}${filePath}`,
+                                       method: 'PUT',
+                                       data: file,
+                                       headers: {
+                                               'Content-Type': mimeType,
+                                       },
+                                       auth: {
+                                               username: user.userId,
+                                               password: user.password,
+                                       },
+                               })
                                cy.log(`Uploaded content as ${fileName}`, response)
-                       })
-               } catch (error) {
-                       cy.log('error', error)
-                       throw new Error(`Unable to process fixture`)
-               }
-       })
+                       } catch (error) {
+                               cy.log('error', error)
+                               throw new Error('Unable to process fixture')
+                       }
+               })
 })
 
 /**