aboutsummaryrefslogtreecommitdiffstats
path: root/cypress/e2e
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2025-03-06 14:09:39 +0100
committerGitHub <noreply@github.com>2025-03-06 14:09:39 +0100
commitb44f1568f2dc97c746281d99e2342ad679e3d8a9 (patch)
treeb21053e5f048409def95b552c149516f5e45de26 /cypress/e2e
parent4fe518a57bde7344cc7678645105feef470c9094 (diff)
parentad7afc6245336a6784f5720fc441b23a4a7876cd (diff)
downloadnextcloud-server-b44f1568f2dc97c746281d99e2342ad679e3d8a9.tar.gz
nextcloud-server-b44f1568f2dc97c746281d99e2342ad679e3d8a9.zip
Merge pull request #51288 from nextcloud/fix/admin-tag-color-prevent
fix(systemtags): unify restrict_creation_to_admin handling
Diffstat (limited to 'cypress/e2e')
-rw-r--r--cypress/e2e/systemtags/files-bulk-action.cy.ts58
1 files changed, 58 insertions, 0 deletions
diff --git a/cypress/e2e/systemtags/files-bulk-action.cy.ts b/cypress/e2e/systemtags/files-bulk-action.cy.ts
index 7e70e1d2836..575b4da9c38 100644
--- a/cypress/e2e/systemtags/files-bulk-action.cy.ts
+++ b/cypress/e2e/systemtags/files-bulk-action.cy.ts
@@ -75,6 +75,11 @@ describe('Systemtags: Files bulk action', { testIsolation: false }, () => {
resetTags()
})
+ after(() => {
+ resetTags()
+ cy.runOccCommand('config:app:set systemtags restrict_creation_to_admin --value 0')
+ })
+
it('Can assign tag to selection', () => {
cy.login(user1)
cy.visit('/apps/files')
@@ -87,6 +92,7 @@ describe('Systemtags: Files bulk action', { testIsolation: false }, () => {
triggerTagManagementDialogAction()
cy.get('[data-cy-systemtags-picker-tag]').should('have.length', 5)
+ cy.get('[data-cy-systemtags-picker-tag-color]').should('have.length', 5)
cy.intercept('PROPFIND', '/remote.php/dav/systemtags/*/files').as('getTagData')
cy.intercept('PROPPATCH', '/remote.php/dav/systemtags/*/files').as('assignTagData')
@@ -115,6 +121,7 @@ describe('Systemtags: Files bulk action', { testIsolation: false }, () => {
triggerTagManagementDialogAction()
cy.get('[data-cy-systemtags-picker-tag]').should('have.length', 5)
+ cy.get('[data-cy-systemtags-picker-tag-color]').should('have.length', 5)
cy.intercept('PROPFIND', '/remote.php/dav/systemtags/*/files').as('getTagData')
cy.intercept('PROPPATCH', '/remote.php/dav/systemtags/*/files').as('assignTagData')
@@ -353,4 +360,55 @@ describe('Systemtags: Files bulk action', { testIsolation: false }, () => {
expectInlineTagForFile('file5.txt', [newTag])
})
})
+
+ it('Cannot create tag if restriction is in place', () => {
+ let tagId: string
+
+ cy.runOccCommand('config:app:set systemtags restrict_creation_to_admin --value 1')
+ cy.runOccCommand('tag:add testTag public --output json').then(({ stdout }) => {
+ const tag = JSON.parse(stdout)
+ tagId = tag.id
+ })
+
+ cy.createRandomUser().then((user1) => {
+ files.forEach((file) => {
+ cy.uploadContent(user1, new Blob([]), 'text/plain', '/' + file)
+ })
+
+ cy.login(user1)
+ cy.visit('/apps/files')
+
+ files.forEach((file) => {
+ getRowForFile(file).should('be.visible')
+ })
+ selectAllFiles()
+
+ triggerTagManagementDialogAction()
+
+ cy.findByRole('textbox', { name: 'Search or create tag' }).should('not.exist')
+ cy.findByRole('textbox', { name: 'Search tag' }).should('be.visible')
+
+ cy.get('[data-cy-systemtags-picker-input]').type('testTag')
+
+ cy.get('[data-cy-systemtags-picker-tag]').should('have.length', 1)
+ cy.get('[data-cy-systemtags-picker-button-create]').should('not.exist')
+ cy.get('[data-cy-systemtags-picker-tag-color]').should('not.exist')
+
+ // Assign the tag
+ cy.intercept('PROPFIND', '/remote.php/dav/systemtags/*/files').as('getTagData')
+ cy.intercept('PROPPATCH', '/remote.php/dav/systemtags/*/files').as('assignTagData')
+
+ cy.get(`[data-cy-systemtags-picker-tag="${tagId}"]`).should('be.visible')
+ .findByRole('checkbox').click({ force: true })
+ cy.get('[data-cy-systemtags-picker-button-submit]').click()
+
+ cy.wait('@getTagData')
+ cy.wait('@assignTagData')
+
+ cy.get('[data-cy-systemtags-picker]').should('not.exist')
+
+ // Finally, reset the restriction
+ cy.runOccCommand('config:app:set systemtags restrict_creation_to_admin --value 0')
+ })
+ })
})