Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Aug 24, 2022
1 parent 1aa8f17 commit 31804f4
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/download-share-disabled.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe(`Download ${fileName} in viewer`, function() {

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

Expand Down
11 changes: 8 additions & 3 deletions cypress/e2e/download-share.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const randUser = randHash()
const fileName = 'image1.jpg'

describe(`Download ${fileName} from viewer in link share`, function() {
let token = null

before(function() {
// Init user
cy.nextcloudCreateUser(randUser, 'password')
Expand Down Expand Up @@ -60,7 +62,8 @@ describe(`Download ${fileName} from viewer in link share`, function() {
})

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

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

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

it('Compare downloaded file with asset by size', function() {
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/non-dav-files.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ describe('Open non-dav files in viewer', function() {

it('Open login background', function() {
const fileInfo = {
filename: '/core/img/logo/logo.png',
filename: '/core/img/app-background.png',
basename: 'logo.png',
mime: 'image/png',
source: '/core/img/logo/logo.png',
source: '/core/img/app-background.png',
etag: 'abc',
hasPreview: false,
fileid: 123,
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/visual-regression.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('Visual regression tests ', function() {
})

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

it('Open non-dav image', function() {
const fileInfo = {
filename: '/core/img/logo/logo.png',
basename: 'logo.png',
filename: '/core/img/favicon.png',
basename: 'favicon.png',
mime: 'image/png',
source: '/core/img/logo/logo.png',
source: '/core/img/favicon.png',
etag: 'abc',
hasPreview: false,
fileid: 123,
Expand Down
Binary file modified cypress/snapshots/base/visual-regression.cy.js/image-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cypress/snapshots/base/visual-regression.cy.js/image2-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cypress/snapshots/base/visual-regression.cy.js/non-dav-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 31804f4

Please sign in to comment.