Skip to content

Commit 33608cd

Browse files
committed
Update cypress test suite
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
1 parent d9fb56a commit 33608cd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+733
-1019
lines changed

cypress.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ export default defineConfig({
1313
viewportHeight: 720,
1414

1515
// Tries again 2 more times on failure
16-
retries: 2,
16+
retries: {
17+
runMode: 2,
18+
// do not retry in `cypress open`
19+
openMode: 0,
20+
},
1721

1822
// Needed to trigger `after:run` events with cypress open
1923
experimentalInteractiveRunEvents: true,
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,25 @@
2020
*
2121
*/
2222

23-
import { randHash } from '../utils'
23+
import { randHash } from '../../utils'
2424
const randUser = randHash()
2525

2626
describe('Delete image.png in viewer', function() {
2727
before(function() {
2828
// Init user
29-
cy.nextcloudCreateUser(randUser, 'password')
30-
cy.login(randUser, 'password')
29+
cy.nextcloudCreateUser(randUser)
3130

3231
// Upload test files
33-
cy.uploadFile('image.png', 'image/png')
34-
cy.visit('/apps/files')
35-
36-
// wait a bit for things to be settled
37-
cy.wait(1000)
32+
cy.uploadFile(randUser, 'image.png', 'image/png')
3833
})
3934
after(function() {
4035
cy.logout()
4136
})
4237

4338
it('See image.png in the list', function() {
39+
cy.login(randUser)
40+
cy.visit('/apps/files')
41+
4442
cy.get('.files-fileList tr[data-file="image.png"]', { timeout: 10000 })
4543
.should('contain', 'image.png')
4644
})
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
*/
2222

23-
import { randHash } from '../utils'
23+
import { randHash } from '../../utils'
2424
import * as path from 'path'
2525

2626
const randUser = randHash()
@@ -29,22 +29,20 @@ const fileName = 'image.png'
2929
describe(`Download ${fileName} in viewer`, function() {
3030
before(function() {
3131
// Init user
32-
cy.nextcloudCreateUser(randUser, 'password')
33-
cy.login(randUser, 'password')
32+
cy.nextcloudCreateUser(randUser)
3433

3534
// Upload test files
36-
cy.uploadFile(fileName, 'image/png')
37-
cy.visit('/apps/files')
38-
39-
// wait a bit for things to be settled
40-
cy.wait(1000)
35+
cy.uploadFile(randUser, fileName, 'image/png')
4136
})
4237

4338
after(function() {
4439
cy.logout()
4540
})
4641

4742
it(`See "${fileName}" in the list`, function() {
43+
cy.login(randUser)
44+
cy.visit('/apps/files')
45+
4846
cy.get(`.files-fileList tr[data-file="${fileName}"]`, { timeout: 10000 })
4947
.should('contain', fileName)
5048
})
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,28 @@
2121
*
2222
*/
2323

24-
import { randHash } from '../utils/'
24+
import { randHash } from '../../utils'
2525
const randUser = randHash()
2626

2727
describe('Open the sidebar from the viewer and open viewer with sidebar already opened', function() {
2828
before(function() {
2929
// Init user
30-
cy.nextcloudCreateUser(randUser, 'password')
31-
cy.login(randUser, 'password')
30+
cy.nextcloudCreateUser(randUser)
3231

3332
// Upload test files
34-
cy.uploadFile('image1.jpg', 'image/jpeg')
35-
cy.uploadFile('image2.jpg', 'image/jpeg')
36-
cy.uploadFile('image3.jpg', 'image/jpeg')
37-
cy.uploadFile('image4.jpg', 'image/jpeg')
38-
cy.visit('/apps/files')
39-
40-
// wait a bit for things to be settled
41-
cy.wait(1000)
33+
cy.uploadFile(randUser, 'image1.jpg', 'image/jpeg')
34+
cy.uploadFile(randUser, 'image2.jpg', 'image/jpeg')
35+
cy.uploadFile(randUser, 'image3.jpg', 'image/jpeg')
36+
cy.uploadFile(randUser, 'image4.jpg', 'image/jpeg')
4237
})
4338
after(function() {
4439
cy.logout()
4540
})
4641

4742
it('See images in the list', function() {
43+
cy.login(randUser)
44+
cy.visit('/apps/files')
45+
4846
cy.get('.files-fileList tr[data-file="image1.jpg"]', { timeout: 10000 })
4947
.should('contain', 'image1.jpg')
5048
cy.get('.files-fileList tr[data-file="image2.jpg"]', { timeout: 10000 })

cypress/e2e/audio.mpeg.cy.js

Lines changed: 0 additions & 76 deletions
This file was deleted.

cypress/e2e/audio.ogg.cy.js

Lines changed: 0 additions & 76 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* @copyright Copyright (c) 2020 Daniel Kesselberg <mail@danielkesselberg.de>
3+
*
4+
* @author Daniel Kesselberg <mail@danielkesselberg.de>
5+
*
6+
* @license AGPL-3.0-or-later
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Affero General Public License as
10+
* published by the Free Software Foundation, either version 3 of the
11+
* License, or (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU Affero General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU Affero General Public License
19+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
*
21+
*/
22+
23+
import audioTest from '../mixins/audio.js'
24+
25+
describe('Open audio.mp3 in viewer', function() {
26+
audioTest('audio.mp3', 'audio/mpeg')
27+
})

cypress/e2e/audios/audio.ogg.cy.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* @copyright Copyright (c) 2020 Daniel Kesselberg <mail@danielkesselberg.de>
3+
*
4+
* @author Daniel Kesselberg <mail@danielkesselberg.de>
5+
*
6+
* @license AGPL-3.0-or-later
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Affero General Public License as
10+
* published by the Free Software Foundation, either version 3 of the
11+
* License, or (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU Affero General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU Affero General Public License
19+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
*
21+
*/
22+
import audioTest from '../mixins/audio.js'
23+
24+
describe('Open audio.ogg in viewer', function() {
25+
audioTest('audio.ogg', 'audio/ogg')
26+
})

0 commit comments

Comments
 (0)