From d61d68571d27c62366429d3ce8d007b59e767e51 Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Fri, 1 May 2026 11:56:44 +0300 Subject: [PATCH] test only one add form open at a time assert that opening any add-child or bulk-add form closes any other open add form across the tree. currently fails: each toggle function only checks for an open form on its own li. --- cypress/e2e/adminText.cy.js | 54 +++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/cypress/e2e/adminText.cy.js b/cypress/e2e/adminText.cy.js index 628c3ff..4e0893c 100644 --- a/cypress/e2e/adminText.cy.js +++ b/cypress/e2e/adminText.cy.js @@ -120,6 +120,60 @@ describe('The admin text detail page', () => { cy.get('#text-detail li').should('contain', 'Enter Child') }) + it('opening add-child on another node closes the first one', () => { + cy.get('#text-detail > ul > li') + .first() + .children('button.add-child') + .click() + cy.get('#text-detail > ul > li') + .first() + .children('input.child-title') + .should('be.visible') + + cy.get('#text-detail > ul > li > ul > li') + .first() + .children('button.add-child') + .click() + + cy.get('#text-detail > ul > li') + .first() + .children('input.child-title') + .should('not.exist') + cy.get('#text-detail > ul > li') + .first() + .children('button.save-child') + .should('not.exist') + cy.get('#text-detail > ul > li > ul > li') + .first() + .children('input.child-title') + .should('be.visible') + }) + + it('opening bulk-add closes an open add-child form', () => { + cy.get('#text-detail > ul > li') + .first() + .children('button.add-child') + .click() + cy.get('#text-detail > ul > li') + .first() + .children('input.child-title') + .should('be.visible') + + cy.get('#text-detail > ul > li > ul > li') + .first() + .children('button.bulk-add-children') + .click() + + cy.get('#text-detail > ul > li') + .first() + .children('input.child-title') + .should('not.exist') + cy.get('#text-detail > ul > li > ul > li') + .first() + .children('input.bulk-title') + .should('be.visible') + }) + it('newly added child persists after page reload', () => { cy.intercept('POST', '/api/nodes').as('createNode') cy.intercept('GET', '/api/nodes/0').as('getNodesRefresh')