From 4f45b8ca6ac6bef550d9cf142f33154b3cd39cfd Mon Sep 17 00:00:00 2001 From: Julius Knorr Date: Mon, 17 Mar 2025 22:03:45 +0100 Subject: [PATCH 1/2] tests(cypress): Wait for input to be focused Signed-off-by: Julius Knorr --- cypress/e2e/Assistant.spec.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/Assistant.spec.js b/cypress/e2e/Assistant.spec.js index e4dab86d966..7da09539c53 100644 --- a/cypress/e2e/Assistant.spec.js +++ b/cypress/e2e/Assistant.spec.js @@ -101,13 +101,18 @@ describe('Assistant', () => { .should('be.visible') .click() + cy.wait(1000) + cy.get('[data-cy="translate-input"]') .should('be.visible') - .click() + .focus() + + cy.wait(1000) + + cy.get('[data-cy="translate-input"]') + .should('be.focused') cy.get('[data-cy="translate-input"]') .should('be.visible') .type('Hello World') - cy.get('[data-cy="translate-input"]') - .should('be.focused') }) }) From 321038558259556740cf1cbe21371d08002eca9e Mon Sep 17 00:00:00 2001 From: Julius Knorr Date: Mon, 17 Mar 2025 22:35:29 +0100 Subject: [PATCH 2/2] tests(cypress): Wait for close before trying to assert that push throws Signed-off-by: Julius Knorr --- cypress/e2e/Assistant.spec.js | 4 +--- cypress/e2e/api/SessionApi.spec.js | 13 ++++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cypress/e2e/Assistant.spec.js b/cypress/e2e/Assistant.spec.js index 7da09539c53..ad53710b2b0 100644 --- a/cypress/e2e/Assistant.spec.js +++ b/cypress/e2e/Assistant.spec.js @@ -101,18 +101,16 @@ describe('Assistant', () => { .should('be.visible') .click() + // eslint-disable-next-line cypress/no-unnecessary-waiting cy.wait(1000) cy.get('[data-cy="translate-input"]') .should('be.visible') .focus() - cy.wait(1000) - cy.get('[data-cy="translate-input"]') .should('be.focused') cy.get('[data-cy="translate-input"]') - .should('be.visible') .type('Hello World') }) }) diff --git a/cypress/e2e/api/SessionApi.spec.js b/cypress/e2e/api/SessionApi.spec.js index bfc3ec3b867..942370f2710 100644 --- a/cypress/e2e/api/SessionApi.spec.js +++ b/cypress/e2e/api/SessionApi.spec.js @@ -279,12 +279,15 @@ describe('The session Api', function() { it('signals closing connection', function() { cy.then(() => { return new Promise((resolve, reject) => { + // Create a promise that resolves when close completes connection.close() - connection.push({ steps: [messages.update], version, awareness: '' }) - .then( - () => reject(new Error('Push should have thrown ConnectionClosed()')), - resolve, - ) + .then(() => { + connection.push({ steps: [messages.update], version, awareness: '' }) + .then( + () => reject(new Error('Push should have thrown ConnectionClosed()')), + resolve, + ) + }) }) }) })