-
-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathalbums.cy.js
More file actions
164 lines (142 loc) · 4.64 KB
/
albums.cy.js
File metadata and controls
164 lines (142 loc) · 4.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/**
* @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/>.
*
*/
import {
addFilesToAlbumFromAlbum,
addFilesToAlbumFromAlbumFromHeader,
createAnAlbumFromAlbums,
goToAlbum,
removeSelectionFromAlbum,
} from './albumsUtils'
import {
deleteSelection,
favoriteSelection,
mkdir,
selectMedia,
unfavoriteSelection,
unselectMedia,
uploadTestMedia,
} from './photosUtils'
const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/
Cypress.on('uncaught:exception', (err) => {
/* returning false here prevents Cypress from failing the test */
if (resizeObserverLoopErrRe.test(err.message)) {
return false
}
})
describe('Manage albums', () => {
let user = null
beforeEach(function () {
cy.createRandomUser()
.then(_user => {
user = _user
mkdir(user, '/Photos')
uploadTestMedia(user)
cy.login(user)
})
cy.visit(`${Cypress.env('baseUrl')}/index.php/apps/photos/albums`)
createAnAlbumFromAlbums('albums_test')
addFilesToAlbumFromAlbum('albums_test', [0, 1, 2])
})
it('Create an album, populate it and delete it', () => {
cy.get('[data-test="media"]').should('have.length', 3)
})
it('Remove a file to an album from an album content view', () => {
selectMedia([0])
removeSelectionFromAlbum()
})
it('Remove multiple files to an album from an album content view', () => {
selectMedia([0, 1])
removeSelectionFromAlbum()
})
it('Favorite a file from an album content view', () => {
selectMedia([0])
favoriteSelection()
cy.get('[data-test="media"]').eq(0).find('[aria-label="Favorite"]')
unfavoriteSelection()
unselectMedia([0])
cy.get('[aria-label="Favorite"]').should('not.exist')
})
it('Favorite multiple files from an album content view', () => {
selectMedia([1, 2])
favoriteSelection()
cy.get('[data-test="media"]').eq(1).find('[aria-label="Favorite"]')
cy.get('[data-test="media"]').eq(2).find('[aria-label="Favorite"]')
unfavoriteSelection()
unselectMedia([1, 2])
cy.get('[aria-label="Favorite"]').should('not.exist')
})
// it('Download a file from an album content view', () => {
// selectMedia([0])
// downloadSelection()
// unselectMedia([0])
// })
// it('Download multiple files from an album content view', () => {
// selectMedia([1, 2])
// downloadSelection()
// unselectMedia([1, 2])
// })
// it('Download all files from an album content view', () => {
// selectMedia([1, 2])
// downloadSelection()
// unselectMedia([1, 2])
// })
it('Edit an album\'s name', () => {
cy.get('[aria-label="Open actions menu"]').click()
cy.contains('Edit album details').click()
cy.get('form [name="name"]').clear()
cy.get('form [name="name"]').type('New name')
cy.contains('Save').click()
cy.contains('New name')
cy.reload()
cy.contains('New name')
cy.get('[aria-label="Open actions menu"]').click()
cy.contains('Edit album details').click()
cy.get('form [name="name"]').clear()
cy.get('form [name="name"]').type('albums_test')
cy.contains('Save').click()
})
it('Edit an album\'s location', () => {
cy.get('[aria-label="Open actions menu"]').click()
cy.contains('Edit album details').click()
cy.get('form [name="location"]').clear()
cy.get('form [name="location"]').type('New location')
cy.intercept({ times: 1, method: 'PROPPATCH', url: '/remote.php/dav/photos/*/albums/*' }).as('propPatchAlbum')
cy.contains('Save').click()
cy.wait('@propPatchAlbum')
cy.contains('New location')
cy.reload()
cy.contains('New location')
cy.get('[aria-label="Open actions menu"]').click()
cy.contains('Edit album details').click()
cy.get('form [name="location"]').clear()
cy.contains('Save').click()
})
it('Delete a file that was added to an album', () => {
addFilesToAlbumFromAlbumFromHeader('albums_test', [3])
cy.get('[data-test="media"]').should('have.length', 4)
cy.visit('/apps/photos')
selectMedia([3])
deleteSelection()
goToAlbum('albums_test')
cy.get('[data-test="media"]').should('have.length', 3)
})
})