1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
Commit Graph

509 Commits

Author SHA1 Message Date
ryanml
9e918b6026
Adding recovery phrase video to onboarding process (#10717)
* Adding recovery phrase video to onboarding process

Adding english subtitles

* Support textAlign in Box, converting sidebar to Box
2021-04-13 15:29:44 -07:00
Brad Decker
57be0e49d1
use waitForSelector instead of until (#10852)
* complete abstraction of until method

* response to feedback
2021-04-13 16:36:02 -05:00
Brad Decker
2f4e377cf5
add key literals to driver (#10854) 2021-04-12 10:32:38 -05:00
Niranjana Binoy
8df7a712f3
Refactoring threebox.spec.js to use fixtures (#10849) 2021-04-08 19:53:18 -04:00
Brad Decker
9079fb87ec
add abstraction for waitForSelector (#10844) 2021-04-08 10:41:23 -05:00
Brad Decker
cd97340bb8
use locator abstraction in tests folder (#10833) 2021-04-07 09:57:40 -05:00
Niranjana Binoy
d1d7622c93
Refactoring signature-request.spec.js to use fixtures (#10820) 2021-04-07 10:18:20 -04:00
Niranjana Binoy
501829e5ca
Refactoring permissions.spec.js to use fixtures (#10829) 2021-04-06 17:11:22 -04:00
Niranjana Binoy
dc1a036786
Removing unnecessary params from withFixtures function call. (#10831) 2021-04-06 13:39:28 -04:00
Niranjana Binoy
966b2dcb43
Refactoring send-edit.spec.js to use fixtures (#10792) 2021-04-04 15:06:26 -04:00
Niranjana Binoy
044949f8e1
Refactoring address-book.spec.js to use fixtures (#10804) 2021-04-02 22:40:53 -04:00
Brad Decker
097439eda3
Add support for locators into driver abstraction (#10802) 2021-04-02 14:45:11 -05:00
Niranjana Binoy
e63fcf1e30
Refactoring ethereum-on.spec.js to use fixtures (#10778) 2021-03-31 13:06:44 -04:00
Erik Marks
76a2a9bb8b
@metamask/eslint config@5.0.0 (#10358)
* @metamask/eslint-config@5.0.0
* Update eslintrc and prettierrc
* yarn lint:fix
2021-02-04 10:15:23 -08:00
Mark Stacey
f381f41cb2
Fix network dropdown button (#10312)
This fixes a bug where the network menu would remain present after a
second click on the network menu button. The bug was caused by the
click being handled _twice_, by two separate handlers. First it was
caught by the external click handler of the dropdown menu, which closed
the menu. Second, it was caught by the network button itself, which re-
opened the menu. This all happens quickly enough that to the user it
appears to stay open.

The external click handler of the menu now only fires if the menu is
open. Additionally, any click that is caught by the network menu is
stopped from propagating further, so that it can't trigger additional
click handlers.
2021-01-30 12:12:55 -03:30
Brad Decker
3806e0a2a6
Refactor NetworkDisplay, ConnectedStatusIndicator, etc to use ColorIndicator (#10214) 2021-01-27 10:51:59 -06:00
Alex Donesky
569672027c
Allow editing transaction amount after clicking max (#10278) 2021-01-27 13:13:28 -03:30
Mark Stacey
d8ec5f19f6
Use .zip for Firefox e2e tests (#10056)
The Firefox e2e tests now use the `.zip` file for testing the
extension. We've found this to produce more similar results to
production, compared to the old method of loading the unzipped
directory.

Passing in a `.zip` file to the Chrome driver didn't seem to work. I
didn't investigate this further to see if it was possible, but I'm not
sure it makes a difference on Chrome anyway.
2020-12-11 12:54:17 -03:30
Mark Stacey
b7033196d2
Add timeout to wait-until-called (#9996)
The `waitUntilCalled` utility now has a timeout. It will now throw an
error if the stub is not called enough times, rather than blocking
forever.

The return type had to be changed to a function, so that we could throw
when the timeout is triggered. I tried returning an error that rejected
first, but if you don't handle the error synchronously Node.js will
consider it to be an unhandled Promise rejected (even if it _is_
handled later on).

I worked around this by resolving in the timeout case as well, so that
there is never a "deferred" Promise exception in the timeout case. The
returned function re-throws the error if it's given. That way there is
never any unhandled Promise rejection.
2020-12-04 13:47:57 -03:30
Mark Stacey
b1b6d7ae38
Fix intermittent metrics e2e test failure (#9980)
The metrics e2e test would fail if the segment events still weren't
dispatched when the page loaded. The Segment events are sent on a set
interval, so it isn't abnormal for them to lag behind the page load
itself. The `waitUntilCalled` utility has been used to wait until all
required events have been dispatched.

The `wait-until-called` module was converted to an ES5 module, so that
it could be used from an e2e test. The optional `callCount` parameter
has also been added, to allow waiting for more than one call.

The `segmentSpy` had to be converted to a `segmentStub`, to allow the
`waitUntilCalled` utility to be used.
2020-12-03 14:30:50 -03:30
Mark Stacey
7a2b3b908a
Move initial e2e navitation into individual tests (#9979)
The e2e test driver used to perform the initial navigation
automatically within the `buildWebDriver` function, so that that step
wouldn't need to be repeated at the beginning of each test. However
this prevented you from doing any setup in the test before the first
navigation.

The navigation has now been moved into each individual test. It should
be functionally equivalent, except now it's possible to control exactly
when the first navigation occurs.

A 1 second delay was also removed, as it didn't seem to be necessary
when testing this. It was initially added as an attempted fix to an
intermittent failure. It did not fix that failure.
2020-12-03 14:00:51 -03:30
Dan J Miller
97d268c8ee
Remove use of ethgasstation; use metaswap /gasPrices api for gas price estimates (#9867)
* Remove use of ethgassthat; use metaswap /gasPrices api for gas price estimates

* Remove references to ethgasstation

* Pass base to BigNumber constructor in fetchExternalBasicGasEstimates

* Update ui/app/hooks/useTokenTracker.js

Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>

* Delete gas price chart

* Remove price chart css import

* Delete additional fee chart code

* Lint fix

* Delete more code no longer used after ethgasstation removal

Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
2020-12-02 19:55:19 -03:30
Mark Stacey
ba98edf604
Remove unnecessary assertion in e2e metrics test (#9974)
The assertion ensuring that there were at least 3 metrics received
didn't end up being useful. If this assertion fails, it doesn't explain
what segment events _were_ received.

By removing this assertion and letting the later assertions catch this
case, we at least learn which of the three expected events were
present.
2020-12-02 17:27:42 -03:30
Mark Stacey
cc1161a52a
Add metrics e2e test (#9784)
An e2e test has been added that uses the new mock Segment server to
verify that the three initial page metric events are sent correctly.

Using the mock Segment server requires a special build with this mock
Segment server hostname embedded, so a distinct job for building and
running this test was required. As such, it was left out of the
`run-all.sh` script.
2020-12-01 17:54:56 -03:30
Mark Stacey
14d85b1332
Make JSDoc formatting more consistent (#9796)
A few inconsistencies in JSDoc formatting have been fixed throughout
the project. Many issues remain; these were just the few things that
were easy to fix with a regular expression.

The changes include:

* Using lower-case for primitive types, but capitalizing non-primitive
 types
* Separating the parameter identifier and the description with a dash
* Omitting a dash between the return type and the return description
* Ensuring the parameter type is first and the identifier is second (in
 a few places it was backwards)
* Using square brackets to denote when a parameter is optional, rather
 than putting "(optional)" in the parameter description
* Including a type and identifier with every parameter
* Fixing inconsistent spacing, except where it's used for alignment
* Remove incorrectly formatted `@deprecated` tags that reference non-
 existent properties
* Remove lone comment block without accompanying function

Additionally, one parameter was renamed for clarity.
2020-11-10 14:00:41 -03:30
David Walsh
cfbcc12398
Make all UI tabs accessible via keyboard (#9518) 2020-11-05 12:05:41 -06:00
Erik Marks
dce699de9e Use signTypedDataV4 instead of signTypedData in e2e tests 2020-11-03 21:51:59 -08:00
Brad Decker
2ebf8756a4
[RFC] add prettier to eslint (#8595) 2020-11-02 17:41:28 -06:00
Erik Marks
d843bed4e3
Robustify waiting logic in e2e test (#9704)
* Robustify waiting for popup to open

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-10-23 16:24:20 -07:00
Mark Stacey
1ad87d36c3
Improve stability of contract deposit e2e test (#9685)
The e2e test for the contract deposit action was unnecessarily reliant
upon timing. After initiating a deposit, it would grab the first
transaction in the transaction list and assume it was the deposit that
it had just initiated. If it looked prior to the unapproved transaction
being added to the list, it would grab the wrong transaction.

It now looks specifically for _unconfirmed_ transactions, meaning it
will block until the deposit transaction is rendered.

This was discovered in testing a test-dapp PR:
https://github.com/MetaMask/test-dapp/pull/76
2020-10-22 19:07:12 -02:30
Whymarrh Whitby
362e717eef
Fix node/no-deprecated-api issues (#9670)
Refs #9663

See [`node/no-deprecated-api`][1] for more information.

This change enables `node/no-deprecated-api` and fixes the issues raised by the rule.

  [1]:https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-deprecated-api.md

The change to the way that `punycode` is imported is to address the fact that
third-party module is hidden by the built-in. This is a silly hack but it works.
2020-10-22 11:33:45 -02:30
Whymarrh Whitby
b369a68eb3
Fix node/no-callback-literal issues (#9668)
Refs #9663

See [`node/no-callback-literal`][1] for more information.

This change enables `node/no-callback-literal` and fixes the issues raised by the rule.

  [1]:https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-callback-literal.md
2020-10-21 15:54:51 -02:30
Mark Stacey
7d0a7ab301
Update @metamask/eslint-config to v4.1.0 (#9663)
`@metamask/eslint-config` has been updated to v4.1.0. This update
requires that we update `eslint` to v7 as well, which in turn requires
updating most `eslint`-related packages.

Most notably, `babel-eslint` was replaced with `@babel/eslint-parser`,
and `babel-eslint-plugin` was replaced by `@babel/eslint-plugin`. This
required renaming all the `babel/*` rules to `@babel/*`.

Most new or updated rules that resulted in lint errors have been
temporarily disabled. They will be fixed and re-enabled in subsequent
PRs.
2020-10-21 14:01:03 -02:30
Erik Marks
5b8c07817a
Remove localhost provider type (#9551)
* Delete localhost provider type

* Use ganache-cli default chain ID for tests

* Delete unused test firstTimeState variable

* Migrate default ganache-cli network to frequentRpcListDetail

* Add default test provider state

* Add test functionality to createJsonRpcClient

* Lint locales

* Update test middleware creation

* fixup! Update test middleware creation
2020-10-12 12:05:40 -07:00
Dan J Miller
98f049f8cb
Only shows the swaps intro popup on mainnet (#9534)
* Only shows the swaps intro popup on mainnet

* Remove code that closes swaps popup from e2e tests

* correct casing on isMainnet prop in home component
2020-10-09 13:07:11 -02:30
Erik Marks
bf1bb6ca7e
Check specified chain ID against endpoint return value (#9491)
Adds additional validation to chainId values in the network form, by comparing the specified value against the value returned by the endpoint.
2020-10-07 11:58:22 -02:30
Dan J Miller
30d13422b5
Add MetaMask Swaps (#9482) 2020-10-06 15:58:38 -02:30
Erik Marks
088d4c34f1
Merge pull request from GHSA-c2xw-px2x-pr65
* Remove network config store
* Remove inline networks variable in network controller
* Re-key network controller 'rpcTarget' to 'rpcUrl'
* Require chainId in lookupNetwork, implement eth_chainId
* Require chain ID in network form
* Add alert, migrations, and tests
* Add chainId validation to addToFrequentRpcList
* Update public config state selector to match new network controller
state
* Use network enums in networks-tab.constants
* Ensure chainId in provider config is current
* Update tests
2020-10-06 15:27:02 -02:30
Patryk Łucka
f6d0deb80b
Fix 3Box sync and e2e tests (#9422)
Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>
2020-09-29 14:17:55 -02:30
Brad Decker
c97493cc13
rename Ethereum Main Network -> Etherum Mainnet (#9411) 2020-09-15 14:34:16 -05:00
Mark Stacey
ce66ddcf0d
Use prettier for JSON linting (#9396)
Instead of using `eslint-plugin-json` for linting JSON files,
`prettier` is now used. `prettier` is capable of detecting and
correcting more problems than `eslint-plugin-json` can, such as
indentation.

All JSON files have been run through `prettier`. The changes are all
superficial.
2020-09-11 10:57:39 -03:00
ricky
f281df3b36
Feature/hide seedphrase when restoring vault (#9329)
* hide seedphrase (by default) with option to show it
2020-09-02 11:45:09 -04:00
Erik Marks
e08a55c8bc
Add messages for MetaMetrics opt-in (#9283)
* Add messages for MetaMetrics opt-in
2020-08-20 17:13:14 -07:00
Whymarrh Whitby
b6ccd22d6c
Update ESLint shared config to v3 (#9274)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-08-19 13:57:05 -02:30
Whymarrh Whitby
6ab12001e3
Fix prefer-destructuring issues (#9263)
See [`prefer-destructuring`](https://eslint.org/docs/rules/prefer-destructuring) for more information.

This change enables `prefer-destructuring` and fixes the issues raised by the rule.
2020-08-18 17:36:58 -02:30
Whymarrh Whitby
c1e3c229bc
Fix import/order issues (#9239)
See [`import/order`](https://eslint.org/docs/rules/import/order) for more information.

This change enables `import/order` and fixes the issues raised by the rule.
2020-08-18 16:48:25 -02:30
Whymarrh Whitby
4357cda7b8
Fix no-shadow issues (#9246)
See [`no-shadow`](https://eslint.org/docs/rules/no-shadow) for more information.

This change enables `no-shadow` and fixes the issues raised by the rule.
2020-08-18 14:06:45 -02:30
Whymarrh Whitby
e803807dd9
Fix no-param-reassign issues (#9235)
See [`no-param-reassign`](https://eslint.org/docs/rules/no-param-reassign) for more information.

This change enables `no-param-reassign` and fixes the issues raised by the rule.
2020-08-15 09:28:11 -02:30
Whymarrh Whitby
9e7841fa91
Consolidate ESLint config files (#9231) 2020-08-14 13:41:25 -02:30
Whymarrh Whitby
5d42a9b773
Fix require-unicode-regexp issues (#9212)
* Fix require-unicode-regexp issues

See [`require-unicode-regexp`](https://eslint.org/docs/rules/require-unicode-regexp) for more information.

This change enables `require-unicode-regexp` and fixes the issues raised by the rule.

* Remove case-insensitive flag from regexps
2020-08-14 09:18:42 -02:30
Whymarrh Whitby
954df6e482
Fix no-constant-condition issues (#9210)
See [`no-constant-condition`](https://eslint.org/docs/rules/no-constant-condition) for more information.

This change enables `no-constant-condition` and fixes the issues raised by the rule.
2020-08-12 22:09:17 -02:30
Whymarrh Whitby
a8863a3446
Fix consistent-return issues (#9192)
See [`consistent-return`](https://eslint.org/docs/rules/consistent-return) for more information.

This change enables `consistent-return` and fixes the issues raised by the rule.
2020-08-12 16:36:57 -02:30
Brad Decker
01f69d7e7a
colocate account modal styles with their components (#9150)
This one gets a bit more complicated because the styles were interwoven and needed to be untangled to be moved. Essentially, though, the goal is to put the styles where they make the most sense and colocate them with their components.
2020-08-11 11:07:47 -05:00
Erik Marks
4922b1b9b5
Check if getCleanAppState is defined before calling (#9170) 2020-08-10 08:58:17 -07:00
Erik Marks
5527a6d9e9
Remove web3 e2e tests (#9159) 2020-08-07 12:29:50 -07:00
Brad Decker
f3ba18d79f
remove unused section scss (#9146) 2020-08-07 10:58:48 -05:00
Whymarrh Whitby
b7a4d35318
Retry e2e tests 3 times (#9070) 2020-07-23 20:01:42 -02:30
Brad Decker
21292a8ed1
update eth-token-tracker (#9056) 2020-07-22 15:31:22 -05:00
Whymarrh Whitby
231867df39
Handle failure to build webDriver instance (#9052) 2020-07-22 15:55:04 -02:30
Whymarrh Whitby
5899937165
Await the completion of setupFetchMocking for e2e tests (#9047) 2020-07-22 10:22:50 -02:30
Brad Decker
e463a47588
do not show amounts for approvals (#9032) 2020-07-21 10:45:14 -05:00
Whymarrh Whitby
2ae4720443
Fix words (#9038) 2020-07-20 14:32:49 -02:30
Whymarrh Whitby
68a64af5b3
Fix callback-return issues (#8996)
See [`callback-return`](https://eslint.org/docs/rules/callback-return) for more information.

This change enables `callback-return` and fixes the resulting issues.
2020-07-17 20:19:52 -02:30
Whymarrh Whitby
4f0a205369
Use eslint@6.8.0 (#8978)
* Use eslint@6.8.0
* yarn lint:fix
2020-07-14 12:50:41 -02:30
Mark Stacey
d53c4f824e
Add personal_sign e2e test (#8958)
This tests the `personal_sign` method using the test dapp. This test
reflects part of the `confirm-sig-requests` integration test, which
tests the confirmation of a `personal_sign` signature request.

A `data-testid` prop was added to the 'Sign' button on the signature
request confirmation page, to make it easier to select the 'Sign'
button reliably.
2020-07-10 11:35:52 -03:00
Mark Stacey
111bef2baa
Update @metamask/test-dapp to v3.1.0 (#8963)
This updated test dapp has a new `personal_sign` button. It also fixes
the `Encrypt` button, which was broken in `v3.0.0`.

The `signature-request` e2e test needed to be updated to find the
'Sign' button by id rather than by text, since there are now two
buttons with the text 'Sign'.
2020-07-10 10:43:18 -03:00
Mark Stacey
7ec0cd0f46
Add test-dapp to withFixtures environment (#8957)
The `withFixtures` helper function now has the option of starting the
test dapp as well. It will wait to ensure it has started up correctly,
and it'll shut it down when the test ends.
2020-07-10 00:57:54 -03:00
Mark Stacey
54365a2e2f
Add localization e2e test (#8952)
This test mirrors the `localization` integration test. It only tests
the display of fiat currency on the home page, and it only tests one
currency (`php`).
2020-07-09 18:54:26 -03:00
Mark Stacey
b485a9afb3
Add data-testid to the EthOverview balances (#8951)
Both the primary and secondary balance components on `EthOverview` now
have `data-testid` props, so that they can be more easily referenced in
e2e tests.

This required the addition of a `data-testid` prop to the component
`UserPreferencedCurrencyDisplay`, which is passed through to the
underlying `CurrencyDisplay` component.
2020-07-09 17:33:37 -03:00
Mark Stacey
ada59e2614
Update simple send test description (#8953)
The description 'Simple send' seemed more appropriate than 'MetaMask
Browser Extension'.
2020-07-09 17:27:37 -03:00
Mark Stacey
478ed72a21
Add verbose reporting on failure to withFixtures (#8949)
The e2e test helper function `withFixtures` now includes verbose
reporting on failure. Whenever a test fails, debugging information will
be saved to disk, just as with the other e2e test modules.
2020-07-09 12:42:56 -03:00
Mark Stacey
85f884c641
Check browser logs in withFixtures e2e test helper (#8947)
e2e test that use the `withFixtures` helper now check for console
errors after each successful test. If any errors are found, the test
fails.

It's currently enabled for Chrome only, because the Firefox driver
throws an error when you attempt to get the browser logs. Not sure why
exactly, but it's a long-standing problem.
2020-07-09 12:01:39 -03:00
Mark Stacey
0e51fb233c
Refactor webdriver method verboseReportOnFailure (#8948)
The webdriver method `verboseReportOnFailure` had previously taken a
single parameter, `test`, which was an object representing the current
Mocha test. However, only one property was used (`title`).

Instead the `title` is now passed through directly. This was done to
make this function easier to use outside of a Mocha context.
2020-07-09 12:01:14 -03:00
Whymarrh Whitby
80132f5580
Add envar for ETH Gas Station API key (#8870) 2020-06-29 14:56:21 -02:30
Mark Stacey
dafc5046ff
Hide 'Expand view' button in fullscreen (#8826)
The 'Expand view' button in the 'Account Options' menu was still being
shown on the fullscreen UI. This button is not useful in fullscreen, as
all it does is open the fullscreen UI. It is now hidden on the
fullscreen UI.
2020-06-17 00:40:56 -03:00
Brad Decker
53e88b06b6
select current address in permissions connect (#8811)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-06-16 11:16:57 -05:00
Mark Stacey
4ac4790cfa
Rename 'History' tab to 'Activity' (#8785)
'Activity' is a better name for this tab because it contains more than
just transactions. Signature requests are also included, and more non-
transaction activity may be included in the future.
2020-06-11 17:14:07 -03:00
ricky
71e7966b6a
Update Seed Phrase Functionality on Account Import (#8730)
Update seed phrase functionality to be able to conceal seed phrase (as a password field) so it remains hidden on screen.
2020-06-11 10:24:13 -04:00
Mark Stacey
f5ec16c65a
Fix account menu entry for imported accounts (#8747)
The entry for imported accounts in the account menu looked wrong with
the new connected site icon - there was no padding between the site
icon and the 'imported' label. The entry was pretty crowded with these
three symbols as well (the third being the 'x' used to remove the
account).

The site icon has been made the right-most icon, so that it lines up
with the site icons shown for other accounts, and spacing has been
added between the site icon and the 'imported' label.

The 'x' used to remove accounts has been removed. Accounts can still be
removed from the 'Account Options' menu on the Home screen. This seemed
like the wrong place for this button to exist, as it's the only action
that can be taken from that menu aside from navigation.
2020-06-05 17:24:51 -03:00
Brad Decker
591d84d2bb
refactor asset-list-item to use list-item component (#8725)
* refactor asset items to use list-item

Refactors the asset-list-item and token-cell to rely on the list-item
component for UI. Little changes were needed to the list-item code
to make this work! The result should be lots of eliminated code

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-06-03 12:50:12 -05:00
Brad Decker
c6b77c9734
fix grid repositioning on label change (#8713) 2020-06-03 09:47:12 -05:00
Mark Stacey
171704d980
Fix gas price intermittent test failure (#8728)
The "the transaction has the expected gas price" test was assuming the
fifth element with the `transaction-breakdown__value` class was the
element with the gas price. In practice that was sometimes not the
case, because some transaction detail fields would not be present, or
would appear after the first render.

The field is now looked up with a test id, ensuring it always finds the
correct field.
2020-06-03 10:54:55 -03:00
Mark Stacey
56b157f692
Fix hide token e2e test (#8724)
The e2e test for the "Hide token" functionality was incorrectly
clicking "Cancel" on the "Hide token" modal, thus not actually testing
that that token was hidden at all.

The "Confirm" button is now selected using a test id, to ensure the
wrong button isn't selected.
2020-06-02 18:47:55 -03:00
Erik Marks
616a446832
Use URL origin instead of hostname for permission domains (#8717)
* use URL.origin instead of hostname for tabs and permissions
2020-06-01 16:24:27 -07:00
Brad Decker
c8de0b70fa
Add nonce to transaction details (#8716) 2020-06-01 17:19:49 -05:00
Mark Stacey
df85ab6e10
Implement asset page (#8696)
A new page has been created for viewing assets. This replaces the old
`selectedToken` state, which previously would augment the home page
to show token-specific information.

The new asset page shows the standard token overview as seen previously
on the home page, plus a history filtered to show just transactions
relevant to that token.

The actions that were available in the old token list menu have been
moved to a "Token Options" menu that mirrors the "Account Options"
menu.

The `selectedTokenAddress` state has been removed, as it is no longer
being used for anything.

`getMetaMetricState` has been renamed to `getBackgroundMetaMetricState`
because its sole purpose is extracting data from the background state
to send metrics from the background. It's not really a selector, but
it was convenient for it to use the same selectors the UI uses to
extract background data, so I left it there for now.

A new Redux store has been added to track state related to browser history.
The most recent "overview" page (i.e. the home page or the asset page) is
currently being tracked, so that actions taken from the asset page can return
the user back to the asset page when the action has finished.
2020-06-01 14:54:32 -03:00
Mark Stacey
a0d64c7932
Implement new fullscreen design (#8657)
The fullscreen UI now shows roughly the same design as the popup UI.
A few additional changes depicted in the new fullscreen designs will
be implemented in subsequent PRs (e.g. the inline buttons on assets)

This was done now to make asset pages easier to implement. Implementing
asset pages solely for the popup UI would have been complicated by the
fact that we use viewport size to switch between the two layouts, so we
would have had to re-route upon resizing the window.
2020-05-27 17:28:33 -03:00
Mark Stacey
a6f2156386
Update account options menu design (#8654)
The `AccountDetailsDropdown` component has been rewritten to use the
new `Menu` component, and to follow the latest designs.

This should be functionally equivalent. A couple of the icons have
changed, but that's about it.

Support for a subtitle was added to `MenuItem` to support the `origin`
subtitle used for the explorer link for custom RPC endpoints.

A few adjustments were required to `test/helper.js` to accommodate
the use of `Menu` from a JSDOM context (this is the first time it's
been used in a unit test). A `popover-content` element was added to the
fake DOM, and another global was added that `react-popper` used
internally.

An additional driver method (`clickPoint`) was added to the e2e driver
to allow clicking the background behind the menu to dismiss it. This
wasn't possible using the `clickElement` method, because that method
would refuse to click an obscured element. The only non-obscured
element to click was the menu backdrop, and that didn't work either
because the center was obscured by the menu (Selenium clicks the center
of whichever element is targeted).
2020-05-27 12:31:53 -03:00
Brad Decker
706dc02cb4
Implement new transaction list design (#8564)
Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-05-26 15:49:11 -05:00
Mark Stacey
dd41870f1d
Split TransactionViewBalance component (#8637)
The `TransactionViewBalance` component has been split into three
separate components. This was done primarily to make the asset page
easier to implement. Also the name `TransactionViewBalance` didn't
describe this component very well anymore.

Instead of the Ethereum and token-specific logic being in the same
component, the two cases were split into the `EthOverview` and
`TokenOverview` components respectively. They both use the
`WalletOverview` component, which has the structure shared by both
cases.
2020-05-21 14:33:48 -03:00
Brad Decker
ec99cc82b8
Design QA fixes for v8 (#8630) 2020-05-20 15:42:18 -05:00
Mark Stacey
0ca5d1dc8a
Refactor asset list items (#8586)
All asset list items now use the same component (`AssetListItem`).
Previously the tokens and the Ethereum balance were totally separate
components, despite being styled similarly.

Various unnecessary DOM elements and style rules were removed, but the
overall list looks identical to how it looked before.
2020-05-13 17:41:15 -03:00
Dan J Miller
fda4c94670
Design improvements for the Connect flow (#8494)
* Design improvements for the Connect flow

* Make new-account-modal close a button

* Update e2e tests for auto select account on connect flow
2020-05-04 18:10:09 -02:30
Erik Marks
7100a36ed3 fix e2e tests 2020-05-01 16:51:36 -07:00
Erik Marks
748d5e680c
Add @metamask/test-dapp (#8464)
* add @metamask/test-dapp; delete contract-test files

* dedupe @metamask/onboarding, remove from direct deps
2020-05-01 11:23:03 -07:00
Mark Stacey
118bddd71a
Ensure receive ETH test selects correct transaction (#8482)
The test for receiving ETH from a contract had been clicking on the
first transaction list item, assuming it was pending. This is not
necessarily true; if the pending transaction hadn't yet been rendered,
this could select the first confirmed transaction instead.

The test has been updated to look for the first _pending_ transaction,
rather than just the first transaction.

Note that this likely does not fix the intermittent failure we've been
experiencing. The failure has been observed with this fix in place.
2020-04-30 14:37:01 -03:00
Mark Stacey
388cdccb28
Capture UI state upon e2e test failure (#8481)
The UI state is now captured and stored as a test artifact in the event
of an e2e test failure.
2020-04-30 13:30:24 -03:00
Mark Stacey
b9860034f2
Fix intermittent reject transaction test failure (#8478)
This test would occasionally fail due to a fluke of timing, where a
pending transaction would take slightly longer than expected to
be rendered in the "confirmed transactions" list. This `wait` block
ensures the test will try again until it has confirmed.
2020-04-30 11:39:42 -03:00
Mark Stacey
bae8ef8b70
Fix broken test artifact directory name (#8480)
The test artifact directory for failed test "verbose reports" was
mistakenly being set to `[browser]/undefined`. This was broken during
the refactor in #7798, when the `driver` parameter was mistakenly left
in after the `verboseReportOnFailure` function was converted to a
method being called on `driver`.
2020-04-30 11:39:25 -03:00
Erik Marks
ec20d46362
Clear input elements in e2e tests instead of using sendKeys (#8468) 2020-04-29 20:48:36 -07:00
Erik Marks
c011c0406b
Add new inpage provider package (#8442)
* add @metamask/inpage-provider

* fix failing e2e tests

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-04-28 17:14:51 -07:00
Mark Stacey
a36e6d414b
Remove unused currentAccountTab state (#8404)
This state has been removed from the background. It was used for the
old UI, and has been unused for some time. A migration has been added
to delete this state as well.

The action creator responsible for updating this state has been removed
from the UI as well, along with the `callBackgroundThenUpdateNoSpinner`
convenience function, which was only used for this action.
2020-04-24 00:23:28 -03:00
kumavis
887b27fd04
test/e2e - fix test for contract creation content (#8388) 2020-04-23 21:08:03 +08:00
Erik Marks
62777a81b4
Close notification UI if no unapproved confirmations (#8358)
* close notification UI if no pending confirmations

* change benchmark page to 'home'
2020-04-20 10:21:57 -07:00
Mark Stacey
5ee1291662
Prevent accidental use of globals (#8340)
Previously all browser globals were allowed to be used anywhere by
ESLint because we had set the `env` property to `browser` in the ESLint
config. This has made it easy to accidentally use browser globals
(e.g. #8338), so it has been removed. Instead we now have a short list
of allowed globals.

All browser globals are now accessed as properties on `window`.

Unfortunately this change resulted in a few different confusing unit
test errors, as some of our unit tests setup assumed that a particular
global would be used via `window` or `global`. In particular,
`window.fetch` didn't work correctly because it wasn't patched by the
AbortController polyfill (only `global.fetch` was being patched).
The `jsdom-global` package we were using complicated matters by setting
all of the JSDOM `window` properties directly on `global`, overwriting
the `AbortController` for example.

The `helpers.js` test setup module has been simplified somewhat by
removing `jsdom-global` and constructing the JSDOM instance manually.
The JSDOM window is set on `window`, and a few properties are set on
`global` as well as needed by various dependencies. `node-fetch` and
the AbortController polyfill/patch now work as expected as well,
though `fetch` is only available on `window` now.
2020-04-15 14:23:27 -03:00
Dan J Miller
d8179ff030
Connect Screen Multi Select (#8078)
* Add UI for selecting multiple accounts on the first permissions connect screen

* Make accounts list scrollable on connect screen

* Change title wording on connect screen to 'select your accounts'

* Add select all tooltip to info circle on top of connect screen account list

* Add security info footer to the first screen of the connect flow

* Apply redesigns to page 2 of connect flow

* Display number of accounts on connect flow second screen if there are multiple to connect

* Update e2e tests for connect screen multi-select changes

* Remove unused chooseAnAcount message

* Fix styling/display of redirect elements on second page of connect flow

* Assorted small fixes in permissions connect

* Remove unnecessary tiny delays in spec files

* Remove incorrect use of bem modified in choose-account

* Remove unused locale

* Use Set for managing selected accounts in choose-acount and permissions-connect componets

* Compone!

* Move connect flow header into a reusable component, and implement new header designs

* Update locales and add missing locales

* Improve permission list item design (second screen of connect flow)

* Check box component improvements

* Fixes in variables.scss

* Simplfy code in selectAll of choose-account.component

* Hide checkboxes on first pages on connect flow when there is only one account

* Allow autofill of default new account modal text with right arrow

* Disable next button on first screen of connect flow when no accounts selected

* Improve choose-account/index.scss

* Remove metamask secure graphic

* Fix connect flow redirect screen

* Fix connectToMultiple locale

* Remove locales no longer used after connect flow multiple connect updates

* Fix size of dapp icon on redirect screen of connect flow

* Clean up choose-account code

* Stop using placeholder in new-account-modal

* Remove unused styles in permission-page-container/index.scss

* Pass origin instead of site name to PermissionsConnectHeader in connect flow

* Make iconName a required prop in permissions-connect-header

* Show checkbox in cases where there is one account in the choose-account list

* Do not render select all checkbox when only 1 list item, instead of just hiding it

* Small cleanup in choose-account/index.scss
2020-04-02 06:39:53 -02:30
Whymarrh Whitby
4229892fca
Refactor Menubar and AccountDetailsDropdown styles (#8278) 2020-04-02 00:08:45 -02:30
Mark Stacey
cb0ab90c84
Move asset list to home tab on small screens (#8264)
Two tabs have been created on the home screen: 'Assets' and 'History'.
This tabbed view is shown only on small screens (e.g. in the popup).
The fullscreen view is unchanged.

The toggle-able left sidebar no longer exists, so some 'sidebar-left'
specific code and styles have been removed. The button in the menu bar
has been removed as well.

The 'History' title of the transaction history is now redundant when
where are no pending transactions, so it as been conditionally hidden.

A passthrough for `data-testid` has been added to the Tab component for
convenience in e2e tests.
2020-04-01 13:35:07 -03:00
Whymarrh Whitby
cb7f81bb42
Update Connected Sites modal design (#8262) 2020-03-31 19:40:02 -02:30
Mark Stacey
4f80ff5b01
Redesign 'Add Token' component (#8260)
The 'Add Token' component has been redesigned to be more in-line with
the new home screen design. The description instructing the user to
click the 'Add Token' button has been removed, and the section itself
has been made roughly the same size as one of the list item. The text
now appears on just one line, overflowing to two if necessary.
2020-03-31 10:31:32 -03:00
Mark Stacey
f7504d153e
Move TokenCell styles alongside component (#8257)
The styles for the TokenCell component have been moved to be alongside
the component. They have also been renamed from `token-list-item` to
match the component name.
2020-03-30 23:44:10 -03:00
Whymarrh Whitby
d82f06c710
Convert Connected Sites page to modal (#8254)
This commit updates the existing _Connected Sites_ section to a modal using
the `Popover` component. This will serve as a base for the new modal design.
2020-03-30 21:08:02 -02:30
Erik Marks
b1d090ac4d
Add permissions controller unit tests (#7969)
* add permissions controller, log, middleware, and restricted method unit tests

* fix permissions-related bugs

* convert permissions log to controller-like class

* add permissions unit test coverage requirements

* update rpc-cap

Co-Authored-By: Whymarrh Whitby <whymarrh.whitby@gmail.com>
Co-Authored-By: Mark Stacey <markjstacey@gmail.com>
2020-03-16 10:13:22 -07:00
kumavis
7686edadb0
Build system refactor (#8140)
* build - start static asset task cleanup

* build - simplify manifest tasks

* build - refactor + rename some tasks

* build - various cleanups

* manifest - fix ref from controller

* build - drop gulp for simple async tasks

* build - breakout gulpfile into multiple files

* build - rename some tasks

* build - use task fn refs instead of string names

* build - bundle all scripts first, except for contentscript

* build - improve task timeline

* deps - update lock

* build - improve task time printout

* build/scripts - remove intermediate named task

* build - use 'yarn build' for task entry points

* build - properly run tasks via runTask for timeline display

* development/announcer - fix manifest path + clean

* build - lint fix

* build - make all defined tasks possible entry points

* build/task - properly report errors during task

* ci - fix sesify/lavamoat-viz build command

* build/scripts - run each bundle in separate processes

* lint fix

* build - forward childProcess logs to console

* build/task - fix parallel/series stream end event

* build/scripts refactor contentscript+inpage into a single task

* build/static - use the fs for 150x speedup zomg

* lint fix

* build/static - fix css copy

* Update development/build/scripts.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* Update development/build/scripts.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* Update development/build/index.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* deps - remove redundant mkdirp

* deps - remove unused pumpify

* deps - remove redundant merge-deep

* deps - prefer is-stream of isstream

* deps - remove clone for lodash.cloneDeep

* clean - remove commented code

* build/static - use fs.copy + fast-glob instead of linux cp for better platform support

* build/manifest - standardize task naming

* build/display - clean - remove unused code

* bugfix - fix fs.promises import

* build - create "clean" as named task for use as entrypoint

* build/static - fix for copying dirs

* Update development/build/task.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* Update development/build/display.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* Update development/build/display.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* Update development/build/display.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* build - use task refs, tasks only return promises not streams, etc

* lint fi bad merge + lint

* build - one last cleanup + refactor

* build - add comments introducing file

* build/manifest - fix bug + subtasks dont beed to be named

* Update package.json

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* build/task - remove unused fn

* Update package.json

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* Update development/build/styles.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* Update development/build/styles.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-03-09 08:55:02 +08:00
ryanml
64aef5033d
Adding setting for disabling Eth Phishing Detection (#8125) 2020-02-27 02:29:41 -04:00
Whymarrh Whitby
a78cf0ef3a Enable arrow-parens ESLint rule 2020-02-15 17:04:21 -03:30
Whymarrh Whitby
4f3fc95d50
Update ESLint rules for test suite (#8023)
* Use @metamask/eslint-config@1.1.0
* Use eslint-plugin-mocha@6.2.2
* Mark root ESLint config as root
* Update Mocha ESLint rules with shared ESLint config
2020-02-11 13:21:13 -03:30
Whymarrh Whitby
08c7322203
Remove last remaining usages of npm run (#7994)
* Remove last remaining usages of `npm run`
* Use nyc@15.0.0
2020-02-06 12:22:40 -03:30
ryanml
07ce849c48
Sorting seed phrase confirmation buttons alphabetically (#7933) 2020-01-29 16:12:46 -03:30
Mark Stacey
550fba2466
Add benchmark to CI (#7871)
* Add benchmark to CI

The page load benchmark for Chrome is now run during CI, and the
results are collected and summarized in the `metamaskbot` comment.

Closes #6881

* Double default number of samples

The number of default samples was changed from 10 to 20. The results
from 10 samples would show statistically significant changes in page
load times between builds, so weren't a sufficiently useful metric.
2020-01-23 16:55:17 -04:00
Erik Marks
b095dc0347
Change "Log In/Out" terminology to "Unlock/Lock" (#7853)
* log out/in -> lock/unlock
2020-01-21 14:09:53 -08:00
Mark Stacey
e02b229df6
Add margin of error metric (#7877)
A margin of error metric has been added, which is calculated from a 95%
confidence interval. This confidence interval is calculated using
Student's t-distribution, which is generally preferred for smaller
sample sizes (< ~30) of populations following a normal distribution.
2020-01-21 17:12:40 -04:00
Mark Stacey
5734f7210c
Add benchmark script (#7869)
The script `benchmark.js` will collect page load metrics from the
extension, and print them to a file or the console. A method for
collecting metrics was added to the web driver to help with this.

This script will calculate the min, max, average, and standard
deviation for four metrics: 'firstPaint', 'domContentLoaded', 'load',
and 'domInteractive'. The variation between samples is sometimes high,
with the results varying between samples if only 3 were taken. However,
all tests I've done locally with 5 samples have produced results within
one standard deviation of each other. The default number of samples has
been set to 10, which should be more than enough to produce consistent
results.

The benchmark can be run with the npm script `benchmark:chrome` or
`benchmark:firefox`, e.g. `yarn benchmark:chrome`.
2020-01-21 12:02:45 -04:00
Mark Stacey
d27f2ee7d6
Fix intermittent e2e test failure (#7873)
The 'can retype the seed phrase' test would fail sometimes when one of
the words in the seed phrase was a subset of another word (e.g. 'issue'
and 'tissue'). This is because the selector used to find the word
looked for the first element that contained the text, rather than an
exact match.

To simplify the selector and make it more reliable, test ids were added
to each seed phrase word. The selector now uses CSS instead of XPath,
and it only finds exact matches.

A test id was also added to the div containing the shuffled seed words
to select from, so that the chosen seed words wouldn't be selected
in place of the real target when the same word appears twice.
2020-01-21 11:31:56 -04:00
Mark Stacey
206920e9bd
Add 1 second pause at the beginning of each e2e test run (#7872)
There have been intermittent test failures at the beginning of various
e2e test runs. Most tests start with waiting for the 'Welcome' button
to be visible and enabled, which means waiting for the loading screen
to go away.

It looks like the reason the test intermittently fails is that
sometimes the loading screen doesn't appear until a few moments _after_
the page loads (or that it vanishes and comes back).

It was rather difficult to track down each possible cause for the
loading screens, so in the meantime a pause has been added at the start
of each run. This should hopefully suffice to ensure the momentary gap
in loading has been passed by the time the first test starts up.
2020-01-20 18:40:01 -04:00
Mark Stacey
cc928aaed9
Add withFixtures helper and simple-send test (#7862)
The `withFixtures` helper will instantiate ganache, a web driver, and
a fixture server initialized with the given set of fixtures. It is
meant to facilitating writing small, isolated e2e tests.

The first example test has been added: simple-send. It ensures that the
user can send 1 ETH to another account.

These new e2e tests will run during the normal e2e test run.

Closes #6548
2020-01-20 14:50:25 -04:00
Mark Stacey
ca38635d22
Add page navigation to e2e web driver (#7867)
The driver now has a page navigation function that can navigate to any
of the three primary pages used in the extension. Additional pages and
support of paths can be added later as needed.
2020-01-20 13:03:07 -04:00
Mark Stacey
7b35ea6400
Allow exporting state during e2e tests (#7860)
As of #7663, an in-memory store was used in place of local storage
during e2e tests, to facilitate the use of state fixtures. However,
this made it difficult to export state during a test run. The
instructions for exporting state to create fixtures assumed that local
storage was being used.

A new global function has been added to the background context to allow
exporting state. This method is available during testing and
development, and it works with either local storage or the in-memory
store. The fixture instructions have been updated to reference this new
function.
2020-01-17 18:59:25 -04:00
Mark Stacey
3a2c81d8bc
Switch signature-request e2e tests to using ganache (#7859)
The signature request e2e tests were previously using ropsten. This
expectation was even hard-coded into the test contract dapp.

Instead the contract-dapp has been updated to use the current `chainId`
when calling `signTypedData` (falling back to the `networkId` if
`chainId` is not set). The fixture used by `signature-request` has been
updated to use ganache.
2020-01-17 18:16:21 -04:00
Mark Stacey
08dcd87d58
Refactor building of e2e web driver (#7841)
The switch case has been moved to a separate function so that the
initialization steps following the web driver instantiation could more
easily be deduplicated.
2020-01-16 14:35:50 -04:00
Mark Stacey
be08cfec0c
Wait until element is clickable before clicking in e2e tests (#7823)
* Wait until element is clickable before clicking in e2e tests

A new `findClickableElement` has been added to the webdriver to allow
finding an element and blocking until it's both visible and enabled.
This is now used by the pre-existing `clickElement` method as well.

All cases where something is clicked in the e2e tests have been
updated to use one of these methods, to ensure we don't run into
intermittent failures when loading screens take longer than usual.
2020-01-15 15:34:15 -04:00
Mark Stacey
00da0d28a0
Use data attributes to reference settings in e2e tests (#7820)
These rows on the Advanced Settings page were being looked up in the
e2e tests by the order they appeared in. Instead they're now referenced
by data id, so that we can add new settings and re-arrange them without
breaking the e2e tests.
2020-01-14 17:27:36 -04:00
Mark Stacey
f7aea9597b
await all clicks during e2e tests (#7815)
The `.click()` function returns a Promise, as it needs to communicate
with the browser and ensure the click was successfully sent.
2020-01-14 15:21:02 -04:00
Mark Stacey
19f10e197e
Simplify e2e test transaction navigation (#7816)
The transaction navigation in the e2e tests has been made simpler with
the addition of data attributes to help with finding the navigation
buttons. Each button is now labelled according to its purpose.
2020-01-14 14:53:02 -04:00
Mark Stacey
dd4e684f7d
Consolidate webdriver initialization (#7814)
The webdriver is now instantiated directly by the webdriver module,
rather than via a helper method.
2020-01-14 13:34:38 -04:00
Mark Stacey
ac01c5c89a
Consistent jsdoc syntax (#7755)
* Specify type before parameter name

Various JSDoc `@param` entries were specified as `name {type}` rather
than `{type} name`.

A couple of `@return` entries have been given types as well.

* Use JSDoc optional syntax rather than Closure syntax

* Use @returns rather than @return

* Use consistent built-in type capitalization

Primitive types are lower-case, and Object is upper-case.

* Separate param/return description with a dash
2020-01-13 14:36:36 -04:00
Mark Stacey
27cfb6aa51
Move webdriver interactions into driver module (#7798)
The Selenium webdriver is difficult to use, and easy to misuse. To help
use the driver and make it easier to maintain our e2e tests, all driver
interactions are now performed via a `driver` module. This is basically
a wrapper class around the `selenium-webdriver` that exposes only the
methods we want to use directly, along with all of our helper methods.
2020-01-13 11:07:32 -04:00
Mark Stacey
ff966d515d
Re-arrange transaction navigation test actions (#7806)
These tests were updated in #7473 to navigate in a different order,
because the transaction order changed. Unfortunately this meant that
a second contract deployment was being confirmed, where it was
previously being rejected.

This updates the test to ensure the same transaction is rejected and
confirmed as prior to the change in #7473
2020-01-10 15:32:57 -04:00
Mark Stacey
dac83f6188
Make account details modal close button easier to click (#7797)
The account details close button is difficult to click from the e2e
tests because it has a size of zero. The actual icon is added via CSS
as an `::after` pseudo-element.

The CSS has been adjusted to give the icon a size, and it the markup
is now a `button` rather than a `div`.
2020-01-10 10:43:53 -04:00
Erik Marks
728026d1f7
Fix batch transaction UX (#7473)
* order transactions from oldest to newest in UI

* update json-rpc-engine, eth-json-rpc-middleware

* update e2e and integration tests
2020-01-10 06:34:02 -08:00
Dan J Miller
d349bd61d2
Fix gas estimate for tokens (#7753)
* Make gas estimate update on debounced token amount change, not just on blur after change

* Updated tests

* Ensure `updateGas` is bound early

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-01-10 10:53:54 -03:30
Whymarrh Whitby
92971d3c87
Migrate codebase to use ESM (#7730)
* Update eslint-plugin-import version

* Convert JS files to use ESM

* Update ESLint rules to check imports

* Fix test:unit:global command env

* Cleanup mock-dev script
2020-01-09 00:04:58 -03:30
Mark Stacey
5e461df617
Remove obsolete e2e test ignored error messages (#7768)
These error messages are no longer present during e2e tests, so they
don't need to be ignored.
2020-01-08 13:10:38 -04:00
Mark Stacey
09859d48b0
Prevent install popup during e2e tests (#7760)
Typically the fullscreen UI will open upon installation, though this
behaviour was suppressed in development. This was dealt with in the e2e
tests by waiting for it to open, then closing it.

Instead this behaviour is now suppressed for test builds as well.
2020-01-08 11:47:45 -04:00
Mark Stacey
0f4c0286a4
Improve e2e helper functions (#7750)
* Improve `openNewPage` helper function

The two delays were removed, and the window handle for the new page is
now returned. This was made possible with the new `newWindow` function
added in `v4.0.0-alpha.3` of `selenium-webdriver`.

* Replace recursion with loops

This should result in far more pleasant stack traces for any
exceptions in these functions. It might also be faster. These functions
seem easier to understand as loops as well.

* Remove unused string parameter

The `closeAllWindowHandlesExcept` function has been simplified by
removing a branch that handles the case where the `exceptions`
parameter given is a string. That parameter is never a string.
2020-01-07 10:46:03 -04:00
Mark Stacey
8f40cd8438
Update selenium-webdriver (#7749)
Update `selenium-webdriver` to v4.0.0-alpha.5. Despite the fact that
this version has "alpha" in the name, the maintainer of
`selenium-webdriver` has described this release as stable [1].

A few APIs were removed or changed in v4, which required changes to our
Firefox webdriver.

The port used for webdriver communication can now be specified
manually. This was required to ensure the threebox tests kept working,
because they used two different driver instances. This new version of
`selenium-webdriver` now uses the same port for each instance of the
webdriver (unlike the old version, which generated a new port for each
one), so it was necessary to manually specify the port to prevent the
same port from being used for both instances.

`chromedriver` required an update, as the version we were using was not
compatible with the new W3C WebDriver protocol. I've updated
`geckodriver` as well, just to bring it in line with the version of
Firefox we are using.

[1]: https://github.com/SeleniumHQ/selenium/issues/5617#issuecomment-373446249
2020-01-07 10:01:06 -04:00
Mark Stacey
12fb5ad985 Refactor webdriver setup (#7690)
The setup for each browser web driver instance has been extracted from
`helpers.js` and moved to the `webdriver` directory.
2019-12-11 11:14:58 -08:00
Mark Stacey
eadeaa7883 End-to-end test state fixtures (#7663)
* Add network store for testing

An alternative persistent state store has been created for use with e2e
tests. Instead of reading state from disk, it tries to load state from
a local fixture server running on port `12345` and serving state from
the path `/state.json`, and returns a blank state otherwise.

* Add e2e test fixture server

A fixture server has been added for serving background state, which the
background will read upon startup as part of restoring persisted state.

The `signature-request` e2e test has been updated to use a fixture to
bypass the registration step. The fixture used (`imported-account`) was
generated by pausing midway through that test run
2019-12-11 09:26:20 -08:00
Mark Stacey
958ac69ba1
Consolidate E2E test helper functions into helper.js (#7684)
E2E test helper functions were split between `helper.js` and `func.js`.
They've now all been moved to `helper.js`.
2019-12-10 15:23:25 -04:00
Mark Stacey
885d30f90a
Remove unused test methods (#7679)
These helper methods were no longer used in any e2e tests.
2019-12-10 09:52:48 -04:00