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 autodetect and import nft e2e tests to use Page Object Model #28383

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

chloeYue
Copy link
Contributor

@chloeYue chloeYue commented Nov 8, 2024

Description

  • Migrate e2e tests test/e2e/tests/tokens/nft/auto-detect-nft.spec.js to TS and Page Object Model, to reduce flakiness.
  • Migrate e2e tests test/e2e/tests/tokens/nft/import-nft.spec.js to TS and Page Object Model, to reduce flakiness.
  • Create page classe functions for nft
  • Deprecate/remove old functions in helper.js

Open in GitHub Codespaces

Related issues

Fixes: #28388

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 self-assigned this Nov 8, 2024
@chloeYue chloeYue requested a review from a team as a code owner November 8, 2024 16:52
@chloeYue chloeYue marked this pull request as draft November 8, 2024 16:52
Copy link
Contributor

github-actions bot commented Nov 8, 2024

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 removed the request for review from mikesposito November 8, 2024 16:52
@chloeYue chloeYue changed the title test: Migrate import nft tests test: [POM] Migrate autodetect and import nft e2e tests to use Page Object Model Nov 8, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [60d54eb]
Page Load Metrics (1885 ± 136 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint163228151901288138
domContentLoaded161128031863281135
load162928151885283136
domInteractive14214614521
backgroundConnect8133262814
firstReactRender522791165627
getState4120222914
initialActions01000
loadScripts116322801393251120
setupStore6471094
uiStartup180330612120308148
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [b5ba5fb]
Page Load Metrics (2109 ± 141 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint168227902125297143
domContentLoaded166727662085284136
load167127942109293141
domInteractive289458209
backgroundConnect77225199
firstReactRender493001276531
getState56415168
initialActions01000
loadScripts120220111534217104
setupStore586222411
uiStartup187731092385363174
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 November 12, 2024 10:55
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.

LGTM!! nice job 🙌

async ({ driver }) => {
await loginWithBalanceValidation(driver);

// navigate to security & privacy settings and toggle on NFT autodetection
Copy link
Contributor

Choose a reason for hiding this comment

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

@chloeYue, this is a suggestion: could we include comments in the test console.log?

I feel that when analyzing any flaky test, it would be helpful especially when actions and pages are repeated like visiting the settings twice or if the test has lot of switching windows.

Including the test console.log would be beneficial. You don't have to modify this PR, but if you think it would help please do include them.

Copy link
Contributor Author

@chloeYue chloeYue Nov 12, 2024

Choose a reason for hiding this comment

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

Hi @hjetpoluru , yes, I totally agree that we currently have very poor logging and need to add more console.log statements for page interactions. However, I try to put these logs in the page class functions instead of the test bodies. This way, when people call these functions, the logs are automatically added. Please see the current log on this branch for autodetect NFT:

Screenshot 2024-11-12 at 23 10 10

@hjetpoluru
Copy link
Contributor

@chloeYue, general question: how do you determine which flaky tests you want to migrate?

Copy link
Contributor

@hjetpoluru hjetpoluru left a comment

Choose a reason for hiding this comment

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

Nice and neat.

@chloeYue
Copy link
Contributor Author

@chloeYue, general question: how do you determine which flaky tests you want to migrate?

Hi @hjetpoluru, thanks for your comment, that's a good question.

Generally, I choose flaky tests that cover important functionalities and have a lower likelihood of being fixed by other teams. For example, confirmation team has people actively working on e2e tests and creating new tests following Page Object Models, so I leave confirmation related tests to them.

For assets-related, accounts-related, and wallet UX related tests, I try to prioritize them because these teams don't have a dedicated QA engineer and need more support. Additionally, the functionalities for these teams are foundational for many other scenarios. For instance, many other scenarios require switching accounts and sending transactions. By fixing flaky tests for accounts and assets, I create Page Object Model classes with stable functions that are ready to use, which benefits other feature teams and other functionalities as well.

Another priority example is onboarding. Onboarding tests were flaky and belong to extension platform team, so I also prioritize onboarding tests.

@chloeYue chloeYue added this pull request to the merge queue Nov 12, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 12, 2024
@chloeYue chloeYue added this pull request to the merge queue Nov 12, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 12, 2024
@chloeYue chloeYue added this pull request to the merge queue Nov 12, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Review finalised - Ready to be merged
Development

Successfully merging this pull request may close these issues.

[POM] Migrate autodetect and import nft e2e tests to use Page Object Model to reduce flakiness
4 participants