diff --git a/cypress/e2e/adminTextLayout.cy.js b/cypress/e2e/adminTextLayout.cy.js index f13b97c..a5e75cc 100644 --- a/cypress/e2e/adminTextLayout.cy.js +++ b/cypress/e2e/adminTextLayout.cy.js @@ -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) }) }) })