0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-05-02 04:50:37 +00:00
nextcloud_server/cypress/e2e/files_versions/version_sharing.cy.ts
Ferdinand Thiessen 433e704b63 fix(files_versions): correctly show version author also for shared files
The users endpoint is not available for other users if the current user
has no admin privileges, so instead use the displaynames endpoint.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
2025-03-26 11:50:46 +00:00

46 lines
1.5 KiB
TypeScript

/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import type { User } from '@nextcloud/cypress'
import { openVersionsPanel, setupTestSharedFileFromUser, uploadThreeVersions } from './filesVersionsUtils.ts'
import { navigateToFolder, triggerActionForFile } from '../files/FilesUtils.ts'
describe('Versions on shares', () => {
const randomSharedFolderName = Math.random().toString(36).replace(/[^a-z]+/g, '').substring(0, 10)
const randomFileName = Math.random().toString(36).replace(/[^a-z]+/g, '').substring(0, 10) + '.txt'
const randomFilePath = `${randomSharedFolderName}/${randomFileName}`
let alice: User
let bob: User
before(() => {
cy.createRandomUser()
.then((user) => {
alice = user
})
.then(() => {
cy.mkdir(alice, `/${randomSharedFolderName}`)
return setupTestSharedFileFromUser(alice, randomSharedFolderName, {})
})
.then((user) => { bob = user })
.then(() => uploadThreeVersions(alice, randomFilePath))
})
it('See sharees display name as author', () => {
cy.login(bob)
cy.visit('/apps/files')
navigateToFolder(randomSharedFolderName)
triggerActionForFile(randomFileName, 'details')
cy.findByRole('tab', { name: 'Versions' }).click()
cy.findByRole('tabpanel', { name: 'Versions' })
.findByRole('list', { name: 'File versions' })
.findAllByRole('listitem')
.first()
.find('[data-cy-files-version-author-name]')
.should('be.visible')
.and('contain.text', alice.userId)
})
})