1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
metamask-extension/test/e2e/fixtures/README.md
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

1.1 KiB

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 loading the unpacked extension, inspecting the background context, dumping chrome.storage.local, and using copy to copy it to the clipboard, and manually pasting the contents into a file on disk.

// Step 1:
chrome.storage.local.get(null, (x) => console.log(x))
// Should print something like:
// > temp1
// > {data: {…}, meta: {…}}

// Step 2:
// Store the value as a global via the 'Store as global variable' option in context menu (shown below)

// Step 3:
copy(temp1)

Store the value as a global variable:

Store as global variable