test child element ordering

This commit is contained in:
Yisroel Baum 2026-06-22 09:42:11 +03:00
parent 14de828b4b
commit 7323925319
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
3 changed files with 505 additions and 0 deletions

View file

@ -191,6 +191,46 @@ describe('admin element editing', () => {
cy.resetDb()
})
it('reorders child elements through admin controls', () => {
cy.resetDb()
loginAsAdmin()
cy.visit('/admin/element/1')
cy.intercept('PUT', /\/api\/elements\/1\/children\/order$/)
.as('reorderChildElements')
cy.contains('[data-cy="admin-child-item"]', '2. Foundations')
.within(() => {
cy.get('[data-cy="admin-move-child-up"]').click()
})
cy.wait('@reorderChildElements')
cy.get('[data-cy="admin-child-status"]')
.should('be.visible')
.and('contain.text', 'Child order saved')
cy.get('[data-cy="admin-child-item"]')
.eq(0)
.should('contain.text', '2. Foundations')
cy.get('[data-cy="admin-child-item"]')
.eq(1)
.should('contain.text', '1. Introduction')
cy.contains('header.site-header a', 'View Element').click()
cy.get('[data-cy="child-element-link"]')
.eq(0)
.should('contain.text', '2. Foundations')
cy.get('[data-cy="child-element-link"]')
.eq(1)
.should('contain.text', '1. Introduction')
cy.visit('/element/3')
cy.get('[data-cy="element-sibling-previous"]')
.should('have.attr', 'href', '/element/7')
cy.get('[data-cy="element-sibling-next"]')
.should('have.attr', 'href', '/element/2')
cy.resetDb()
})
it('uploads icon and pdf files immediately through the UI', () => {
cy.resetDb()
loginAsAdmin()