aboutsummaryrefslogtreecommitdiffstats
path: root/cypress
diff options
context:
space:
mode:
authorskjnldsv <skjnldsv@protonmail.com>2025-02-19 15:34:45 +0100
committerskjnldsv <skjnldsv@protonmail.com>2025-02-19 15:35:50 +0100
commit99579f0bbc81e8ba6b1ce35bb860b0ef01284147 (patch)
tree92c9b3fa9d71d20a43ef9ba7e02b03aee3a5dec9 /cypress
parentff86bacaad7ee9ae5374554df261ab999d5a3496 (diff)
downloadnextcloud-server-99579f0bbc81e8ba6b1ce35bb860b0ef01284147.tar.gz
nextcloud-server-99579f0bbc81e8ba6b1ce35bb860b0ef01284147.zip
fix(files): do not show extension warning for folders renamingfix/files-rename-folder
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'cypress')
-rw-r--r--cypress/e2e/files/files-renaming.cy.ts65
1 files changed, 64 insertions, 1 deletions
diff --git a/cypress/e2e/files/files-renaming.cy.ts b/cypress/e2e/files/files-renaming.cy.ts
index 061f987a24e..0e698432102 100644
--- a/cypress/e2e/files/files-renaming.cy.ts
+++ b/cypress/e2e/files/files-renaming.cy.ts
@@ -4,7 +4,7 @@
*/
import type { User } from '@nextcloud/cypress'
-import { calculateViewportHeight, getRowForFile, haveValidity, renameFile, triggerActionForFile } from './FilesUtils'
+import { calculateViewportHeight, createFolder, getRowForFile, haveValidity, renameFile, triggerActionForFile } from './FilesUtils'
describe('files: Rename nodes', { testIsolation: true }, () => {
let user: User
@@ -193,4 +193,67 @@ describe('files: Rename nodes', { testIsolation: true }, () => {
.findByRole('textbox', { name: 'Filename' })
.should('not.exist')
})
+
+ it('shows warning on extension change', () => {
+ getRowForFile('file.txt').should('be.visible')
+
+ triggerActionForFile('file.txt', 'rename')
+ getRowForFile('file.txt')
+ .findByRole('textbox', { name: 'Filename' })
+ .should('be.visible')
+ .type('{selectAll}file.md')
+ .should(haveValidity(''))
+ .type('{enter}')
+
+ // See warning dialog
+ cy.findByRole('dialog', { name: 'Change file extension' })
+ .should('be.visible')
+ .findByRole('button', { name: /use/i })
+ .click()
+
+ // See it is renamed
+ getRowForFile('file.md').should('be.visible')
+ })
+
+ it('shows warning on extension change and allow cancellation', () => {
+ getRowForFile('file.txt').should('be.visible')
+
+ triggerActionForFile('file.txt', 'rename')
+ getRowForFile('file.txt')
+ .findByRole('textbox', { name: 'Filename' })
+ .should('be.visible')
+ .type('{selectAll}file.md')
+ .should(haveValidity(''))
+ .type('{enter}')
+
+ // See warning dialog
+ cy.findByRole('dialog', { name: 'Change file extension' })
+ .should('be.visible')
+ .findByRole('button', { name: /keep/i })
+ .click()
+
+ // See it is not renamed
+ getRowForFile('file.txt').should('be.visible')
+ getRowForFile('file.md').should('not.exist')
+ })
+
+ it('does not show warning on folder renaming with a dot', () => {
+ createFolder('folder.2024')
+
+ getRowForFile('folder.2024').should('be.visible')
+
+ triggerActionForFile('folder.2024', 'rename')
+ getRowForFile('folder.2024')
+ .findByRole('textbox', { name: 'Folder name' })
+ .should('be.visible')
+ .type('{selectAll}folder.2025')
+ .should(haveValidity(''))
+ .type('{enter}')
+
+ // See warning dialog
+ cy.get('[role=dialog]').should('not.exist')
+
+ // See it is not renamed
+ getRowForFile('folder.2025').should('be.visible')
+ })
})