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

fix: flaky test ERC721 NFTs testdapp interaction should prompt users to add their NFTs to their wallet (all at once) #27889

Merged
merged 2 commits into from
Oct 16, 2024

Conversation

seaona
Copy link
Contributor

@seaona seaona commented Oct 16, 2024

Description

The problem is that we are looking for the Deposit transaction by its text in the activity tab, but this element updates its state, from pendingto confirm, meaning that it can become stale when we do the assertion after (see video).

await driver.waitForSelector({
          css: '[data-testid="activity-list-item-action"]',
          text: 'Deposit',
});
assert.equal(await transactionItem.isDisplayed(), true);

To mitigate this problem, we wait until the transaction is confirmed, and then look for the Deposit tx.
This not only fixes the race condition, but it also ensures that the tx is successful.

Screenshot from 2024-10-16 08-35-56

Open in GitHub Codespaces

Related issues

Fixes: #26759

Manual testing steps

  1. Check ci

Screenshots/Recordings

stale-element-activity.mp4

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.

@seaona seaona added team-extension-platform flaky tests area-qa Relating to QA work (Quality Assurance) labels Oct 16, 2024
@seaona seaona self-assigned this Oct 16, 2024
Copy link
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.

@seaona seaona marked this pull request as ready for review October 16, 2024 07:07
@seaona seaona requested a review from a team as a code owner October 16, 2024 07:07
css: '[data-testid="activity-list-item-action"]',
text: 'Deposit',
});
assert.equal(await transactionItem.isDisplayed(), true);
Copy link
Contributor Author

@seaona seaona Oct 16, 2024

Choose a reason for hiding this comment

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

this causes the race condition, as we are asserting an element that it doesn't exist anymore as it has been updated

Copy link

sonarcloud bot commented Oct 16, 2024

@metamaskbot
Copy link
Collaborator

Builds ready [5bfd3a8]
Page Load Metrics (2102 ± 186 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint167632102102393189
domContentLoaded163831352062384185
load167831522102387186
domInteractive31201623617
backgroundConnect1382402411
firstReactRender491971053215
getState668222311
initialActions00000
loadScripts121226971568358172
setupStore1288332512
uiStartup188534102334401192
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link
Contributor

@chloeYue chloeYue left a comment

Choose a reason for hiding this comment

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

LGTM !

@seaona seaona added this pull request to the merge queue Oct 16, 2024
Merged via the queue into develop with commit 95045ed Oct 16, 2024
87 checks passed
@seaona seaona deleted the nft-activity-flaky branch October 16, 2024 11:30
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2024
@metamaskbot metamaskbot added the release-12.7.0 Issue or pull request that will be included in release 12.7.0 label Oct 16, 2024
@gauthierpetetin gauthierpetetin added release-12.6.0 Issue or pull request that will be included in release 12.6.0 and removed release-12.7.0 Issue or pull request that will be included in release 12.7.0 labels Oct 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-qa Relating to QA work (Quality Assurance) flaky tests release-12.6.0 Issue or pull request that will be included in release 12.6.0 team-extension-platform
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Fix "ERC721 NFTs testdapp interaction should add NFTs to ..." flaky tests
5 participants