Skip to content

Commit 83a3db3

Browse files
committed
chore(cypress): adjust files-sidebar.cy.ts
Signed-off-by: skjnldsv <[email protected]>
1 parent 12a2c0f commit 83a3db3

File tree

4 files changed

+146
-39
lines changed

4 files changed

+146
-39
lines changed

cypress/e2e/files/files-sidebar.cy.ts

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,6 @@
11
/**
2-
* @copyright Copyright (c) 2024 Ferdinand Thiessen <[email protected]>
3-
*
4-
* @author Ferdinand Thiessen <[email protected]>
5-
*
6-
* @license AGPL-3.0-or-later
7-
*
8-
* This program is free software: you can redistribute it and/or modify
9-
* it under the terms of the GNU Affero General Public License as
10-
* published by the Free Software Foundation, either version 3 of the
11-
* License, or (at your option) any later version.
12-
*
13-
* This program is distributed in the hope that it will be useful,
14-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
* GNU Affero General Public License for more details.
17-
*
18-
* You should have received a copy of the GNU Affero General Public License
19-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20-
*
2+
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3+
* SPDX-License-Identifier: AGPL-3.0-or-later
214
*/
225

236
import type { User } from '@nextcloud/cypress'
@@ -44,7 +27,10 @@ describe('Files: Sidebar', { testIsolation: true }, () => {
4427

4528
triggerActionForFile('file', 'details')
4629

47-
cy.get('[cy-data-sidebar]').should('be.visible')
30+
cy.get('[data-cy-sidebar]')
31+
.should('be.visible')
32+
.findByRole('heading', { name: 'file' })
33+
.should('be.visible')
4834
})
4935

5036
it('changes the current fileid', () => {
@@ -53,7 +39,7 @@ describe('Files: Sidebar', { testIsolation: true }, () => {
5339

5440
triggerActionForFile('file', 'details')
5541

56-
cy.get('[cy-data-sidebar]').should('be.visible')
42+
cy.get('[data-cy-sidebar]').should('be.visible')
5743
cy.url().should('contain', `apps/files/files/${fileId}`)
5844
})
5945

@@ -84,7 +70,8 @@ describe('Files: Sidebar', { testIsolation: true }, () => {
8470
// open the sidebar
8571
triggerActionForFile('file', 'details')
8672
// validate it is open
87-
cy.get('[cy-data-sidebar]').should('be.visible')
73+
cy.get('[data-cy-sidebar]')
74+
.should('be.visible')
8875

8976
// if we navigate to the folder
9077
navigateToFolder('folder')
@@ -104,7 +91,10 @@ describe('Files: Sidebar', { testIsolation: true }, () => {
10491
cy.get('[data-cy-sidebar]').should('be.visible')
10592
// delete the file
10693
triggerActionForFile('file', 'delete')
107-
cy.get('[cy-data-sidebar]').should('not.exist')
94+
cy.wait('@deleteFile', { timeout: 10000 })
95+
// see the sidebar is closed
96+
cy.get('[data-cy-sidebar]')
97+
.should(assertNotExistOrNotVisible)
10898
})
10999

110100
it('changes the fileid on delete', () => {
@@ -122,11 +112,13 @@ describe('Files: Sidebar', { testIsolation: true }, () => {
122112
// open the sidebar
123113
triggerActionForFile('other', 'details')
124114
// validate it is open
125-
cy.get('[cy-data-sidebar]').should('be.visible')
115+
cy.get('[data-cy-sidebar]').should('be.visible')
126116
cy.url().should('contain', `apps/files/files/${otherFileId}`)
127117

128118
triggerActionForFile('other', 'delete')
129-
cy.get('[cy-data-sidebar]').should('not.exist')
119+
cy.wait('@deleteFile')
120+
121+
cy.get('[data-cy-sidebar]').should('not.exist')
130122
// Ensure the URL is changed
131123
cy.url().should('not.contain', `apps/files/files/${otherFileId}`)
132124
})

cypress/support/commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { addCommands, User } from '@nextcloud/cypress'
2727
import { basename } from 'path'
2828

2929
// Add custom commands
30+
import '@testing-library/cypress/add-commands'
3031
import 'cypress-if'
3132
import 'cypress-wait-until'
3233
addCommands()

package-lock.json

Lines changed: 126 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
"@nextcloud/typings": "^1.8.0",
130130
"@nextcloud/webpack-vue-config": "^6.0.1",
131131
"@pinia/testing": "^0.1.2",
132+
"@testing-library/cypress": "^10.0.2",
132133
"@testing-library/jest-dom": "^6.1.5",
133134
"@testing-library/user-event": "^14.4.3",
134135
"@testing-library/vue": "^5.8.3",
@@ -144,7 +145,7 @@
144145
"babel-plugin-module-resolver": "^5.0.2",
145146
"colord": "^2.9.3",
146147
"css-loader": "^6.8.1",
147-
"cypress": "^13.7.3",
148+
"cypress": "^13.13.2",
148149
"cypress-axe": "^1.5.0",
149150
"cypress-if": "^1.12.3",
150151
"cypress-split": "^1.21.2",

0 commit comments

Comments
 (0)