From dce4e4a4f6de2d31657a831be5f7dbf1c597b965 Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Fri, 1 May 2026 11:44:24 +0300 Subject: [PATCH] test child add keeps parent expanded assert that a non-root parent that the user expanded stays expanded after adding a child. currently fails: fetchAndRenderNodes wipes and rebuilds the tree with depth-based default visibility, so any manually expanded non-root collapses on every save. --- cypress/e2e/adminText.cy.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) 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')