diff --git a/cypress/e2e/direct.spec.js b/cypress/e2e/direct.spec.js index 0467ec7e84..2ddcd5a3a4 100644 --- a/cypress/e2e/direct.spec.js +++ b/cypress/e2e/direct.spec.js @@ -38,6 +38,32 @@ const createDirectEditingLink = (user, fileId) => { cy.wrap(token) }) } + +const createDirectEditingLinkForShareToken = (shareToken, host = undefined, path = '', password = undefined) => { + cy.logout() + return cy.request({ + method: 'POST', + url: `${Cypress.env('baseUrl')}/ocs/v2.php/apps/richdocuments/api/v1/share?format=json`, + form: true, + body: { + shareToken, + host, + path, + password, + }, + // auth: { user: user.userId, pass: user.password }, + headers: { + 'OCS-ApiRequest': 'true', + 'Content-Type': 'application/x-www-form-urlencoded', + }, + }).then(response => { + cy.log(response) + const token = response.body?.ocs?.data?.url + cy.log(`Created direct editing token for share link`, token) + cy.wrap(token) + }) +} + describe('Direct editing (legacy)', function() { let randUser let fileId @@ -64,4 +90,17 @@ describe('Direct editing (legacy)', function() { }) }) + it('Open an existing file on a share link', function() { + cy.shareLink(randUser, '/document.odt').then((token) => { + createDirectEditingLinkForShareToken(token) + .then((token) => { + cy.nextcloudTestingAppConfigSet('richdocuments', 'uiDefaults-UIMode', 'classic') + cy.logout() + cy.visit(token) + cy.waitForCollabora(false) + cy.screenshot('direct-share-link') + }) + }) + }) + })