mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #50945 from nextcloud/backport/50930/stable30
This commit is contained in:
commit
516a2fbb9a
1 changed files with 2 additions and 71 deletions
|
|
@ -33,15 +33,6 @@ function skipIfViewerDisabled(this: Mocha.Context): void {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a file was not downloaded
|
||||
* @param filename The expected filename
|
||||
*/
|
||||
function fileNotDownloaded(filename: string): void {
|
||||
const downloadsFolder = Cypress.config('downloadsFolder')
|
||||
cy.readFile(join(downloadsFolder, filename)).should('not.exist')
|
||||
}
|
||||
|
||||
describe('Check router query flags:', function() {
|
||||
let user: User
|
||||
let imageId: number
|
||||
|
|
@ -61,50 +52,6 @@ describe('Check router query flags:', function() {
|
|||
})
|
||||
})
|
||||
|
||||
describe('"opendetails"', () => {
|
||||
it('open details for known file type', () => {
|
||||
cy.visit(`/apps/files/files/${imageId}?opendetails`)
|
||||
|
||||
// see sidebar
|
||||
sidebarIsOpen('image.jpg')
|
||||
|
||||
// but no viewer
|
||||
cy.findByRole('dialog', { name: 'image.jpg' })
|
||||
.should('not.exist')
|
||||
|
||||
// and no download
|
||||
fileNotDownloaded('image.jpg')
|
||||
})
|
||||
|
||||
it('open details for unknown file type', () => {
|
||||
cy.visit(`/apps/files/files/${archiveId}?opendetails`)
|
||||
|
||||
// see sidebar
|
||||
sidebarIsOpen('archive.zst')
|
||||
|
||||
// but no viewer
|
||||
cy.findByRole('dialog', { name: 'archive.zst' })
|
||||
.should('not.exist')
|
||||
|
||||
// and no download
|
||||
fileNotDownloaded('archive.zst')
|
||||
})
|
||||
|
||||
it('open details for folder', () => {
|
||||
cy.visit(`/apps/files/files/${folderId}?opendetails`)
|
||||
|
||||
// see sidebar
|
||||
sidebarIsOpen('folder')
|
||||
|
||||
// but no viewer
|
||||
cy.findByRole('dialog', { name: 'folder' })
|
||||
.should('not.exist')
|
||||
|
||||
// and no download
|
||||
fileNotDownloaded('folder')
|
||||
})
|
||||
})
|
||||
|
||||
describe('"openfile"', function() {
|
||||
/** Check the viewer is open and shows the image */
|
||||
function viewerShowsImage(): void {
|
||||
|
|
@ -143,16 +90,8 @@ describe('Check router query flags:', function() {
|
|||
it('does not open folders but shows details', () => {
|
||||
cy.visit(`/apps/files/files/${folderId}?openfile`)
|
||||
|
||||
// See the URL was replaced
|
||||
cy.url()
|
||||
.should('match', /[?&]opendetails(&|=|$)/)
|
||||
.and('not.match', /openfile/)
|
||||
|
||||
// See the sidebar is correctly opened
|
||||
cy.get('[data-cy-sidebar]')
|
||||
.should('be.visible')
|
||||
.findByRole('heading', { name: 'folder' })
|
||||
.should('be.visible')
|
||||
sidebarIsOpen('folder')
|
||||
|
||||
// see the folder was not changed
|
||||
getRowForFileId(imageId).should('exist')
|
||||
|
|
@ -161,16 +100,8 @@ describe('Check router query flags:', function() {
|
|||
it('does not open unknown file types but shows details', () => {
|
||||
cy.visit(`/apps/files/files/${archiveId}?openfile`)
|
||||
|
||||
// See the URL was replaced
|
||||
cy.url()
|
||||
.should('match', /[?&]opendetails(&|=|$)/)
|
||||
.and('not.match', /openfile/)
|
||||
|
||||
// See the sidebar is correctly opened
|
||||
cy.get('[data-cy-sidebar]')
|
||||
.should('be.visible')
|
||||
.findByRole('heading', { name: 'archive.zst' })
|
||||
.should('be.visible')
|
||||
sidebarIsOpen('archive.zst')
|
||||
|
||||
// See no file was downloaded
|
||||
const downloadsFolder = Cypress.config('downloadsFolder')
|
||||
|
|
|
|||
Loading…
Reference in a new issue