From f50917889c67150214d46fade6af57db18026b3c Mon Sep 17 00:00:00 2001 From: nextcloud-command Date: Sun, 26 Jan 2025 03:17:15 +0000 Subject: [PATCH 1/6] fix(deps): Fix npm audit Signed-off-by: GitHub --- package-lock.json | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 497144d32..0a988dd28 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3058,9 +3058,9 @@ } }, "node_modules/@nextcloud/vue": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/@nextcloud/vue/-/vue-8.21.0.tgz", - "integrity": "sha512-at06uh2JJkn8dV3Yzyoag2z1g6omad8MZ8yKWE+9ZAGP+kaysbnI5q3lB7KXu8SVRtX3Rex8/oal0jgsbb6Spg==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@nextcloud/vue/-/vue-8.22.0.tgz", + "integrity": "sha512-6smeLUVLl8lqh+ia9j+m3nk9fnjra/YNgNO8RI1He8LRuojB9ZQtIy3kGcqIN1BOi6fx9qLiBEkobazWzMmiSw==", "license": "AGPL-3.0-or-later", "dependencies": { "@floating-ui/dom": "^1.1.0", @@ -3098,6 +3098,7 @@ "splitpanes": "^2.4.1", "string-length": "^5.0.1", "striptags": "^3.2.0", + "tabbable": "^6.2.0", "tributejs": "^5.1.3", "unified": "^11.0.1", "unist-builder": "^4.0.0", @@ -3787,9 +3788,9 @@ } }, "node_modules/@tiptap/extension-bubble-menu": { - "version": "2.10.3", - "resolved": "https://registry.npmjs.org/@tiptap/extension-bubble-menu/-/extension-bubble-menu-2.10.3.tgz", - "integrity": "sha512-e9a4yMjQezuKy0rtyyzxbV2IAE1bm1PY3yoZEFrcaY0o47g1CMUn2Hwe+9As2HdntEjQpWR7NO1mZeKxHlBPYA==", + "version": "2.11.3", + "resolved": "https://registry.npmjs.org/@tiptap/extension-bubble-menu/-/extension-bubble-menu-2.11.3.tgz", + "integrity": "sha512-KOAy9zCzqssJO7cGIwZNgv2hFyxrZ2AHoWptICPA79nVZrHQQw2ZP1/FDTR8cDEZzLQMbpgGqQhUhjZcAs3/zQ==", "license": "MIT", "dependencies": { "tippy.js": "^6.3.7" @@ -3885,9 +3886,9 @@ } }, "node_modules/@tiptap/extension-floating-menu": { - "version": "2.10.3", - "resolved": "https://registry.npmjs.org/@tiptap/extension-floating-menu/-/extension-floating-menu-2.10.3.tgz", - "integrity": "sha512-Prg8rYLxeyzHxfzVu1mDkkUWMnD9ZN3y370O/1qy55e+XKVw9jFkTSuz0y0+OhMJG6bulYpDUMtb+N3+2xOWlQ==", + "version": "2.11.3", + "resolved": "https://registry.npmjs.org/@tiptap/extension-floating-menu/-/extension-floating-menu-2.11.3.tgz", + "integrity": "sha512-Za1x475cvv+URegCsoDr8rZI5GIoC4N6rHg/xqmozY4bA326Ko1cMrUbwpVF6p17nerDGAMCIstZM7SSUQdNSA==", "license": "MIT", "dependencies": { "tippy.js": "^6.3.7" @@ -4137,13 +4138,13 @@ } }, "node_modules/@tiptap/vue-2": { - "version": "2.10.3", - "resolved": "https://registry.npmjs.org/@tiptap/vue-2/-/vue-2-2.10.3.tgz", - "integrity": "sha512-LNOSfrp1cOKNZGmzTUCctmUcjSKHnW10jiL82qQOHqecFHLre7Cyn73KKn4cjAg4th51F8LRQ6yNyht4O+geLw==", + "version": "2.11.3", + "resolved": "https://registry.npmjs.org/@tiptap/vue-2/-/vue-2-2.11.3.tgz", + "integrity": "sha512-+zOiClKHdOUzaKDKqVFZuA5Iw+FV2ihbo1z+soWTOOVM+BwZrujE1yZwSklAuTtGkFJ5PY0V5GZmUxflYV/LMg==", "license": "MIT", "dependencies": { - "@tiptap/extension-bubble-menu": "^2.10.3", - "@tiptap/extension-floating-menu": "^2.10.3", + "@tiptap/extension-bubble-menu": "^2.11.3", + "@tiptap/extension-floating-menu": "^2.11.3", "vue-ts-types": "1.6.2" }, "funding": { From d6bf9128d3a477915c526738f1480954585a5d2b Mon Sep 17 00:00:00 2001 From: "Cleopatra Enjeck M." Date: Fri, 31 Jan 2025 06:02:03 +0000 Subject: [PATCH 2/6] enh(Cypress): improve some selectors Signed-off-by: Cleopatra Enjeck M. --- cypress/e2e/column-selection.cy.js | 53 +++++++++------------- cypress/e2e/context.cy.js | 3 +- cypress/e2e/tables-share.cy.js | 28 +++++------- cypress/e2e/tables-table.cy.js | 12 +---- cypress/e2e/view.cy.js | 2 +- cypress/support/commands.js | 20 +++++++- src/modules/main/sections/DataTable.vue | 6 ++- src/modules/modals/CreateTable.vue | 2 +- src/modules/modals/EditRow.vue | 2 +- src/modules/modals/EditTable.vue | 3 +- src/modules/modals/TransferContext.vue | 3 +- src/modules/modals/TransferTable.vue | 3 +- src/modules/sidebar/partials/ShareList.vue | 2 +- 13 files changed, 70 insertions(+), 69 deletions(-) diff --git a/cypress/e2e/column-selection.cy.js b/cypress/e2e/column-selection.cy.js index a8edd1c78..4b4344e2f 100644 --- a/cypress/e2e/column-selection.cy.js +++ b/cypress/e2e/column-selection.cy.js @@ -18,9 +18,6 @@ describe('Test column ' + columnTitle, () => { beforeEach(function() { cy.login(localUser) cy.visit('apps/tables') - }) - - it('Table and column setup', () => { cy.createTable(tableTitle) }) @@ -29,40 +26,34 @@ describe('Test column ' + columnTitle, () => { cy.createSelectionColumn(columnTitle, ['first option', 'second option', '👋 third option', '🤷🏻 fifths'], 'second option', true) // check if default value is set on row creation - cy.get('button').contains('Create row').click() - cy.get('.modal-container__content h2').contains('Create row').should('be.visible') - cy.get('.modal__content .title').contains(columnTitle).should('be.visible') - cy.get('.modal__content .title').click() + cy.get('[data-cy="createRowBtn"]').click() + cy.get('[data-cy="createRowModal"]').should('be.visible') + cy.get('[data-cy="createRowModal"] .title').should('be.visible') + cy.get('[data-cy="createRowModal"] .title').click() cy.get('.vs__dropdown-toggle .vs__selected span[title="second option"]').should('exist') - cy.get('button').contains('Save').click() - cy.get('.custom-table table tr td div').contains('second option').should('be.visible') + cy.get('[data-cy="createRowSaveButton"]').click() + cy.get('[data-cy="ncTable"] tr td div').contains('second option').should('be.visible') // create a row and select non default value cy.get('button').contains('Create row').click() - cy.get('.modal__content .slot input').first().click() + cy.get('[data-cy="createRowModal"] .slot input').first().click() cy.get('ul.vs__dropdown-menu li span[title="👋 third option"]').click() - cy.get('button').contains('Save').click() - cy.get('.custom-table table tr td div').contains('third option').should('be.visible') + cy.get('[data-cy="createRowSaveButton"]').click() + cy.get('[data-cy="ncTable"] tr td div').contains('third option').should('be.visible') - // delete first row - cy.get('.NcTable tr td button').first().click() - cy.get('button').contains('Delete').click() - cy.get('button').contains('I really').click() - cy.get('.custom-table table tr td div').contains('second').should('not.exist') + cy.deleteRow(0) + cy.get('[data-cy="ncTable"] tr td div').contains('second').should('not.exist') // edit second row - cy.get('.NcTable tr td button').first().click() - cy.get('.modal__content .slot input').first().click() + cy.get('[data-cy="ncTable"] [data-cy="editRowBtn"]').first().click() + cy.get('[data-cy="editRowModal"] .slot input').first().click() cy.get('ul.vs__dropdown-menu li span[title="first option"]').click() - cy.get('button').contains('Save').click() - cy.get('.custom-table table tr td div').contains('first option').should('be.visible') + cy.get('[data-cy="editRowSaveButton"]').click() + cy.get('[data-cy="ncTable"] tr td div').contains('first option').should('be.visible') - // delete first row - cy.get('.NcTable tr td button').first().click() - cy.get('button').contains('Delete').click() - cy.get('button').contains('I really').click() + cy.deleteRow(0) - cy.removeColumn(columnTitle) + cy.deleteTable(tableTitle) }) it('Test empty selection', () => { @@ -70,11 +61,11 @@ describe('Test column ' + columnTitle, () => { cy.createSelectionColumn(columnTitle, ['first option', 'second option', '👋 third option', '🤷🏻 fifths'], null, true) // check if default value is set on row creation - cy.get('button').contains('Create row').click() - cy.get('.modal-container__content h2').contains('Create row').should('be.visible') - cy.get('button').contains('Save').click() - cy.get('.custom-table table tr td div').should('exist') - cy.get('.NcTable tr td button').should('exist') + cy.get('[data-cy="createRowBtn"]').click() + cy.get('[data-cy="createRowModal"]').should('be.visible') + cy.get('[data-cy="createRowSaveButton"]').click() + cy.get('[data-cy="ncTable"] tr td div').should('exist') + cy.get('[data-cy="ncTable"] [data-cy="editRowBtn"]').should('exist') }) }) diff --git a/cypress/e2e/context.cy.js b/cypress/e2e/context.cy.js index be2c5e678..c15c1f176 100644 --- a/cypress/e2e/context.cy.js +++ b/cypress/e2e/context.cy.js @@ -114,6 +114,7 @@ describe('Manage a context', () => { // verify that context was deleted from current user cy.get(`[data-cy="navigationContextItem"]:contains("${contextTitle}")`).find('button').click({ force: true }) + cy.wait(1000) cy.get('[data-cy="navigationContextDeleteBtn"]').contains('Delete application').click({ force: true }) cy.get('[data-cy="deleteContextModal"]').should('be.visible') cy.get('[data-cy="deleteContextModal"] button').contains('Delete').click() @@ -199,7 +200,7 @@ describe('Manage a context', () => { cy.get('[data-cy="ncTable"] table').contains('first row').should('exist') cy.get('[data-cy="ncTable"] table').contains('first row').parent().parent().find('[aria-label="Edit row"]').click() cy.get('[data-cy="editRowDeleteButton"]').click() - cy.get('[data-cy="editRowEditConfirmButton"]').click() + cy.get('[data-cy="editRowDeleteConfirmButton"]').click() cy.get('[data-cy="ncTable"] table').contains('first row').should('not.exist') }) }) \ No newline at end of file diff --git a/cypress/e2e/tables-share.cy.js b/cypress/e2e/tables-share.cy.js index 0109d7050..d84f836af 100644 --- a/cypress/e2e/tables-share.cy.js +++ b/cypress/e2e/tables-share.cy.js @@ -4,6 +4,7 @@ */ let localUser let localUser2 +let tableTitle = 'Shared todo' describe('Manage a table', () => { @@ -16,32 +17,25 @@ describe('Manage a table', () => { }) }) - beforeEach(function() { - }) it('Share table', () => { cy.login(localUser) cy.visit('apps/tables') - // create table to share - cy.get('.icon-loading').should('not.exist') cy.get('[data-cy="navigationCreateTableIcon"]').click({ force: true }) cy.get('.tile').contains('ToDo').click({ force: true }) - cy.get('.modal__content input[type="text"]').clear().type('Shared todo') - cy.contains('button', 'Create table').click() - - cy.get('.app-navigation-entry-link').contains('Shared todo').click({ force: true }) - cy.get('.NcTable table tr th').last().find('button').click({ force: true }) - cy.get('.v-popper__popper.v-popper--theme-dropdown.action-item__popper.v-popper__popper--shown').contains('Share').click({ force: true }) - cy.get('.sharing input').type(localUser2.userId) - cy.wait(1000).get('.sharing input').type('{enter}') - - cy.get('h3').contains('Shares').parent().find('ul').contains(localUser2.userId).should('exist') - }) + cy.get('.modal__content input[type="text"]').clear().type(tableTitle) + cy.get('[data-cy="createTableSubmitBtn"]').scrollIntoView().click() + cy.loadTable(tableTitle) + cy.get('[data-cy="customTableAction"] button').click() + cy.get('[data-cy="dataTableShareBtn"]').click() + cy.get('[data-cy="shareFormSelect"] input').type(localUser2.userId) + cy.get(`.vs__dropdown-menu [user="${localUser2.userId}"]`).click() + cy.wait(1000) + cy.get('[data-cy="sharedWithList"]').contains(localUser2.userId).should('exist') - it('Check for shared table', () => { cy.login(localUser2) cy.visit('apps/tables') - cy.get('.app-navigation-entry-link').contains('Shared todo').should('exist') + cy.get('[data-cy="navigationTableItem"]').contains(tableTitle).should('exist') }) }) diff --git a/cypress/e2e/tables-table.cy.js b/cypress/e2e/tables-table.cy.js index 5531932e7..d12d60dfb 100644 --- a/cypress/e2e/tables-table.cy.js +++ b/cypress/e2e/tables-table.cy.js @@ -75,22 +75,14 @@ describe('Manage a table', () => { }) it('Delete', () => { - cy.get('.app-navigation__list').contains('ToDo list').click({ force: true }) - cy.get('[data-cy="customTableAction"] button').click() - cy.get('.action-button__text').contains('Edit table').click() - - cy.get('.modal-container button').contains('Delete').click() - cy.get('.modal-container button').contains('I really want to delete this table!').click() - - cy.wait(10).get('.toastify.toast-success').should('be.visible') - cy.get('.app-navigation__list').contains('to do list').should('not.exist') + cy.deleteTable('ToDo list') }) it('Transfer', () => { cy.get('.icon-loading').should('not.exist') cy.get('[data-cy="navigationCreateTableIcon"]').click({ force: true }) cy.get('.tile').contains('ToDo').click({ force: true }) - cy.get('.modal__content input[type="text"]').clear().type('test table') + cy.get('[data-cy="createTableModal"] input[type="text"]').clear().type('test table') cy.contains('button', 'Create table').click() cy.get('.app-navigation__list').contains('test table').click({ force: true }) diff --git a/cypress/e2e/view.cy.js b/cypress/e2e/view.cy.js index a5ddb2085..3f3b27f05 100644 --- a/cypress/e2e/view.cy.js +++ b/cypress/e2e/view.cy.js @@ -126,7 +126,7 @@ describe('Interact with views', () => { // Delete rows in the view cy.get('[data-cy="customTableRow"]').contains('first row').parent().parent().find('[data-cy="editRowBtn"]').click() cy.get('[data-cy="editRowModal"] [data-cy="editRowDeleteButton"]').contains('Delete').click() - cy.get('[data-cy="editRowModal"] [data-cy="editRowEditConfirmButton"]').contains('I really want to delete this row!').click() + cy.get('[data-cy="editRowModal"] [data-cy="editRowDeleteConfirmButton"]').contains('I really want to delete this row!').click() cy.get('[data-cy="editRowModal"]').should('not.exist') cy.get('[data-cy="customTableRow"]').contains('first row').should('not.exist') diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 6a1ec0a3e..acbd159c6 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -86,6 +86,23 @@ Cypress.Commands.add('createTable', (title) => { cy.contains('h1', title).should('be.visible') }) +Cypress.Commands.add('deleteTable', (title) => { + cy.get('[data-cy="navigationTableItem"]').contains(title).click({ force: true }) + cy.get('[data-cy="customTableAction"] button').click() + cy.get('[data-cy="dataTableEditTableBtn"]').click() + cy.get('[data-cy="editTableModal"] [data-cy="editTableDeleteBtn"]').click() + cy.get('[data-cy="editTableModal"] [data-cy="editTableConfirmDeleteBtn"]').click() + cy.wait(10).get('.toastify.toast-success').should('be.visible') + cy.get('[data-cy="navigationTableItem"]').contains('to do list').should('not.exist') +}) + + +Cypress.Commands.add('deleteRow', (rowIndex) => { + cy.get('[data-cy="ncTable"] [data-cy="editRowBtn"]').eq(rowIndex).click() + cy.get('[data-cy="editRowDeleteButton"]').click({ force: true }) + cy.get('[data-cy="editRowDeleteConfirmButton"]').click({ force: true }) +}) + Cypress.Commands.add('createView', (title) => { cy.get('[data-cy="customTableAction"] button').click() cy.get('[data-cy="dataTableCreateViewBtn"]').contains('Create view').click({ force: true }) @@ -123,6 +140,7 @@ Cypress.Commands.add('createContext', (title) => { Cypress.Commands.add('openContextEditModal', (title) => { cy.get(`[data-cy="navigationContextItem"]:contains("${title}")`).find('button').click({ force: true }) + cy.wait(1000) cy.get('[data-cy="navigationContextEditBtn"]').contains('Edit application').click({ force: true }) cy.get('[data-cy="editContextModal"]').should('be.visible') }) @@ -142,7 +160,7 @@ Cypress.Commands.add('sortTableColumn', (columnTitle, mode = 'ASC') => { }) Cypress.Commands.add('loadTable', (name) => { - cy.get('[data-cy="navigationTableItem"] a[title="' + name + '"]').click({ force: true }) + cy.get('[data-cy="navigationTableItem"] a[title="' + name + '"]').last().click({ force: true }) }) Cypress.Commands.add('loadView', (name) => { diff --git a/src/modules/main/sections/DataTable.vue b/src/modules/main/sections/DataTable.vue index 8828b201c..20b7b8d7c 100644 --- a/src/modules/main/sections/DataTable.vue +++ b/src/modules/main/sections/DataTable.vue @@ -13,7 +13,8 @@ -