Merge pull request #19234 from overleaf/jpa-ae-fix-typing

[server-ce] work around "clicking" by cy.type() in editor tests

GitOrigin-RevId: ffb3d7d77a98a3f6359414b5e93f9682c56ef2cd
This commit is contained in:
Jakob Ackermann 2024-07-02 10:37:17 +02:00 committed by Copybot
parent 6c2a5a43d7
commit 33b208d4d5

View file

@ -149,8 +149,14 @@ describe('editor', () => {
cy.log('enable visual editor and make changes in main file')
cy.findByText('Visual Editor').click()
cy.contains('Introduction').dblclick()
cy.contains('Introduction').type('{del}{enter}{enter}')
// cy.type() "clicks" in the center of the selected element before typing. This "click" discards the text as selected by the dblclick.
// Go down to the lower level event based typing, the frontend tests in web use similar events.
cy.get('.cm-editor').as('editor')
cy.get('@editor').contains('Introduction').dblclick()
cy.get('@editor').trigger('keydown', { key: 'Delete' })
cy.get('@editor').trigger('keydown', { key: 'Enter' })
cy.get('@editor').trigger('keydown', { key: 'Enter' })
cy.log('recompile to force flush')
cy.findByText('Recompile').click()