Skip to content

End-to-end test state fixtures#7663

Merged
tmashuang merged 2 commits intodevelopfrom
e2e-test-fixtures
Dec 11, 2019
Merged

End-to-end test state fixtures#7663
tmashuang merged 2 commits intodevelopfrom
e2e-test-fixtures

Conversation

@Gudahtt
Copy link
Copy Markdown
Member

@Gudahtt Gudahtt commented Dec 7, 2019

This PR continues the work started in #6873 to improve our end-to-end tests. I'm hoping to bring that PR in one piece at a time; ganache fixtures, the new webdriver module, and the withFixtures helper function will be added in subsequent PRs.

  • 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.

  • 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

@Gudahtt Gudahtt changed the title End-to-end test fixtures End-to-end test state fixtures Dec 7, 2019
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [2dc6fb8]

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [74a1e58]

@tmashuang
Copy link
Copy Markdown
Contributor

Seems the fixtureServer isn't initializing before the extension is initialized. Could be the background conditional not hitting as well. Don't really know on first glance.

For reference:
https://circleci.com/gh/MetaMask/metamask-extension/122908#artifacts/containers/0

https://122908-42009758-gh.circle-artifacts.com/0/test-artifacts/chrome/accepts%20the%20account%20password%20after%20lock/test-failure-screenshot.png

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.
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
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [50d943d]

@tmashuang tmashuang merged commit eadeaa7 into develop Dec 11, 2019
@tmashuang tmashuang deleted the e2e-test-fixtures branch December 11, 2019 17:26
Gudahtt added a commit that referenced this pull request Jan 17, 2020
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.
Gudahtt added a commit that referenced this pull request Jan 17, 2020
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.
yqrashawn pushed a commit to yqrashawn/conflux-portal that referenced this pull request Jan 19, 2020
As of MetaMask#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.
yqrashawn pushed a commit to Conflux-Chain/conflux-portal that referenced this pull request Jan 19, 2020
As of MetaMask#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants