Skip to content

Commit 2e955fc

Browse files
susnuxbackportbot[bot]
authored andcommitted
test: Add regression test for opening shared folders
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent d60179d commit 2e955fc

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*!
2+
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3+
* SPDX-License-Identifier: AGPL-3.0-or-later
4+
*/
5+
import type { User } from '@nextcloud/cypress'
6+
import { createShare } from './FilesSharingUtils.ts'
7+
import { getRowForFile } from '../files/FilesUtils.ts'
8+
9+
describe('files_sharing: Files view', { testIsolation: true }, () => {
10+
let user: User
11+
let sharee: User
12+
13+
beforeEach(() => {
14+
cy.createRandomUser().then(($user) => {
15+
user = $user
16+
})
17+
cy.createRandomUser().then(($user) => {
18+
sharee = $user
19+
})
20+
})
21+
22+
/**
23+
* Regression test of https://github.com/nextcloud/server/issues/46108
24+
*/
25+
it('opens a shared folder when clicking on it', () => {
26+
cy.mkdir(user, '/folder')
27+
cy.uploadContent(user, new Blob([]), 'text/plain', '/folder/file')
28+
cy.login(user)
29+
cy.visit('/apps/files')
30+
31+
// share the folder
32+
createShare('folder', sharee.userId, { read: true, download: true })
33+
// visit the own shares
34+
cy.visit('/apps/files/sharingout')
35+
// see the shared folder
36+
getRowForFile('folder').should('be.visible')
37+
// click on the folder should open it in files
38+
getRowForFile('folder').findByRole('button', { name: 'folder' }).click()
39+
// See the URL has changed
40+
cy.url().should('match', /apps\/files\/files\/.+dir=\/folder/)
41+
// Content of the shared folder
42+
getRowForFile('file').should('be.visible')
43+
44+
cy.logout()
45+
// Now for the sharee
46+
cy.login(sharee)
47+
48+
// visit shared files view
49+
cy.visit('/apps/files/sharingin')
50+
// see the shared folder
51+
getRowForFile('folder').should('be.visible')
52+
// click on the folder should open it in files
53+
getRowForFile('folder').findByRole('button', { name: 'folder' }).click()
54+
// See the URL has changed
55+
cy.url().should('match', /apps\/files\/files\/.+dir=\/folder/)
56+
// Content of the shared folder
57+
getRowForFile('file').should('be.visible')
58+
})
59+
})

0 commit comments

Comments
 (0)