From 74705379cb8f66edcf03f9f2e4bd0db946623659 Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Fri, 1 May 2026 11:53:06 +0300 Subject: [PATCH] test enter submits add child form assert that pressing enter while typing in the add-child input submits the form. currently fails: only the save-child button click triggers the post. --- cypress/e2e/adminText.cy.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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')