Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: [POM] Migrate connections e2e tests to TS and Page Object Model #29609

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

chloeYue
Copy link
Contributor

@chloeYue chloeYue commented Jan 9, 2025

Description

Follow PR #29384 and continue migrating the remaining connection e2e tests to TypeScript and the Page Object Model.

Specs migrated:

test/e2e/tests/connections/review-permissions-page.spec.js
test/e2e/tests/connections/review-switch-permission-page.spec.js
test/e2e/tests/content-security-policy/content-security-policy.spec.js

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

Check code readability, make sure tests pass.

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@chloeYue chloeYue added e2e-test End to end test for the MetaMask extension team-qa QA team labels Jan 9, 2025
@chloeYue chloeYue self-assigned this Jan 9, 2025
Copy link
Contributor

github-actions bot commented Jan 9, 2025

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.

@chloeYue chloeYue requested a review from a team January 9, 2025 16:31
@chloeYue chloeYue requested a review from a team as a code owner January 9, 2025 17:56
@metamaskbot
Copy link
Collaborator

Builds ready [d8189fc]
Page Load Metrics (1777 ± 73 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint29221511650462222
domContentLoaded15532105175415172
load15642138177715173
domInteractive288742189
backgroundConnect790272110
firstReactRender1893512813
getState562202010
initialActions01000
loadScripts11171530128213163
setupStore615921
uiStartup18162487207519895

@chloeYue chloeYue changed the title test: permissions tests test: [POM] Migrate connections e2e tests to TS and Page Object Model Jan 14, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [8dc3e3c]
Page Load Metrics (1540 ± 48 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1423179115459445
domContentLoaded1406177915209546
load1424179815409948
domInteractive23134402612
backgroundConnect77323189
firstReactRender1577362411
getState45312136
initialActions01000
loadScripts1027133511318139
setupStore643984
uiStartup16072034174010450
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@chloeYue chloeYue requested review from seaona and removed request for a team and seaona January 15, 2025 15:09
@metamaskbot
Copy link
Collaborator

Builds ready [fa94554]
Page Load Metrics (1797 ± 61 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint15572057180513264
domContentLoaded15052007176512862
load15472017179712661
domInteractive17102402010
backgroundConnect1082312210
firstReactRender19101502612
getState566212110
initialActions01000
loadScripts11071513131811053
setupStore787222512
uiStartup178026402166242116
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -104.59 KiB (-1.80%)
  • ui: 2.88 KiB (0.04%)
  • common: -34.29 KiB (-0.41%)

@chloeYue chloeYue marked this pull request as draft January 20, 2025 09:01
@metamaskbot
Copy link
Collaborator

Builds ready [be2da98]
Page Load Metrics (1807 ± 63 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint31420881735352169
domContentLoaded15842071178513565
load15982078180713163
domInteractive198637188
backgroundConnect116125178
firstReactRender17100362512
getState65015157
initialActions01000
loadScripts11091532130310953
setupStore867312411
uiStartup18382634209019091
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@chloeYue chloeYue marked this pull request as ready for review February 4, 2025 07:12
@DDDDDanica
Copy link
Contributor

LGTM !

console.log('Disconnect all permissions for accounts and networks');
await this.driver.clickElement(this.disconnectButton);
await this.driver.waitForSelector(this.disconnectModalTitle);
await this.driver.clickElementAndWaitToDisappear(
Copy link
Contributor

Choose a reason for hiding this comment

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

more flakiness mitigation, nice 🙌

Copy link
Contributor

@seaona seaona left a comment

Choose a reason for hiding this comment

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

Overall looks good! Just added a small nit, let me know if it makes sense!

@@ -612,13 +612,16 @@ class TestDapp {
* @param options - Options for connecting account to test dapp.
* @param [options.connectAccountButtonEnabled] - Indicates if the connect account button should be enabled.
* @param options.publicAddress - The public address to connect to test dapp.
* @param [options.networkId] - The network to connect to, defaults to 0x539.
Copy link
Contributor

Choose a reason for hiding this comment

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

mm I think we might want to reference the chainId here?

Suggested change
* @param [options.networkId] - The network to connect to, defaults to 0x539.
* @param [options.chainId] - The chain id to connect to, defaults to 0x539.

Screenshot from 2025-02-04 18-20-27

*/
async connectAccount({
connectAccountButtonEnabled = true,
publicAddress,
networkId = '0x539',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
networkId = '0x539',
chainId = '0x539',

}: {
connectAccountButtonEnabled?: boolean;
publicAddress?: string;
networkId?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
networkId?: string;
chainId?: string;

await this.driver.waitForSelector(this.localhostNetworkMessage);
await this.driver.waitForSelector({
css: '#chainId',
text: networkId,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
text: networkId,
text: chainId,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e-test End to end test for the MetaMask extension team-extension-platform team-qa QA team
Projects
Status: Needs dev review
Development

Successfully merging this pull request may close these issues.

4 participants