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 Speed Up and Cancel Transaction Tests Cancel transaction Successfully cancels a pending transaction #30435

Merged
merged 4 commits into from
Feb 19, 2025

Conversation

seaona
Copy link
Contributor

@seaona seaona commented Feb 19, 2025

Description

In our ganache instance, auto-mining is set with blockTime: 2 , so a new block is mined every 2 seconds.
In the specs cancel/speed up, we are sending a transaction with low gas, so then we can speed it up/cancel. The problem is if this whole confirm and speed up/cancel, happens in the same block (within the 2 seconds).

Then the transaction stays forever in a Pending state, and the spec fails as it cannot find the correct tx status.
To fix this, we can make sure that we are working with a deterministic block behaviour. So after we confirm the tx we mine a block, and after we speed up/cancel, we mine another block.

image

Ci failure: https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/125141/workflows/92ff1531-7350-490d-bfd1-811098db7535/jobs/4556227/tests

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. Check ci webpack job https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/126169/workflows/f76d3a08-d90e-4cae-8033-897e85cf29d6/jobs/4563925

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.

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.

@metamaskbot metamaskbot added the team-qa QA team label Feb 19, 2025
@@ -28,10 +27,9 @@ describe('Speed Up and Cancel Transaction Tests', function () {
.withPermissionControllerConnectedToTestDapp()
.build(),
localNodeOptions: defaultGanacheOptionsForType2Transactions,
smartContract: SMART_CONTRACTS.PIGGYBANK,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is not needed in this spec, as we are not interacting with any smart contract

@@ -79,10 +78,9 @@ describe('Speed Up and Cancel Transaction Tests', function () {
.withPermissionControllerConnectedToTestDapp()
.build(),
localNodeOptions: defaultGanacheOptionsForType2Transactions,
smartContract: SMART_CONTRACTS.PIGGYBANK,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is not needed in this spec, as we are not interacting with any smart contract

@seaona seaona requested a review from a team as a code owner February 19, 2025 17:18
@@ -93,11 +91,11 @@ describe('Speed Up and Cancel Transaction Tests', function () {
to: DEFAULT_FIXTURE_ACCOUNT,
});

await driver.waitUntilXWindowHandles(3);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not needed as it's handled in the below method

@seaona seaona self-assigned this Feb 19, 2025
@seaona seaona added flaky tests area-qa Relating to QA work (Quality Assurance) labels Feb 19, 2025
@@ -43,7 +41,6 @@ describe('Speed Up and Cancel Transaction Tests', function () {
});

// Wait for confirmation dialog and confirm initial transaction
await driver.waitUntilXWindowHandles(3);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not needed as it's done in the below step

@metamaskbot
Copy link
Collaborator

Builds ready [bfee23b]
Page Load Metrics (1650 ± 37 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1501178316477737
domContentLoaded1470175116187335
load1509177016507637
domInteractive157032115
backgroundConnect979392110
firstReactRender1487262110
getState574252110
initialActions01000
loadScripts1006129011627034
setupStore65413136
uiStartup16982231188011254
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@seaona seaona enabled auto-merge February 19, 2025 18:58
@hjetpoluru hjetpoluru self-requested a review February 19, 2025 20:20
@seaona seaona added this pull request to the merge queue Feb 19, 2025
Merged via the queue into main with commit 468ab8f Feb 19, 2025
82 checks passed
@seaona seaona deleted the fix-flaky-mine-speed-cancel branch February 19, 2025 20:54
@github-actions github-actions bot locked and limited conversation to collaborators Feb 19, 2025
@metamaskbot metamaskbot added the release-12.14.0 Issue or pull request that will be included in release 12.14.0 label Feb 19, 2025
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.14.0 Issue or pull request that will be included in release 12.14.0 team-qa QA team
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants