From 420e47675d3cffb43c6a2d072f3ce163c587471d Mon Sep 17 00:00:00 2001 From: Suzanne Aitchison Date: Mon, 14 Jun 2021 14:23:21 +0100 Subject: [PATCH] [15 min fix] Flakey "change password" spec (#13979) * wait for all sign in network requests to resolve * tweaks * add chat request --- .../loginFlows/userChangePassword.spec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cypress/integration/loginFlows/userChangePassword.spec.js b/cypress/integration/loginFlows/userChangePassword.spec.js index 8075bd7dc..4183ff845 100644 --- a/cypress/integration/loginFlows/userChangePassword.spec.js +++ b/cypress/integration/loginFlows/userChangePassword.spec.js @@ -41,11 +41,26 @@ describe('User Change Password', () => { .type(newPassword); }); + // We intercept these requests to make sure all async sign-in requests have completed before finishing the test. + // This ensures async responses do not intefere with subsequent test setup + cy.intercept('/notifications?i=i').as('notificationsRequest'); + cy.intercept('/notifications/counts').as('countsRequest'); + cy.intercept('/async_info/base_data').as('baseDataRequest'); + cy.intercept('/chat_channels**').as('chatRequest'); + // Submit the form cy.get('@loginForm').findByText('Continue').click(); + cy.wait([ + '@notificationsRequest', + '@countsRequest', + '@baseDataRequest', + '@chatRequest', + ]); + const { baseUrl } = Cypress.config(); cy.url().should('equal', `${baseUrl}settings/account?signin=true`); + cy.findByRole('heading', { name: 'Set new password' }); }); it('should give an error if the new password/confirm new password fields do not match when changing the password of a user', () => {