Skip to content

Commit

Permalink
Merge pull request #3160 from nextcloud/test/cypress-direct-link
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusknorr authored Sep 4, 2023
2 parents 31ab476 + 6149a9a commit 193640d
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions cypress/e2e/direct.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')
})
})
})

})

0 comments on commit 193640d

Please sign in to comment.