Skip to content

Commit

Permalink
fixup! Add support for non-dav files
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst authored and skjnldsv committed Aug 19, 2022
1 parent 9514986 commit 733cee7
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 7 deletions.
18 changes: 17 additions & 1 deletion cypress/e2e/non-dav-files.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Open non-dav files in viewer', function() {
it('Open login background', function() {
const fileInfo = {
filename: '/core/img/logo/logo.png',
basename: '/core/img/logo',
basename: 'logo.png',
mime: 'image/png',
source: '/core/img/logo/logo.png',
etag: 'abc',
Expand All @@ -54,7 +54,23 @@ describe('Open non-dav files in viewer', function() {
list: [fileInfo],
})
})
})

it('Does not see a loading animation', function() {
cy.get('body > .viewer', { timeout: 10000 })
.should('be.visible')
.and('have.class', 'modal-mask')
.and('not.have.class', 'icon-loading')
})

it('See the menu icon and title on the viewer header', function() {
cy.get('body > .viewer .modal-title').should('contain', 'image.png')
cy.get('body > .viewer .modal-header button.action-item__menutoggle').should('be.visible')
cy.get('body > .viewer .modal-header button.header-close').should('be.visible')
})

it('Does not see navigation arrows', function() {
cy.get('body > .viewer a.prev').should('not.be.visible')
cy.get('body > .viewer a.next').should('not.be.visible')
})
})
22 changes: 18 additions & 4 deletions cypress/e2e/visual-regression.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe('Visual regression tests ', function() {
cy.get('body > .viewer a.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 a.next').should('be.visible')
cy.get('body > .viewer a.prev').should('be.visible')
cy.get('body > .viewer a.next').should('be.visible')
})

Expand All @@ -112,7 +112,7 @@ describe('Visual regression tests ', function() {
cy.get('body > .viewer .modal-title').should('contain', 'test-card.png')
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 a.next').should('be.visible')
cy.get('body > .viewer a.prev').should('be.visible')
cy.get('body > .viewer a.next').should('be.visible')
})

Expand All @@ -127,10 +127,10 @@ describe('Visual regression tests ', function() {
cy.compareSnapshot('image2')
})

it('Take non-dav file screenshot', function() {
it('Open non-dav image', function() {
const fileInfo = {
filename: '/core/img/logo/logo.png',
basename: '/core/img/logo',
basename: 'logo.png',
mime: 'image/png',
source: '/core/img/logo/logo.png',
etag: 'abc',
Expand All @@ -145,6 +145,20 @@ describe('Visual regression tests ', function() {
})
})

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 a.prev').should('not.be.visible')
cy.get('body > .viewer a.next').should('not.be.visible')
})

it('Does not see a loading animation', function() {
cy.get('body > .viewer', { timeout: 10000 })
.should('be.visible')
.and('have.class', 'modal-mask')
.and('not.have.class', 'icon-loading')
})

it('Take non-dav logo.png screenshot', function() {
cy.compareSnapshot('non-dav')
})
})
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.
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/video-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/ImageEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default {
return {
'data-theme-dark': true,
}
}
},
},
mounted() {
Expand Down
2 changes: 1 addition & 1 deletion src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ export default {
// retrieve folder list
const { request: folderRequest, cancel: cancelRequestFolder } = cancelableRequest(getFileList)
this.cancelRequestFolder = cancelRequestFolder
const [dirPath,] = extractFilePaths(fileInfo.filename)
const [dirPath] = extractFilePaths(fileInfo.filename)
const fileList = await folderRequest(dirPath)

// filter out the unwanted mimes
Expand Down

0 comments on commit 733cee7

Please sign in to comment.