seed sibling node in layout test

This commit is contained in:
Yisroel Baum 2026-05-04 09:32:15 +03:00
parent bac29ba737
commit c493bef13d
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -30,12 +30,31 @@ describe('The admin text detail page horizontal layout', () => {
})
it('stacks sibling child nodes vertically within the right column', () => {
cy.intercept('POST', '/api/nodes').as('createNode')
cy.intercept('GET', '/api/nodes/0').as('getNodesRefresh')
cy.get('#text-detail > ul > li')
.first()
.children('button.add-child')
.click()
cy.get('#text-detail > ul > li')
.first()
.children('input.child-title')
.type('Sibling One{enter}')
cy.wait('@createNode')
cy.wait('@getNodesRefresh')
cy.get('#text-detail > ul > li > ul > li').should(
'have.length.greaterThan',
1
)
cy.get('#text-detail > ul > li > ul > li').then(($siblings) => {
expect($siblings.length).to.be.greaterThan(1)
const firstRect = $siblings[0].getBoundingClientRect()
const secondRect = $siblings[1].getBoundingClientRect()
expect(secondRect.top).to.be.greaterThan(firstRect.top)
expect(Math.abs(secondRect.left - firstRect.left)).to.be.lessThan(2)
const lastRect = $siblings[$siblings.length - 1]
.getBoundingClientRect()
expect(lastRect.top).to.be.greaterThan(firstRect.top)
expect(Math.abs(lastRect.left - firstRect.left)).to.be.lessThan(2)
})
})
})