Skip to content

Commit

Permalink
add cypress test for unified search tests
Browse files Browse the repository at this point in the history
- test for views
- test for tables
- cleanup

Signed-off-by: Florian Steffens <florian.steffens@nextcloud.com>
  • Loading branch information
Florian Steffens committed Sep 12, 2023
1 parent ba5ba99 commit cefd176
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
28 changes: 26 additions & 2 deletions cypress/e2e/tables-unified-search.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})

})
9 changes: 7 additions & 2 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,23 @@ 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 })
})

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) => {
Expand Down

0 comments on commit cefd176

Please sign in to comment.