diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-02-05 17:56:22 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-02-06 02:17:25 +0100 |
commit | dbc5c10bc408fd5b50a81cddfc25ba226d02fec9 (patch) | |
tree | 76686f1aa9b1da2dd6b6cad5fde6d985821f4163 /cypress/support | |
parent | 24f2e933930fb4c06e312df0757bbaca26446011 (diff) | |
download | nextcloud-server-dbc5c10bc408fd5b50a81cddfc25ba226d02fec9.tar.gz nextcloud-server-dbc5c10bc408fd5b50a81cddfc25ba226d02fec9.zip |
fix(files): Do not download files with `openfile` query flag
Instead of downloading files, if there is no other default action,
we should just open the details tab.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'cypress/support')
-rw-r--r-- | cypress/support/commands.ts | 15 | ||||
-rw-r--r-- | cypress/support/cypress-e2e.d.ts | 4 |
2 files changed, 10 insertions, 9 deletions
diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index d610d79f7f4..ad486a8a8f7 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -54,12 +54,12 @@ Cypress.Commands.add('enableUser', (user: User, enable = true) => { */ Cypress.Commands.add('uploadFile', (user, fixture = 'image.jpg', mimeType = 'image/jpeg', target = `/${fixture}`) => { // get fixture - return cy.fixture(fixture, 'base64').then(async file => { - // convert the base64 string to a blob - const blob = Cypress.Blob.base64StringToBlob(file, mimeType) - - cy.uploadContent(user, blob, mimeType, target) - }) + return cy.fixture(fixture, 'base64') + .then((file) => ( + // convert the base64 string to a blob + Cypress.Blob.base64StringToBlob(file, mimeType) + )) + .then((blob) => cy.uploadContent(user, blob, mimeType, target)) }) Cypress.Commands.add('setFileAsFavorite', (user: User, target: string, favorite = true) => { @@ -98,7 +98,7 @@ Cypress.Commands.add('setFileAsFavorite', (user: User, target: string, favorite Cypress.Commands.add('mkdir', (user: User, target: string) => { // eslint-disable-next-line cypress/unsafe-to-chain-command - cy.clearCookies() + return cy.clearCookies() .then(async () => { try { const rootPath = `${Cypress.env('baseUrl')}/remote.php/dav/files/${encodeURIComponent(user.userId)}` @@ -112,6 +112,7 @@ Cypress.Commands.add('mkdir', (user: User, target: string) => { }, }) cy.log(`Created directory ${target}`, response) + return response } catch (error) { cy.log('error', error) throw new Error('Unable to create directory') diff --git a/cypress/support/cypress-e2e.d.ts b/cypress/support/cypress-e2e.d.ts index 50a8bb990e9..97385ac070b 100644 --- a/cypress/support/cypress-e2e.d.ts +++ b/cypress/support/cypress-e2e.d.ts @@ -21,7 +21,7 @@ declare global { * Upload a file from the fixtures folder to a given user storage. * **Warning**: Using this function will reset the previous session */ - uploadFile(user: User, fixture?: string, mimeType?: string, target?: string): Cypress.Chainable<void>, + uploadFile(user: User, fixture?: string, mimeType?: string, target?: string): Cypress.Chainable<AxiosResponse>, /** * Upload a raw content to a given user storage. @@ -38,7 +38,7 @@ declare global { * Create a new directory * **Warning**: Using this function will reset the previous session */ - mkdir(user: User, target: string): Cypress.Chainable<void>, + mkdir(user: User, target: string): Cypress.Chainable<AxiosResponse>, /** * Set a file as favorite (or remove from favorite) |