mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-27 04:46:10 +01:00
7b35ea6400
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.
24 lines
710 B
Markdown
24 lines
710 B
Markdown
# End-to-end tests
|
|
|
|
This directory contains the fixture data used to bootstrap the individual e2e tests. Each sub-directory contains
|
|
one thing:
|
|
|
|
1. A `state.json` file that represents a the saved state for the extension (see _Generating fixture data_ below)
|
|
|
|
## Generating fixture data
|
|
|
|
Fixture data can be generated by following these steps:
|
|
|
|
1. Load the unpacked extension in development or test mode
|
|
2. Inspecting the background context of the extension
|
|
3. Call `metamaskGetState`, then call [`copy`][1] on the results
|
|
|
|
You can then paste the contents directly in your fixture file.
|
|
|
|
```js
|
|
copy(await metamaskGetState())
|
|
```
|
|
|
|
|
|
[1]:https://developers.google.com/web/tools/chrome-devtools/console/utilities
|