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

test: spy and wait for slow network requests #1107

Merged
merged 3 commits into from
Nov 10, 2022
Merged

Conversation

DiogoSoaress
Copy link
Member

What it solves

Broken create_tx E2E test in the CI

How this PR fixes it

Spy and wait for the /estimations network request
Stub the second /estimations request
Spy and wait for the /propose network request

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 8, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: b55f85f
Status: ✅  Deploy successful!
Preview URL: https://8f823531.web-core.pages.dev
Branch Preview URL: https://e2e-stub-estimation.web-core.pages.dev

View logs

@github-actions
Copy link

github-actions bot commented Nov 8, 2022

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

// Alias for New transaction modal
cy.contains('h2', 'Review transaction').parents('div').as('modal')

// Wait for /estimations response
cy.wait('@estimations')
Copy link
Member Author

Choose a reason for hiding this comment

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

Instead of waiting for the real request, I've also considered stubbing the first request by using Date.now() for the recommended nonce. This way we wouldn't have to hit the server with any /estimations request at all and we'd guarantee the nonce is never repeated.

It would make the test more robust but it felt like an overkill. WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

IMHO e2e tests should not stub anything.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've changed it. Only spy on the request now

@DiogoSoaress DiogoSoaress changed the title test: wait and stub slow network requests test: spy and wait for slow network requests Nov 9, 2022
@DiogoSoaress DiogoSoaress merged commit 83f6b9b into dev Nov 10, 2022
@DiogoSoaress DiogoSoaress deleted the e2e-stub-estimation branch November 10, 2022 07:52
@gitpoap-bot
Copy link

gitpoap-bot bot commented Nov 10, 2022

Congrats, your important contribution to this open-source project has earned you a GitPOAP!

GitPOAP: 2022 Safe Web Core Contributor:

GitPOAP: 2022 Safe Web Core Contributor GitPOAP Badge

Head to gitpoap.io & connect your GitHub account to mint!

Learn more about GitPOAPs here.

@usame-algan usame-algan mentioned this pull request Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants