Skip to content

Refactoring ethereum-on.spec.js to use fixtures#10778

Merged
NiranjanaBinoy merged 3 commits intodevelopfrom
e2e-fixture-ethereum-on
Mar 31, 2021
Merged

Refactoring ethereum-on.spec.js to use fixtures#10778
NiranjanaBinoy merged 3 commits intodevelopfrom
e2e-fixture-ethereum-on

Conversation

@NiranjanaBinoy
Copy link
Copy Markdown
Contributor

Fixes: #10771

Explanation:

  1. Moved the file to metamask-extension/test/e2e/tests
  2. Updated ethereum-on.spec.js to use fixtures.
  3. Renamed ethereum-on.spec.js to provider-events.spec.js
  4. provider-events.spec.js is using the same fixture as the personal-sign
  5. Renamed personal-sign folder for fixture to connected-state

@NiranjanaBinoy NiranjanaBinoy requested review from Gudahtt and danjm March 31, 2021 00:40
@NiranjanaBinoy NiranjanaBinoy self-assigned this Mar 31, 2021
@NiranjanaBinoy NiranjanaBinoy requested a review from a team as a code owner March 31, 2021 00:40
@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Copy link
Copy Markdown
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I left a few comments about steps that can be removed entirely, but aside from that this seems functionally correct.


assert.equal(await switchedNetworkDiv.getText(), '3');
assert.equal(await chainIdDiv.getText(), '0x3');
assert.equal(await accountsDiv.getText(), publicAddress.toLowerCase());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just noticed that this last assertion doesn't really work. It's meant to test the accountsChanged event, but, that event is never emitted here and this still works 🤔

Not a blocker for this PR since it's an existing problem in the test, but we should move this out into its own it block at some point, where we compare this text value before and after switching accounts.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not made any change to the last assertion as of yet, will handle that as a separate PR once after the current one is merged.

Copy link
Copy Markdown
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect we don't need any of these delay calls. Those were added a long time ago when we were directly using the selenium webdriver. Since then we've switched to our own driver abstraction, which is somewhat more robust.

@NiranjanaBinoy
Copy link
Copy Markdown
Contributor Author

NiranjanaBinoy commented Mar 31, 2021

I suspect we don't need any of these delay calls. Those were added a long time ago when we were directly using the selenium webdriver. Since then we've switched to our own driver abstraction, which is somewhat more robust.

The delay after switching to the Test Dapp for the first time and delay after changing the network seems to be needed, removing them is resulting in test failure.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2021
@MetaMask MetaMask unlocked this conversation Mar 31, 2021
Copy link
Copy Markdown
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

diff
😍

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [557657c]
Page Load Metrics (650 ± 109 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint53836273
domContentLoaded3661515648226109
load3681516650226109
domInteractive3661514648226109

@NiranjanaBinoy NiranjanaBinoy merged commit e63fcf1 into develop Mar 31, 2021
@NiranjanaBinoy NiranjanaBinoy deleted the e2e-fixture-ethereum-on branch March 31, 2021 17:06
@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor ethereum-on.spec.js to follow pattern in metamask-extension/test/e2e/tests

3 participants