fix cypress tests to properly select in children

This commit is contained in:
Yisroel Baum 2026-04-18 21:48:41 +03:00
parent bdf386e510
commit b12d0fc7d3
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -31,18 +31,18 @@ describe('The admin text detail page', () => {
}) })
it('clicking "Add child" reveals an inline form', () => { it('clicking "Add child" reveals an inline form', () => {
cy.get('#text-detail li').first().find('button.add-child').click() cy.get('#text-detail li').first().children('button.add-child').click()
cy.get('#text-detail li').first().find('input.child-title').should('be.visible') cy.get('#text-detail li').first().children('input.child-title').should('be.visible')
cy.get('#text-detail li').first().find('button.save-child').should('be.visible') cy.get('#text-detail li').first().children('button.save-child').should('be.visible')
}) })
it('can add a child to the root node', () => { it('can add a child to the root node', () => {
cy.intercept('POST', '/api/nodes').as('createNode') cy.intercept('POST', '/api/nodes').as('createNode')
cy.intercept('GET', '/api/nodes/0').as('getNodesRefresh') cy.intercept('GET', '/api/nodes/0').as('getNodesRefresh')
cy.get('#text-detail > ul > li').first().find('button.add-child').click() cy.get('#text-detail > ul > li').first().children('button.add-child').click()
cy.get('#text-detail > ul > li').first().find('input.child-title').type('New Child Node') cy.get('#text-detail > ul > li').first().children('input.child-title').type('New Child Node')
cy.get('#text-detail > ul > li').first().find('button.save-child').click() cy.get('#text-detail > ul > li').first().children('button.save-child').click()
cy.wait('@createNode').its('response.statusCode').should('eq', 201) cy.wait('@createNode').its('response.statusCode').should('eq', 201)
cy.wait('@getNodesRefresh') cy.wait('@getNodesRefresh')
@ -54,9 +54,9 @@ describe('The admin text detail page', () => {
cy.intercept('POST', '/api/nodes').as('createNode') cy.intercept('POST', '/api/nodes').as('createNode')
cy.intercept('GET', '/api/nodes/0').as('getNodesRefresh') cy.intercept('GET', '/api/nodes/0').as('getNodesRefresh')
cy.get('#text-detail > ul > li > ul > li').first().find('button.add-child').click() cy.get('#text-detail > ul > li > ul > li').first().children('button.add-child').click()
cy.get('#text-detail > ul > li > ul > li').first().find('input.child-title').type('Nested Child Node') cy.get('#text-detail > ul > li > ul > li').first().children('input.child-title').type('Nested Child Node')
cy.get('#text-detail > ul > li > ul > li').first().find('button.save-child').click() 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('@createNode').its('response.statusCode').should('eq', 201)
cy.wait('@getNodesRefresh') cy.wait('@getNodesRefresh')
@ -68,9 +68,9 @@ describe('The admin text detail page', () => {
cy.intercept('POST', '/api/nodes').as('createNode') cy.intercept('POST', '/api/nodes').as('createNode')
cy.intercept('GET', '/api/nodes/0').as('getNodesRefresh') cy.intercept('GET', '/api/nodes/0').as('getNodesRefresh')
cy.get('#text-detail > ul > li').first().find('button.add-child').click() cy.get('#text-detail > ul > li').first().children('button.add-child').click()
cy.get('#text-detail > ul > li').first().find('input.child-title').type('Persistent Child') cy.get('#text-detail > ul > li').first().children('input.child-title').type('Persistent Child')
cy.get('#text-detail > ul > li').first().find('button.save-child').click() cy.get('#text-detail > ul > li').first().children('button.save-child').click()
cy.wait('@createNode') cy.wait('@createNode')
cy.wait('@getNodesRefresh') cy.wait('@getNodesRefresh')