Skip to content

Commit 31804f4

Browse files
committed
Fix tests
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
1 parent 1aa8f17 commit 31804f4

7 files changed

Lines changed: 15 additions & 10 deletions

File tree

cypress/e2e/download-share-disabled.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ describe(`Download ${fileName} in viewer`, function() {
9292

9393
it('See the title on the viewer header but not the Download button', function() {
9494
cy.get('body > .viewer .modal-title').should('contain', 'image1.jpg')
95-
cy.get('body > .viewer .modal-header button.action-item > .download-icon').should('not.exist')
95+
cy.get('body > .viewer .modal-header a.action-item .download-icon').should('not.exist')
9696
cy.get('body > .viewer .modal-header button.header-close').should('be.visible')
9797
})
9898

cypress/e2e/download-share.cy.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ const randUser = randHash()
2727
const fileName = 'image1.jpg'
2828

2929
describe(`Download ${fileName} from viewer in link share`, function() {
30+
let token = null
31+
3032
before(function() {
3133
// Init user
3234
cy.nextcloudCreateUser(randUser, 'password')
@@ -60,7 +62,8 @@ describe(`Download ${fileName} from viewer in link share`, function() {
6062
})
6163

6264
it('Share the Photos folder with a share link and access the share link', function() {
63-
cy.createLinkShare('/Photos').then(token => {
65+
cy.createLinkShare('/Photos').then(newToken => {
66+
token = newToken
6467
cy.logout()
6568
cy.visit(`/s/${token}`)
6669
})
@@ -80,13 +83,15 @@ describe(`Download ${fileName} from viewer in link share`, function() {
8083

8184
it('See the download icon and title on the viewer header', function() {
8285
cy.get('body > .viewer .modal-title').should('contain', 'image1.jpg')
83-
cy.get('body > .viewer .modal-header button.action-item > .download-icon').should('be.visible')
86+
cy.get(`body > .viewer .modal-header a.action-item[href*='/s/${token}/download']`).should('be.visible')
8487
cy.get('body > .viewer .modal-header button.header-close').should('be.visible')
8588
})
8689

8790
it('Download the image', function() {
91+
// https://github.com/cypress-io/cypress/issues/14857
92+
cy.window().then((win) => { setTimeout(() => { win.location.reload() }, 5000) })
8893
// download the file
89-
cy.get('body > .viewer .modal-header button.action-item > .download-icon').click()
94+
cy.get('body > .viewer .modal-header a.action-item .download-icon').click()
9095
})
9196

9297
it('Compare downloaded file with asset by size', function() {

cypress/e2e/non-dav-files.cy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ describe('Open non-dav files in viewer', function() {
3939

4040
it('Open login background', function() {
4141
const fileInfo = {
42-
filename: '/core/img/logo/logo.png',
42+
filename: '/core/img/app-background.png',
4343
basename: 'logo.png',
4444
mime: 'image/png',
45-
source: '/core/img/logo/logo.png',
45+
source: '/core/img/app-background.png',
4646
etag: 'abc',
4747
hasPreview: false,
4848
fileid: 123,

cypress/e2e/visual-regression.cy.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ describe('Visual regression tests ', function() {
8686
})
8787

8888
it('Show second file on next', function() {
89-
cy.get('body > .viewer a.next').click()
89+
cy.get('body > .viewer button.next').click()
9090
cy.get('body > .viewer .modal-container img').should('have.length', 1)
9191
cy.get('body > .viewer .modal-container img').should('have.attr', 'src')
9292
cy.get('body > .viewer button.prev').should('be.visible')
@@ -129,10 +129,10 @@ describe('Visual regression tests ', function() {
129129

130130
it('Open non-dav image', function() {
131131
const fileInfo = {
132-
filename: '/core/img/logo/logo.png',
133-
basename: 'logo.png',
132+
filename: '/core/img/favicon.png',
133+
basename: 'favicon.png',
134134
mime: 'image/png',
135-
source: '/core/img/logo/logo.png',
135+
source: '/core/img/favicon.png',
136136
etag: 'abc',
137137
hasPreview: false,
138138
fileid: 123,
-55.4 KB
Loading
-499 Bytes
Loading
1.79 KB
Loading

0 commit comments

Comments
 (0)