Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(cypress): Add test for share token direct editing #3160

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')
})
})
})

})
Loading