From cefd176fd972e5e295d6ce32569b552fb7c22d9d Mon Sep 17 00:00:00 2001 From: Florian Steffens Date: Tue, 12 Sep 2023 08:05:15 +0200 Subject: [PATCH] add cypress test for unified search tests - test for views - test for tables - cleanup Signed-off-by: Florian Steffens --- cypress/e2e/tables-unified-search.cy.js | 28 +++++++++++++++++++++++-- cypress/support/commands.js | 9 ++++++-- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/tables-unified-search.cy.js b/cypress/e2e/tables-unified-search.cy.js index c5e32536a..8a17f36e4 100644 --- a/cypress/e2e/tables-unified-search.cy.js +++ b/cypress/e2e/tables-unified-search.cy.js @@ -46,11 +46,35 @@ describe('The Home Page', () => { cy.get('.sharing input').type('{enter}') cy.get('h3').contains('Shares').parent().find('ul').contains(localUser2.userId).should('exist') - }) - it('Search for shared table', () => { cy.login(localUser2) cy.visit('apps/tables') cy.unifiedSearch('Share for user') }) + + it('Search for shared view via user share', () => { + cy.login(localUser) + cy.visit('apps/tables') + + // create table to share + cy.contains('.app-menu-entry--label', 'Tables').click() + cy.createTable('Share for user') + // cy.loadTable('Share for user') + cy.createTextLineColumn('any', true) + cy.createView('ShareView1') + + cy.clickOnTableThreeDotMenu('Share') + + cy.intercept({ method: 'GET', url: '**/ocs/v2.php/apps/files_sharing/api/v1/sharees*' }).as('searchShareUsers') + cy.get('.sharing input').type(localUser2.userId) + cy.wait('@searchShareUsers') + cy.get('.sharing input').type('{enter}') + + cy.get('h3').contains('Shares').parent().find('ul').contains(localUser2.userId).should('exist') + + cy.login(localUser2) + cy.visit('apps/tables') + cy.unifiedSearch('ShareView1') + }) + }) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 56a2f53c0..9dc129d73 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -50,6 +50,11 @@ Cypress.Commands.add('createView', (title) => { cy.contains('.app-navigation-entry-link span', title).should('exist') }) +Cypress.Commands.add('clickOnTableThreeDotMenu', (optionName) => { + cy.get('[data-cy="customTableAction"] button').click() + cy.get('.v-popper__popper li button span').contains(optionName).click({ force: true }) +}) + Cypress.Commands.add('loadTable', (name) => { cy.get('.app-navigation-entry-link').contains(name).click({ force: true }) }) @@ -57,11 +62,11 @@ Cypress.Commands.add('loadTable', (name) => { Cypress.Commands.add('unifiedSearch', (term) => { cy.get('#unified-search').click() - cy.intercept({ method: 'GET', url: '**/ocs/v2.php/search/providers/settings/search*' }).as('searchResults') + cy.intercept({ method: 'GET', url: '**/ocs/v2.php/search/providers/**' }).as('searchResults') cy.get('#unified-search__input').type(term) cy.wait('@searchResults') - cy.get('.unified-search__results').contains(term, { matchCase: false }).should('be.visible') + cy.get('.unified-search__results .unified-search__result-line-one span').contains(term, { matchCase: false }).should('exist') }) Cypress.Commands.add('createTextLinkColumn', (title, ressourceProvider, firstColumn) => {