aboutsummaryrefslogtreecommitdiffstats
path: root/cypress/e2e/files_versions/version_download.cy.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cypress/e2e/files_versions/version_download.cy.ts')
-rw-r--r--cypress/e2e/files_versions/version_download.cy.ts53
1 files changed, 23 insertions, 30 deletions
diff --git a/cypress/e2e/files_versions/version_download.cy.ts b/cypress/e2e/files_versions/version_download.cy.ts
index 0e4301654f0..548cb86a207 100644
--- a/cypress/e2e/files_versions/version_download.cy.ts
+++ b/cypress/e2e/files_versions/version_download.cy.ts
@@ -1,23 +1,6 @@
/**
- * @copyright Copyright (c) 2022 Louis Chmn <louis@chmn.me>
- *
- * @author Louis Chmn <louis@chmn.me>
- *
- * @license AGPL-3.0-or-later
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { assertVersionContent, doesNotHaveAction, openVersionsPanel, setupTestSharedFileFromUser, uploadThreeVersions } from './filesVersionsUtils'
@@ -31,6 +14,7 @@ describe('Versions download', () => {
before(() => {
randomFileName = Math.random().toString(36).replace(/[^a-z]+/g, '').substring(0, 10) + '.txt'
+ cy.runOccCommand('config:app:set --value no core shareapi_allow_view_without_download')
cy.createRandomUser()
.then((_user) => {
user = _user
@@ -41,6 +25,10 @@ describe('Versions download', () => {
})
})
+ after(() => {
+ cy.runOccCommand('config:app:delete core shareapi_allow_view_without_download')
+ })
+
it('Download versions and assert their content', () => {
assertVersionContent(0, 'v3')
assertVersionContent(1, 'v2')
@@ -69,31 +57,36 @@ describe('Versions download', () => {
})
it('Does not work without download permission through direct API access', () => {
- let hostname: string
let fileId: string|undefined
let versionId: string|undefined
setupTestSharedFileFromUser(user, randomFileName, { download: false })
- .then(recipient => {
+ .then((recipient) => {
openVersionsPanel(randomFileName)
- cy.url().then(url => { hostname = new URL(url).hostname })
- getRowForFile(randomFileName).invoke('attr', 'data-cy-files-list-row-fileid').then(_fileId => { fileId = _fileId })
- cy.get('[data-files-versions-version]').eq(1).invoke('attr', 'data-files-versions-version').then(_versionId => { versionId = _versionId })
+ getRowForFile(randomFileName)
+ .should('be.visible')
+ .invoke('attr', 'data-cy-files-list-row-fileid')
+ .then(($fileId) => { fileId = $fileId })
+
+ cy.get('[data-files-versions-version]')
+ .eq(1)
+ .invoke('attr', 'data-files-versions-version')
+ .then(($versionId) => { versionId = $versionId })
+ cy.logout()
cy.then(() => {
- cy.logout()
- cy.request({
+ const base = Cypress.config('baseUrl')!.replace(/\/index\.php\/?$/, '')
+ return cy.request({
+ url: `${base}/remote.php/dav/versions/${recipient.userId}/versions/${fileId}/${versionId}`,
auth: { user: recipient.userId, pass: recipient.password },
headers: {
cookie: '',
},
- url: `http://${hostname}/remote.php/dav/versions/${recipient.userId}/versions/${fileId}/${versionId}`,
failOnStatusCode: false,
})
- .then(({ status }) => {
- expect(status).to.equal(403)
- })
+ }).then(({ status }) => {
+ expect(status).to.equal(403)
})
})
})