Skip to content

Commit 439ee45

Browse files
authored
Merge pull request #1802 from nextcloud/backport/stable25/artonge/fix/revert_display_name_in_shared_album
[stable25] Revert using display name in shared albums' name
2 parents 47e06b5 + 673fb08 commit 439ee45

17 files changed

Lines changed: 284 additions & 26 deletions

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ vendor
2222

2323
cypress/videos
2424
cypress/snapshots
25-
cypress/downloads
25+
cypress/downloads
26+
27+
js/*hot-update.*

cypress/e2e/shared_albums.cy.ts

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
2+
import { randHash } from '../utils'
3+
/**
4+
* @copyright Copyright (c) 2022 Louis Chmn <louis@chmn.me>
5+
*
6+
* @author Louis Chmn <louis@chmn.me>
7+
*
8+
* @license AGPL-3.0-or-later
9+
*
10+
* This program is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Affero General Public License as
12+
* published by the Free Software Foundation, either version 3 of the
13+
* License, or (at your option) any later version.
14+
*
15+
* This program is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Affero General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Affero General Public License
21+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
*
23+
*/
24+
import { User } from '@nextcloud/cypress'
25+
import {
26+
addCollaborators,
27+
addFilesToAlbumFromAlbum,
28+
createAnAlbumFromAlbums,
29+
goToAlbum,
30+
removeCollaborators,
31+
removeSelectionFromAlbum,
32+
} from './albumsUtils'
33+
import {
34+
downloadAllFiles,
35+
downloadSelection,
36+
goToSharedAlbum,
37+
removeSharedAlbums,
38+
selectMedia,
39+
uploadTestMedia,
40+
} from './photosUtils'
41+
42+
import { randHash } from '../utils'
43+
44+
const alice = new User(`alice_${randHash()}`)
45+
const bob = new User(`bob_${randHash()}`)
46+
const charlie = new User(`charlie_${randHash()}`)
47+
48+
const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/
49+
Cypress.on('uncaught:exception', (err) => {
50+
/* returning false here prevents Cypress from failing the test */
51+
if (resizeObserverLoopErrRe.test(err.message)) {
52+
return false
53+
}
54+
})
55+
56+
describe('Manage shared albums', () => {
57+
before(() => {
58+
cy.createUser(alice)
59+
cy.createUser(bob).then(() => {
60+
uploadTestMedia(bob)
61+
})
62+
cy.createUser(charlie)
63+
64+
})
65+
66+
context('Adding and removing files in a shared album', () => {
67+
before(() => {
68+
cy.login(alice)
69+
cy.visit('apps/photos/albums')
70+
createAnAlbumFromAlbums('shared_album_test1')
71+
addCollaborators([bob.userId])
72+
})
73+
74+
it('Add and remove a file to a shared album from a shared album', () => {
75+
cy.login(bob)
76+
cy.visit('apps/photos/albums')
77+
goToSharedAlbum('shared_album_test1')
78+
cy.get('[data-test="media"]').should('have.length', 0)
79+
addFilesToAlbumFromAlbum('shared_album_test1', [0])
80+
cy.get('[data-test="media"]').should('have.length', 1)
81+
selectMedia([0])
82+
removeSelectionFromAlbum()
83+
cy.get('[data-test="media"]').should('have.length', 0)
84+
})
85+
86+
it('Add and remove multiple files to a shared album from a shared album', () => {
87+
goToSharedAlbum('shared_album_test1')
88+
cy.get('[data-test="media"]').should('have.length', 0)
89+
addFilesToAlbumFromAlbum('shared_album_test1', [1, 2])
90+
cy.get('[data-test="media"]').should('have.length', 2)
91+
selectMedia([0, 1])
92+
removeSelectionFromAlbum()
93+
cy.get('[data-test="media"]').should('have.length', 0)
94+
})
95+
})
96+
97+
context('Download files from a shared album', () => {
98+
before(() => {
99+
cy.login(alice)
100+
cy.visit('apps/photos/albums')
101+
createAnAlbumFromAlbums('shared_album_test2')
102+
addCollaborators([bob.userId])
103+
104+
cy.login(bob)
105+
cy.visit('apps/photos/sharedalbums')
106+
goToSharedAlbum('shared_album_test2')
107+
addFilesToAlbumFromAlbum('shared_album_test2', [0, 1, 2])
108+
})
109+
110+
xit('Download a file from a shared album', () => {
111+
goToSharedAlbum('shared_album_test2')
112+
selectMedia([0])
113+
downloadSelection()
114+
selectMedia([0])
115+
})
116+
117+
xit('Download multiple files from a shared album', () => {
118+
goToSharedAlbum('shared_album_test2')
119+
selectMedia([1, 2])
120+
downloadSelection()
121+
selectMedia([1, 2])
122+
})
123+
124+
xit('Download all files from a shared album', () => {
125+
goToSharedAlbum('shared_album_test2')
126+
downloadAllFiles()
127+
})
128+
})
129+
130+
context('Delete a received shared album', () => {
131+
before(() => {
132+
cy.login(alice)
133+
cy.visit('apps/photos/albums')
134+
createAnAlbumFromAlbums('shared_album_test3')
135+
addCollaborators([bob.userId])
136+
})
137+
138+
it('Remove shared album', () => {
139+
cy.login(bob)
140+
cy.visit('apps/photos/albums')
141+
goToSharedAlbum('shared_album_test3')
142+
removeSharedAlbums()
143+
})
144+
})
145+
146+
context('Remove a collaborator from an album', () => {
147+
before(() => {
148+
cy.login(alice)
149+
cy.visit('/apps/photos/albums')
150+
createAnAlbumFromAlbums('shared_album_test4')
151+
addCollaborators([bob.userId])
152+
})
153+
154+
it('Remove collaborator from an album', () => {
155+
cy.login(bob)
156+
cy.visit('apps/photos/sharedalbums')
157+
cy.get(`[data-test="shared_album_test4 (${alice.userId})"]`).should('have.length', 1)
158+
159+
cy.login(alice)
160+
cy.visit('/apps/photos')
161+
goToAlbum('shared_album_test4')
162+
removeCollaborators([bob.userId])
163+
164+
cy.login(bob)
165+
cy.visit('/apps/photos/sharedalbums')
166+
cy.get('body')
167+
.should('not.contain', `shared_album_test4 (${alice.userId})`)
168+
})
169+
})
170+
171+
context('Two shared albums with the same name', () => {
172+
before(() => {
173+
cy.login(alice)
174+
cy.visit('apps/photos/albums')
175+
createAnAlbumFromAlbums('shared_album_test5')
176+
addCollaborators([bob.userId])
177+
178+
cy.login(charlie)
179+
cy.visit('apps/photos/albums')
180+
createAnAlbumFromAlbums('shared_album_test5')
181+
addCollaborators([bob.userId])
182+
})
183+
184+
it('It should display two shared albums', () => {
185+
cy.login(bob)
186+
cy.visit('/apps/photos/sharedalbums')
187+
cy.get(`[data-test="shared_album_test5 (${alice.userId})"]`).should('have.length', 1)
188+
cy.get(`[data-test="shared_album_test5 (${charlie.userId})"]`).should('have.length', 1)
189+
})
190+
})
191+
})

js/photos-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/photos-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/photos-node_modules_vue-material-design-icons_AlertCircle_vue-node_modules_vue-material-design-icons-ea65fb.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/photos-node_modules_vue-material-design-icons_AlertCircle_vue-node_modules_vue-material-design-icons-ea65fb.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/photos-node_modules_vue-material-design-icons_PackageVariant_vue-node_modules_vue-material-design-ic-36962a.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/photos-node_modules_vue-material-design-icons_PackageVariant_vue-node_modules_vue-material-design-ic-36962a.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/photos-public.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/photos-public.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)