Skip to content

Commit 5dbca55

Browse files
committed
fix(cypress): opendetails tests
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
1 parent ba381d8 commit 5dbca55

1 file changed

Lines changed: 2 additions & 71 deletions

File tree

cypress/e2e/files/router-query.cy.ts

Lines changed: 2 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@ function skipIfViewerDisabled(this: Mocha.Context): void {
3333
})
3434
}
3535

36-
/**
37-
* Check a file was not downloaded
38-
* @param filename The expected filename
39-
*/
40-
function fileNotDownloaded(filename: string): void {
41-
const downloadsFolder = Cypress.config('downloadsFolder')
42-
cy.readFile(join(downloadsFolder, filename)).should('not.exist')
43-
}
44-
4536
describe('Check router query flags:', function() {
4637
let user: User
4738
let imageId: number
@@ -61,50 +52,6 @@ describe('Check router query flags:', function() {
6152
})
6253
})
6354

64-
describe('"opendetails"', () => {
65-
it('open details for known file type', () => {
66-
cy.visit(`/apps/files/files/${imageId}?opendetails`)
67-
68-
// see sidebar
69-
sidebarIsOpen('image.jpg')
70-
71-
// but no viewer
72-
cy.findByRole('dialog', { name: 'image.jpg' })
73-
.should('not.exist')
74-
75-
// and no download
76-
fileNotDownloaded('image.jpg')
77-
})
78-
79-
it('open details for unknown file type', () => {
80-
cy.visit(`/apps/files/files/${archiveId}?opendetails`)
81-
82-
// see sidebar
83-
sidebarIsOpen('archive.zst')
84-
85-
// but no viewer
86-
cy.findByRole('dialog', { name: 'archive.zst' })
87-
.should('not.exist')
88-
89-
// and no download
90-
fileNotDownloaded('archive.zst')
91-
})
92-
93-
it('open details for folder', () => {
94-
cy.visit(`/apps/files/files/${folderId}?opendetails`)
95-
96-
// see sidebar
97-
sidebarIsOpen('folder')
98-
99-
// but no viewer
100-
cy.findByRole('dialog', { name: 'folder' })
101-
.should('not.exist')
102-
103-
// and no download
104-
fileNotDownloaded('folder')
105-
})
106-
})
107-
10855
describe('"openfile"', function() {
10956
/** Check the viewer is open and shows the image */
11057
function viewerShowsImage(): void {
@@ -143,16 +90,8 @@ describe('Check router query flags:', function() {
14390
it('does not open folders but shows details', () => {
14491
cy.visit(`/apps/files/files/${folderId}?openfile`)
14592

146-
// See the URL was replaced
147-
cy.url()
148-
.should('match', /[?&]opendetails(&|=|$)/)
149-
.and('not.match', /openfile/)
150-
15193
// See the sidebar is correctly opened
152-
cy.get('[data-cy-sidebar]')
153-
.should('be.visible')
154-
.findByRole('heading', { name: 'folder' })
155-
.should('be.visible')
94+
sidebarIsOpen('folder')
15695

15796
// see the folder was not changed
15897
getRowForFileId(imageId).should('exist')
@@ -161,16 +100,8 @@ describe('Check router query flags:', function() {
161100
it('does not open unknown file types but shows details', () => {
162101
cy.visit(`/apps/files/files/${archiveId}?openfile`)
163102

164-
// See the URL was replaced
165-
cy.url()
166-
.should('match', /[?&]opendetails(&|=|$)/)
167-
.and('not.match', /openfile/)
168-
169103
// See the sidebar is correctly opened
170-
cy.get('[data-cy-sidebar]')
171-
.should('be.visible')
172-
.findByRole('heading', { name: 'archive.zst' })
173-
.should('be.visible')
104+
sidebarIsOpen('archive.zst')
174105

175106
// See no file was downloaded
176107
const downloadsFolder = Cypress.config('downloadsFolder')

0 commit comments

Comments
 (0)