Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to fix Cypress flakes #5353

Merged
merged 1 commit into from
Nov 26, 2020
Merged

Attempt to fix Cypress flakes #5353

merged 1 commit into from
Nov 26, 2020

Conversation

monfresh
Copy link
Contributor

@monfresh monfresh commented Nov 25, 2020

For some reason, we are making two requests on the TXO pages: one with
page, per page, and order, and then a second request with the same
params, but this time with sort added to the mix.

Because we were using a glob to match all requests to the TXO
endpoints, calling cy.wait will stop at the first match, and will not
also wait for the second request. I added a second named route to
match the second request, and we are now waiting for that one as well.

Examples of recent failed tests:
https://app.circleci.com/pipelines/github/transcom/mymove/23944/workflows/3f4e6f60-9ae3-4bb4-bf00-521ec34183dc/jobs/370649
https://app.circleci.com/pipelines/github/transcom/mymove/23954/workflows/f872e2a7-6a40-466a-9918-d7003174fb0e/jobs/370793

Resources and other potential things we can try if this doesn't work:
https://www.cypress.io/blog/2020/11/17/when-can-the-test-submit-a-form/
cypress-io/cypress#5743 (comment)
cypress-io/cypress#7306

@robot-mymove
Copy link

robot-mymove commented Nov 25, 2020

Warnings
⚠️ Please add the JIRA issue key to the PR title (e.g. MB-123)

Generated by 🚫 dangerJS against 71a145e

For some reason, we are making two requests on the TXO pages: one with
page, per page, and order, and then a second request with the same
params, but this time with sort added to the mix.

Because we were using a glob to match all requests to the TXO
endpoints, calling cy.wait will stop at the first match, and will not
also wait for the second request. I added a second named route to
match the second request, and we are now waiting for that one as well.
@@ -42,7 +45,7 @@ describe('TIO user', () => {
const paymentRequestId = 'ea945ab7-099a-4819-82de-6968efe131dc';

// TIO Payment Requests queue
cy.wait(['@getGHCClient', '@getPaymentRequests']);
cy.wait(['@getGHCClient', '@getPaymentRequests', '@getSortedPaymentRequests']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding another route works in this case. There's another way to wait for a number of the same requests instead of creating a new route.

cypress-io/cypress#4389

Something like this:

cy.wait(['@getPaymentRequests', '@getPaymentRequests']);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, interesting! I prefer that waitTimes custom command. Maybe we can try that next week.

Copy link
Contributor

@donaldthai donaldthai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@monfresh monfresh merged commit 2e681d5 into master Nov 26, 2020
@monfresh monfresh deleted the mb-cypress-flakes branch November 26, 2020 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants