Skip to content

Commit

Permalink
test(cypress): Add test for share token direct editing
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliushaertl committed Sep 1, 2023
1 parent 9411b3d commit 6149a9a
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 6149a9a

Please sign in to comment.