Three e2e tests have been updated to fix a possible race condition
causing intermittent e2e test failures.
In each of the updated tests, the test checks the current network.
The check is performed as a two-step process: locate the current
network element, then check the text to ensure it's correct.
This fails when the test driver finds the element before it re-renders.
If the test runs too quickly, it compares the text before the switch
is shown on screen, and the test fails.
Instead the tests use the element locator to describe what they want.
This tells the test driver to keep looking until the conditions are
met, ensuring the test doesn't fail unless the network switch takes
longer than the default timeout (which should not happen).
This is a good example of why we should avoid using assertions on
elements in e2e tests. Express your assertions as locators instead to
make the test more resilient in the case where the test runs before the
next render.
* Add new snap header and footer to snap install
* Add new snap header and footer to snap result and snap update
* Fix loading state
* Fix lint
* Add required scrolling
* Adjust avatar component
* Apply new headers and footers to snaps confirmations
* Rename previous SnapAuthorship component to SnapAuthorshipExpanded
* Fix lint
* Fix font weight
* Fix fencing
* Fix a test
* Fix lint after rebase
* Fix E2E
* Fix locale lint
* Fix another E2E
* Fix test ID
* Address PR comments
* Better scroll button centering
* Address design comments
* Fix unit test
* Fix E2Es
* Update UI (for audit)
Revert yarn.lock change
Update e2e tests with new copy for a button
Make UI changes to custom Snap UI
Update UI on snap installation success page
Fix icon on installation success
Fix snap name font weight in installation page
Add UI changes for Snap installation failed page
Add new copy for snap installation screen
Update e2e tests OK button name
Update OK button names in e2e tests
Return previous functionality of update flow
Add error message handling for update screens
* Fix after rebase
* Fix messages.json update message
* Revert SCSS changes
* Refactor failed and success screen rendering
* Add Snaps privacy warning on snap install
Add snap install warning status to storage
Add storybook
Add test for snap-privacy-warning
Resolve button type issue
Fix popup display logic
Update fixture
Update popup information and read more handling
Replace deprecated button
Update unit test
* Update buttons and add cancel flow
* Refactoring (review 1)
* Add more unit tests
* feature(17901): fix address-book `Sends to an address book entry` e2e against MV3 build
* feature(17901): add balance guide for send-eth e2e as well
---------
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
* feature(17946): implement mv3 e2e for popup consistency after service worker restarts
* feature(17946): fix typo
---------
Co-authored-by: Dan J Miller <danjm.com@gmail.com>
* Rename `provider` to `providerConfig`
The network controller `provider` state has been renamed to
`providerConfig`. This better reflects what this state is, and makes
this controller more closely aligned with the core network controller.
All references to the provider configuration have been updated to
prefer `providerConfig` over `provider`, to make the distinction clear
between a provider and provider config.
Closes#18902
* Add migration
* Bump Circle CI docker image
* Stop removing FF since it doesn't exist
* Use Circle CI browser tools
* Fix config name
* Fix browser tools args
* Fix Chrome version
* Use script for chrome
* Try update
* Try FF without browser-tools2
* Fix FF binary path
* Force enable e2e debug
* Add some logs
* More logs
* Disable XSET check for now
* Delete x-server logic
* remove another usage of the x-server logic
* Test dapp update to v6.0.0 and tweak initial token amounts to adjust to the new contract
* Update gas estimates for new TST contract
---------
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
* Add updated version of the Snaps list UI
Add more changes to match the designs of snaps list
Add next design iteration for snaps list
Update icons, sizes and pointer behaviour
Add redesign for snap settings page
Refactor and improve designs
Fix unit tests and refactor code
Fix e2e test
Fix lint
Update margin values
Add CSS override for connected sites list and update margins
Update paddings as requested
Fix vertical alignment of links
Fix tooltip position on the enable button
Add usage of getSnapName function for displaying snap names
Fix e2e tests and update date format for snap install date
Improve unit test for snap-settings-card
Change installation info logic
Update mocked state for snap
Add tests for ViewSnap component, refactor and update mocked state
Add check for version info
Change Snaps icon in Settings
Refactor Snaps list to use selector
Add handling in case of missing version history
* Fix icon ref
* Remove console logs
* Remove onClick from selector
* Add code fencing for imports in selectors.js
* WIP commit
* Moving copy out of messages.json, styling changes
* handling scroll button click and disable logic
* moving scrollButton up to popover component, adding logic for accepting terms of use in popover and onboarding flows
* adding terms of use to e2e wallet creation/import
* adjusting failing unit test
* fixing QR code e2e
* updating welcome test
* setting app state in fixtures
* Update app/scripts/controllers/app-state.js
removing console log
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
* Update ui/components/app/terms-of-use-popup/terms-of-use-popup.stories.js
adding args to ToU popup storybook
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
* Update ui/components/app/terms-of-use-popup/terms-of-use-popup.js
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
* updating DS components in terms of use
* popover styling changes
* adding metametrics tracking
* editing scrollbutton behavior
* adding unit test
* code fencing
---------
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
The test `should transfer a single ERC721 NFT from one account to another`
has been failing intermittently. It seems to be failing due to a race
condition; the first render shows "Send Token" but later renders show
"Send TDC". The test only passes if it runs fast enough to read the
first render of the list item component.
The test has been updated to look for the text "Send TDC", which is
what the component shows from the second render onward.
* NFTs: Use Unknown Collection instead of first NFT name
* Use localization in hook
* Get localization for previously owned
* Fix tests
---------
Co-authored-by: Dan Miller <danjm.com@gmail.com>
* fix(18194): Redirect to extension expanded view when click back to safety button
* Bump phishing warning version
---------
Co-authored-by: Dan J Miller <danjm.com@gmail.com>
The `network` store of the network controller crams two types of data
into one place. It roughly tracks whether we have enough information to
make requests to the network and whether the network is capable of
receiving requests, but it also stores the ID of the network (as
obtained via `net_version`).
Generally we shouldn't be using the network ID for anything, as it has
been completely replaced by chain ID, which all custom RPC endpoints
have been required to support for over a year now. However, as the
network ID is used in various places within the extension codebase,
removing it entirely would be a non-trivial effort. So, minimally, this
commit splits `network` into two stores: `networkId` and
`networkStatus`. But it also expands the concept of network status.
Previously, the network was in one of two states: "loading" and
"not-loading". But now it can be in one of four states:
- `available`: The network is able to receive and respond to requests.
- `unavailable`: The network is not able to receive and respond to
requests for unknown reasons.
- `blocked`: The network is actively blocking requests based on the
user's geolocation. (This is specific to Infura.)
- `unknown`: We don't know whether the network can receive and respond
to requests, either because we haven't checked or we tried to check
and were unsuccessful.
This commit also changes how the network status is determined —
specifically, how many requests are used to determine that status, when
they occur, and whether they are awaited. Previously, the network
controller would make 2 to 3 requests during the course of running
`lookupNetwork`.
* First, if it was an Infura network, it would make a request for
`eth_blockNumber` to determine whether Infura was blocking requests or
not, then emit an appropriate event. This operation was not awaited.
* Then, regardless of the network, it would fetch the network ID via
`net_version`. This operation was awaited.
* Finally, regardless of the network, it would fetch the latest block
via `eth_getBlockByNumber`, then use the result to determine whether
the network supported EIP-1559. This operation was awaited.
Now:
* One fewer request is made, specifically `eth_blockNumber`, as we don't
need to make an extra request to determine whether Infura is blocking
requests; we can reuse `eth_getBlockByNumber`;
* All requests are awaited, which makes `lookupNetwork` run fully
in-band instead of partially out-of-band; and
* Both requests for `net_version` and `eth_getBlockByNumber` are
performed in parallel to make `lookupNetwork` run slightly faster.
* added the rest of the sev1 warnings to getSnapInstallWarnings
* added and updated translations
* Updated getSnapInstallWarnings to include warnings for all weight-1 permissions
* Updated snap install warning and css according to designs
* fix snaps tests
* fixed alignment/spacing
* updated e2e tests to click through the newly displayed public key access warning
* lint fix
* fixed update snap test
* refactored getSnapInstallWarnings, moved logic to PERMISSION_DESCRIPTIONS
* fix logic to account for objects & arrays
* update function description
* add missing properties to ethereum provider description
* moved id and message to baseDescription to fix error
* add optional chaining to fix undefined error
* more optional chaining
* more optional chaining
* Update UI related to MetaMask Snaps Platform trademark
* Remove redundant UI text according to new designs
* Fix lint errors
* Fix e2e test expectation
* Fix lint in test
* Fix e2e test expectation
* Fix some UI parts
* Update CSS for noSnaps message
* Add next design iteration
* Add minor fix
* Update locale message
* Fix learn more text size
* Refactor usage of design system components
---------
Co-authored-by: Erik Marks <rekmarks@protonmail.com>
* Added fallback copy for when we're not able to retrieve a erc721 or erc1155 name in the setApprovalForAll screen and added unit tests
* Fixing lint
* Review requested changes
* Modify small copy changes in messages.json
* Fixing nft e2e tests
* Fixing nft e2e tests final
* Added snapshots for tests and removed data-testid
* Modify translation messages and e2e tests
* add e2e test for onboarding flow
* Add method to test if we create a new wallet
* fix code
* editng code
* Add test if import wrong SRP
* fix test
* add test where we chack if user select diffrent type of SRP
* update test for checking if user select different SRP
* update code
* add test for if user enter wrong password in confirm password field
* add two test to verify if user is on correct page after import wallet
* update cod
* lint fix
* fix code to test pass
* fix code
* improve code
* change completeCreateNewWalletOnboardingFlow function parameters and update code
* delete unnecessary wait
---------
Co-authored-by: dzfjz <120640011+dzfjz@users.noreply.github.com>
Co-authored-by: dzfjz <dzenana.fejzic-ext@consensys.net>
* Revert "Moved subscribe and filter into network controller (#16693)"
This reverts commit 6f6984fa58. That
commit was an RPC middleware refactor intended to move the subscribe
and filter middleware into the network controller, to simplify the
process of sharing this middleware between clients.
This refactor resulted in `eth_subscribe` notifications being sent on
the wrong connections, causing the UI to break in some cases (the UI
`provider` connection does not support notifications). This happened
because the `setupProviderEngine` function runs per-connection,
whereas the engine setup inside the network controller is global. The
global network client cannot support notifications because it has no
way to route them; they'll need to stay in the per-connection provider
engine.
Closes#17467
* Add e2e test
An e2e test has been added that confirms subscriptions are only
broadcast to the site that registered them. This test fails on
`develop`.
* NFTs: Remove feature flag for release
* Update security tab jest test
* Fix broken test
* Update snapshot
* Update test
* Fix test
* remove nft build
* move tests to main e2e job
* remove nft scripts
* remove test for nft build
---------
Co-authored-by: David Walsh <davidwalsh83@gmail.com>
* adding base what's new for NFT autodetection
* lintfix
* Adding nfts svg image
* adding new notification to fixture builder for e2e
* lint:fix
* Adding new messaging, styling what's new
* styling descriptions, increasing fullscreen height
* applying firstNotification styling to NFT whats new announcement
* adding scrollDown button to whats new popup
* adding Opensea announcement, removing old announcement, moving scrollDown button up to popover component
* verify-locales:fix
* updating icon
* Removed a feature flag
* Add test for transaction security provider
* add rest of the test cases for transaction security provider
* change code
---------
Co-authored-by: Filip Sekulic <filip.sekulic@consensys.net>
* Added test for submitting second swap without waiting for first one to finish
* Added more test code
* Removed look around Review Swap button
* Added test verification for the transaction details
* Changed mocked API for token import
* Added assert error messages
* Fixed lint errors
* Removed empty lines and improved coding consistency
* Removed empty lines
* added long test
* Wait for a maximum of 65 seconds, not a hardcoded length
* Fix lint
---------
Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
The PhishingController has been updated to v2. This release should
dramatically reduce network traffic and double the update speed of the
phishing list.
This was accomplished by combining both of our phishing configurations
into one list (the "stalelist"), then creating a separate list of the
changes just the past few days (the "hotlist"). Now users will download
a smaller list more frequently (every 30 minutes rather than every
hour), whereas the full list is only updated every 4 days.
The combined configuration means that we no longer know which list was
responsible for each block. The phishing warning page has been updated
to dynamically look this information up, to ensure users are still
directed to the correct place to dispute a block. This update to the
phishing warning page also includes the recent redesign.
Use DesktopManager in background script to redirect internal and external connections to the desktop app.
Include DesktopController in the MetaMask controller.
Support desktop keyrings in MetaMask controller via the overrides object.
Create middleware handler to connect to the desktop app while UI code is pending.
Add build system support for desktop specific configuration variables.
* Ensure simulation failure warning is shown on all networks and accounts
* Add e2e test to cover failure warning behaviour on non-eip-1559 network
* Fix new e2e test
* Added translation for eth sign toggle
* Disabled the ability to call eth_sign by default. Added ability within advanced settings to renable support for eth_sign
* Add test case for eth_sign being enabled and disabled
* Modified copy
* Moved rpc method preference to its own object within store
* Complete work on moving rpc method preference into its own object within store
* Fix with prettier
* Fix lint
* Fix a unit test
* Fix test
* Renamed function and object keys to be more intuitive
* Fix e2e test
* Enabled eth_sign through preferences fixture
* Fix lint
* Fix e2e test
Wait for the notification popup to close, leaving 2 window handles the extension and the test dapp
* Fix e2e test
* Fix unit test
Enable eth_sign method
* Lint fix
---------
Co-authored-by: PeterYinusa <peter.yinusa@consensys.net>
Co-authored-by: Dan J Miller <danjm.com@gmail.com>
* add test for deleting added custom network
* update code because of failing on firefox browser
* changing steps for adding custom network
* chage code for custom network
* Recipient name passed to confirm-page-container component should be used if pet name exists for the to address
* Ensure recipient edit/add popup is shown for non-owned accounts
* Ensure contract name is rendered if it exists for recipient address
* Ensure that shortened address is last fallback after account, addressbook, token and ens names
A `debug` flag has been added to our e2e test runner scripts, enabling
e2e debug logs. When this flag is enabled, all driver interactions will
be logged to the console. This is extremely useful when debugging e2e
tests, because it lets you known how far the test had progressed before
failing.
This flag should work with all existing e2e test scripts, including
both `test:e2e:single` and all of the test commands that run entire
test suites.
The README has been updated to reference this flag in the section
regarding how to run a single e2e test. To ensure this wasn't totally
missed for the other scripts, I added a line suggesting that users use
`--help` to see all supported options.