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

Signed-off-by: Florian Steffens <florian.steffens@nextcloud.com>
  • Loading branch information
Florian Steffens committed Sep 11, 2023
1 parent 1075a1b commit ec04546
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
25 changes: 25 additions & 0 deletions cypress/e2e/tables-unified-search.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
let localUser

describe('The Home Page', () => {

before(function() {
cy.createRandomUser().then(user => {
localUser = user
})
})

beforeEach(function() {
cy.login(localUser)
cy.visit('apps/tables')
})

it('Create a table and view and search via unified search for it', () => {
cy.loadTable('Tutorial')
cy.createView('asdfghjkl')
cy.unifiedSearch('HJK')
cy.loadTable('Tutorial')
cy.unifiedSearch('asd')
cy.loadTable('Tutorial')
cy.unifiedSearch('Tutorial')
})
})
21 changes: 21 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,31 @@ Cypress.Commands.add('createTable', (title) => {
cy.contains('h1', 'Test text-link').should('be.visible')
})

Cypress.Commands.add('createView', (title) => {
cy.get('[data-cy="customTableAction"] button').click()
cy.get('.v-popper__popper li button span').contains('Create view').click({ force: true })

cy.get('.modal-container #settings-section_title input').type(title)

cy.contains('button', 'Create View').click()

cy.contains('.app-navigation-entry-link span', title).should('exist')
})

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.get('#unified-search__input').type(term)
cy.wait('@searchResults')

cy.get('.unified-search__results').contains(term, { matchCase: false }).should('be.visible')
})

Cypress.Commands.add('createTextLinkColumn', (title, ressourceProvider, firstColumn) => {
if (firstColumn) {
cy.get('.button-vue__text').contains('Create column').click({ force: true })
Expand Down

0 comments on commit ec04546

Please sign in to comment.