Skip to content

Commit

Permalink
test: add scenario 'Cancel transaction by sending subsequent transact…
Browse files Browse the repository at this point in the history
…ion with the same nonce' (#23872)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

In this PR we add the scenario for the flow 'Cancel transaction by
sending subsequent transaction with the same nonce'.
This task belongs to the effort of documenting manual QA flows in this
[Epic](#21962).

User flow summary:

- create 'Send' transaction nonce with very low gas fees
- send the next transaction with the 0 value and previous nonce to
yourself to cancel the first transaction
- validate that the first transaction is cancelled

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/23872?quickstart=1)

## **Related issues**

Fixes:
[23830](#23830)

## **Manual testing steps**

1. Verify that the test steps align with the sequence in the video.
2. You can find rendered table
[here](https://github.com/MetaMask/metamask-extension/blob/57c1f2861fc70a00da97d1c778fd66ddf774e7ae/test/scenarios/3.%20transactions/cancel%20transaction%20using%20same%20nonce.csv).


## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->



https://github.com/MetaMask/metamask-extension/assets/104780023/efc7e4bf-d946-4735-bd90-d21556d487b3


### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.
  • Loading branch information
sleepytanya authored Apr 19, 2024
1 parent e0ecf74 commit 45d8425
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Step,Test steps,Test data,Expected result,Notes
1,Open the extension.,,The 'Welcome Back' screen is shown.,
2,Proceed to Unlock the wallet.,password (8 characters min).,The Ether balance is shown on the overview. The wallet address is shown on the overview. The selected network is Ethereum Mainnet. ,
3,Switch networks to a test network.,e.g. Sepolia,The Sepolia balance is shown on the overview. The wallet address is shown on the overview. The selected network is Sepolia.,
4,Click on three-dot menu located in the upper right corner.,,,
5,Go to 'Settings'.,,,
6,Choose 'Advanced'.,,"The ""Customize transaction nonce"" feature is set to be off by default.",
7,Turn on 'Customize transaction'.,,,
8,Navigate back to the main wallet screen to continue.,,,Click on the MetaMask logo or return to the MetaMask tab if the extension is in the expanded view mode.
9,"Create the transaction by clicking ""Send"" button.",,"MetaMask popup with the recipient's address, amount to be sent, gas fee estimates is displayed.",You can use this address as a recipient's address : 0x0c54FcCd2e384b4BB6f2E405Bf5Cbc15a017AaFb
10,Click 'Next'.,,"Metamask popup with the recipient's address, amount, gas and total fees is displayed. The ""Custom nonce"" field with the next suggested nonce value is shown on the confirmation screen.",
11,Set very low gas fee using 'Advanced' gas setting,,Click the pen icon in the 'Estimated fee' field to access 'Advanced' gas settings. Set very low 'Max base fee' and 'Priority fee' (i.e. 0.0001 GWEI).,Opting for a lower gas fee provides the flexibility to send a subsequent transaction to cancel the current one.
12,Proceed to confirm transaction.,,,
13,Switch to the Activity tab.,,"In the activity tab, the transaction is currently displayed as being in a pending state.",Make a note of the transaction nonce value.
14,"Create another transaction by clicking ""Send"" button.",,"MetaMask popup with the recipient's address, amount to be sent, gas fee estimates is displayed.",Select your testing account address as the recipient's address and set the transaction amount to 0.
15,Click 'Next'.,,"Metamask popup with the recipient's address, amount, gas and total fees is displayed. The ""Custom nonce"" field with the next suggested nonce value is shown on the confirmation screen.",Use the same nonce value that was assigned to the previous transaction.
16,Proceed to confirm the transaction.,,,
17,Switch to the Activity tab.,,One 'Send' transaction with the same nonce and 0 value in 'Pending' state is displayed.,
18,Allow some time for the transaction to get confirmed.,, 'Send' and 'Receive' transactions with 0 value and the same nonce are shown on the Activity tab.,The previous transaction was cancelled by the newly created transaction with the same nonce and 0 value.

0 comments on commit 45d8425

Please sign in to comment.