diff --git a/app/scripts/background.js b/app/scripts/background.js index 7f1c1368696f..bee63e711886 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -66,6 +66,10 @@ const localStore = inTest : new LocalStore() let versionedData +if (inTest || process.env.METAMASK_DEBUG) { + global.metamaskGetState = localStore.get.bind(localStore) +} + // initialization flow initialize().catch(log.error) diff --git a/test/e2e/fixtures/README.md b/test/e2e/fixtures/README.md index 41c04177fc05..e8bbe39ac3e2 100644 --- a/test/e2e/fixtures/README.md +++ b/test/e2e/fixtures/README.md @@ -7,30 +7,17 @@ one thing: ## Generating fixture data -Fixture data can be generated by loading the unpacked extension, inspecting the background context, -dumping `chrome.storage.local`, and using [`copy`][1] to copy it to the clipboard, and manually pasting the contents into -a file on disk. +Fixture data can be generated by following these steps: -```js -// Step 1: -chrome.storage.local.get(null, (x) => console.log(x)) -// Should print something like: -// > temp1 -// > {data: {…}, meta: {…}} +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 -// Step 2: -// Store the value as a global via the 'Store as global variable' option in context menu (shown below) +You can then paste the contents directly in your fixture file. -// Step 3: -copy(temp1) +```js +copy(await metamaskGetState()) ``` -Store the value as a global variable: - -Store as global variable [1]:https://developers.google.com/web/tools/chrome-devtools/console/utilities