X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/0534b585de71147120e880fe670ebd0e61dcf68f..7b5bf320c400a44d3e8b0cd962256c0ab9d872bf:/cypress/integration/project.spec.js diff --git a/cypress/integration/project.spec.js b/cypress/integration/project.spec.js index bbb3571a..7c3f9f7a 100644 --- a/cypress/integration/project.spec.js +++ b/cypress/integration/project.spec.js @@ -223,6 +223,40 @@ describe('Project tests', function() { }); }); + it('resets the search box only when navigating out of the current project', function() { + const fooProjectNameA = `Test foo project ${Math.floor(Math.random() * 999999)}`; + const fooProjectNameB = `Test foo project ${Math.floor(Math.random() * 999999)}`; + const barProjectNameA = `Test bar project ${Math.floor(Math.random() * 999999)}`; + + [fooProjectNameA, fooProjectNameB, barProjectNameA].forEach(projName => { + cy.createGroup(activeUser.token, { + name: projName, + group_class: 'project', + }); + }); + + cy.loginAs(activeUser); + cy.get('[data-cy=project-panel]') + .should('contain', fooProjectNameA) + .and('contain', fooProjectNameB) + .and('contain', barProjectNameA); + + cy.get('[data-cy=search-input]').type('foo'); + cy.get('[data-cy=project-panel]') + .should('contain', fooProjectNameA) + .and('contain', fooProjectNameB) + .and('not.contain', barProjectNameA); + + // Click on the table row to select it, search should remain the same. + cy.get(`p:contains(${fooProjectNameA})`) + .parent().parent().parent().parent().click(); + cy.get('[data-cy=search-input] input').should('have.value', 'foo'); + + // Click to navigate to the project, search should be reset + cy.get(`p:contains(${fooProjectNameA})`).click(); + cy.get('[data-cy=search-input] input').should('not.have.value', 'foo'); + }); + it('navigates to the root project after trashing the parent of the one being displayed', function() { cy.createGroup(activeUser.token, { name: `Test root project ${Math.floor(Math.random() * 999999)}`,