diff --git a/cypress/e2e/adminText.cy.js b/cypress/e2e/adminText.cy.js index a92e595..628c3ff 100644 --- a/cypress/e2e/adminText.cy.js +++ b/cypress/e2e/adminText.cy.js @@ -101,6 +101,25 @@ describe('The admin text detail page', () => { .should('contain', 'Shemos') }) + it('pressing Enter in the add-child input submits', () => { + 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('Enter Child{enter}') + + cy.wait('@createNode').its('response.statusCode').should('eq', 201) + cy.wait('@getNodesRefresh') + + cy.get('#text-detail li').should('contain', 'Enter Child') + }) + it('newly added child persists after page reload', () => { cy.intercept('POST', '/api/nodes').as('createNode') cy.intercept('GET', '/api/nodes/0').as('getNodesRefresh')