diff --git a/cypress/e2e/adminText.cy.js b/cypress/e2e/adminText.cy.js index f5cad89..a92e595 100644 --- a/cypress/e2e/adminText.cy.js +++ b/cypress/e2e/adminText.cy.js @@ -65,6 +65,42 @@ describe('The admin text detail page', () => { cy.get('#text-detail li').should('contain', 'Nested Child Node') }) + it('keeps a parent expanded after adding a child to it', () => { + cy.intercept('POST', '/api/nodes').as('createNode') + cy.intercept('GET', '/api/nodes/0').as('getNodesRefresh') + + cy.get('#text-detail > ul > li > ul > li') + .first() + .find('button.toggle-children') + .click() + cy.get('#text-detail > ul > li > ul > li > ul') + .first() + .should('be.visible') + + cy.get('#text-detail > ul > li > ul > li') + .first() + .children('button.add-child') + .click() + cy.get('#text-detail > ul > li > ul > li') + .first() + .children('input.child-title') + .type('Shemos') + cy.get('#text-detail > ul > li > ul > li') + .first() + .children('button.save-child') + .click() + + cy.wait('@createNode').its('response.statusCode').should('eq', 201) + cy.wait('@getNodesRefresh') + + cy.get('#text-detail > ul > li > ul > li > ul') + .first() + .should('be.visible') + cy.get('#text-detail > ul > li > ul > li > ul') + .first() + .should('contain', 'Shemos') + }) + it('newly added child persists after page reload', () => { cy.intercept('POST', '/api/nodes').as('createNode') cy.intercept('GET', '/api/nodes/0').as('getNodesRefresh')