diff --git a/cypress/e2e/tables-unified-search.cy.js b/cypress/e2e/tables-unified-search.cy.js new file mode 100644 index 000000000..e2fcd9d73 --- /dev/null +++ b/cypress/e2e/tables-unified-search.cy.js @@ -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') + }) +}) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 803bb1581..51f84247a 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -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 })