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.
This commit is contained in:
Yisroel Baum 2026-05-01 11:44:24 +03:00
parent a9a7461aad
commit dce4e4a4f6
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -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')