From ff8ec9a2ab7efbc6c23642952c4a374726c5036b Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Fri, 1 May 2026 11:54:53 +0300 Subject: [PATCH] test enter submits bulk add form assert that pressing enter from either the bulk-title or bulk-count input submits the bulk add form. currently fails: only the save-bulk button click triggers the post. --- cypress/e2e/adminTextBulkAdd.cy.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/cypress/e2e/adminTextBulkAdd.cy.js b/cypress/e2e/adminTextBulkAdd.cy.js index 7d1afc2..47d3c7f 100644 --- a/cypress/e2e/adminTextBulkAdd.cy.js +++ b/cypress/e2e/adminTextBulkAdd.cy.js @@ -65,6 +65,30 @@ describe('Bulk add children on the admin text detail page', () => { cy.get('@bulkCreate.all').should('have.length', 0) }) + it('pressing Enter in the bulk-count input submits', () => { + cy.intercept('POST', '/api/nodes/bulk').as('bulkCreate') + cy.intercept('GET', '/api/nodes/0').as('getNodesRefresh') + cy.get('#text-detail > ul > li').first().children('button.bulk-add-children').click() + cy.get('#text-detail > ul > li').first().children('input.bulk-title').type('Enter') + cy.get('#text-detail > ul > li').first().children('input.bulk-count').type('2{enter}') + cy.wait('@bulkCreate').its('response.statusCode').should('eq', 201) + cy.wait('@getNodesRefresh') + cy.get('#text-detail li').should('contain', 'Enter 1') + cy.get('#text-detail li').should('contain', 'Enter 2') + }) + + it('pressing Enter in the bulk-title input submits', () => { + cy.intercept('POST', '/api/nodes/bulk').as('bulkCreate') + cy.intercept('GET', '/api/nodes/0').as('getNodesRefresh') + cy.get('#text-detail > ul > li').first().children('button.bulk-add-children').click() + cy.get('#text-detail > ul > li').first().children('input.bulk-count').type('2') + cy.get('#text-detail > ul > li').first().children('input.bulk-title').type('Title{enter}') + cy.wait('@bulkCreate').its('response.statusCode').should('eq', 201) + cy.wait('@getNodesRefresh') + cy.get('#text-detail li').should('contain', 'Title 1') + cy.get('#text-detail li').should('contain', 'Title 2') + }) + it('bulk added nodes persist after page reload', () => { cy.intercept('POST', '/api/nodes/bulk').as('bulkCreate') cy.intercept('GET', '/api/nodes/0').as('getNodesRefresh')