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

Prevent infura requests in e2e tests #6364

Merged
merged 10 commits into from
Mar 29, 2019

Conversation

danjm
Copy link
Contributor

@danjm danjm commented Mar 28, 2019

This PR ensures that we do not make any requests to infura in our current e2e tests. It makes two notable changes to achieve this:

  • first, it sets the default network to localhost, so that the entire e2e test runs on that local network and not any infura network
  • second, it uses the webRequest API to cancel any network requests to infura.io domains

An implication of this second item is that we cannot fully test the method name feature. An e2e test has had to be changed accordingly. A future improvement would be to add a local server to which we can redirect these requests.

One foundational change that this PR makes: a new script for creating a build specifically for e2e tests is added. This allows us to create a build where webRequestBlocking is added to the permissions, without affecting prod. It also allows us to inject an env variable for identifying the environment as in test.

What is missing is an addition of these scripts to the circleci run. @whymarrh I could use your help there.

@danjm danjm added the DO-NOT-MERGE Pull requests that should not be merged label Mar 28, 2019
@whymarrh whymarrh force-pushed the prevent-infura-requests-e2e-tests branch from 5c6a69a to b4cda20 Compare March 28, 2019 18:50
@whymarrh whymarrh force-pushed the prevent-infura-requests-e2e-tests branch 3 times, most recently from 5b72cba to 3275e77 Compare March 29, 2019 00:12
@danjm danjm force-pushed the prevent-infura-requests-e2e-tests branch from 4341917 to 70a03bd Compare March 29, 2019 04:10
@metamaskbot
Copy link
Collaborator

Builds ready [7a31b03]: chrome, firefox, edge, opera

@whymarrh whymarrh force-pushed the prevent-infura-requests-e2e-tests branch from 7a31b03 to 3113114 Compare March 29, 2019 13:45
@whymarrh whymarrh removed the DO-NOT-MERGE Pull requests that should not be merged label Mar 29, 2019
@metamaskbot
Copy link
Collaborator

Builds ready [3113114]: chrome, firefox, edge, opera

Copy link
Contributor

@whymarrh whymarrh left a comment

Choose a reason for hiding this comment

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

LGTM, though I'm sure we'll have to revisit these e2e tests again in the future

@whymarrh whymarrh merged commit 125a95b into develop Mar 29, 2019
danjm added a commit that referenced this pull request Mar 29, 2019
* getMethodData() default to abi decoded method if registry lookup errors

* Update e2e tests to work with getMethodData() fallback changes

* Remove indeterminency in gas input key entering in send token e2e test.
@whymarrh whymarrh deleted the prevent-infura-requests-e2e-tests branch April 2, 2019 15:18
vittominacori added a commit to vittominacori/metamask-extension that referenced this pull request Apr 3, 2019
* 'master' of https://github.com/MetaMask/metamask-extension: (84 commits)
  Version 6.3.1
  Check token name constants against the lower case methodData name in conf tx switch container.
  Ensure correct confirm screen in case of smartcontract check fail
  About tab copy changes; Update route for Info & Help in account menu (MetaMask#6356)
  Revert to providing inline defaults in getHexGasTotal and increaseLastGasPrice (MetaMask#6361)
  Further e2e fixes in wake of MetaMask#6364 and MetaMask#6367 (MetaMask#6374)
  Split e2e run-all commands onto multiple lines
  Run from-import e2e tests with additional account, to avoid conflict with accounts in earlier test runs
  Use localhost instead of mainnent/infura for custom rpc tests in e2e tests.
  ci: Add build:test Gulp task for e2e build
  e2e: Update Contract Interaction wording
  e2e: Skip approving token test
  send-footer.utils.js - addressIsNew - improve readability
  test - unit - ui - actions - setCompletedOnboarding - fix stub to call callback
  lint fix
  actions - setCompletedOnboarding - make async with pify
  notice-controller - make markAllNoticesRead sync
  lib - nodeify - correctly wrap synchronous functions
  notices - markAllNoticesRead - use async/await
  buy-eth-url - lint fix
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants