test child deletion

This commit is contained in:
Yisroel Baum 2026-06-21 22:05:14 +03:00
parent 34b0fd0b44
commit 11a0b1576f
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
3 changed files with 375 additions and 0 deletions

View file

@ -163,6 +163,34 @@ describe('admin element editing', () => {
cy.resetDb()
})
it('removes a child element after confirmation', () => {
cy.resetDb()
loginAsAdmin()
cy.visit('/admin/element/1')
cy.intercept('DELETE', /\/api\/elements\/1\/children\/\d+$/)
.as('deleteChildElement')
cy.window().then((windowObject) => {
cy.stub(windowObject, 'confirm').returns(true)
})
cy.contains('[data-cy="admin-child-item"]', '1. Introduction')
.within(() => {
cy.contains('button', 'Remove').click()
})
cy.wait('@deleteChildElement')
cy.get('[data-cy="admin-child-status"]')
.should('be.visible')
.and('contain.text', 'Child element removed')
cy.contains('[data-cy="admin-child-item"]', '1. Introduction')
.should('not.exist')
cy.contains('header.site-header a', 'View Element').click()
cy.get('[data-cy="child-element-list"]')
.should('not.contain.text', '1. Introduction')
cy.resetDb()
})
it('uploads icon and pdf files immediately through the UI', () => {
cy.resetDb()
loginAsAdmin()