-
Notifications
You must be signed in to change notification settings - Fork 5.4k
test: Fix flask multichain api wallet_invokeMethod e2e tests #37471
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
Merged
+192
−64
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
19b489d
fix test
chloeYue 383dd38
fix test
chloeYue 5a007d3
Merge branch 'main' into fix-flaky-invoke-tests
chloeYue 9052dff
Merge branch 'main' into fix-flaky-invoke-tests
chloeYue 5578eef
fix test
chloeYue 41e307c
update snapshot
chloeYue de2d178
update snapshot
chloeYue 9ad5fe0
update snapshot
chloeYue a246399
update snapshot
chloeYue File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,13 +70,16 @@ class TransactionConfirmation extends Confirmation { | |
| private readonly gasLimitInput: RawLocator = | ||
| '[data-testid="gas-limit-input"]'; | ||
|
|
||
| private readonly headerAccountName: RawLocator = | ||
| '[data-testid="header-account-name"]'; | ||
|
|
||
| private readonly networkName: RawLocator = | ||
| '[data-testid="confirmation__details-network-name"]'; | ||
|
|
||
| private readonly saveButton: RawLocator = { tag: 'button', text: 'Save' }; | ||
|
|
||
| private readonly senderAccount: RawLocator = '[data-testid="sender-address"]'; | ||
|
|
||
| private readonly transactionDetails: RawLocator = | ||
| '[data-testid="confirmation__token-details-section"]'; | ||
|
|
||
| private readonly walletInitiatedHeadingTitle: RawLocator = { | ||
| css: 'h4', | ||
| text: tEn('review') as string, | ||
|
|
@@ -215,6 +218,16 @@ class TransactionConfirmation extends Confirmation { | |
| }); | ||
| } | ||
|
|
||
| async checkHeaderAccountNameIsDisplayed(account: string): Promise<void> { | ||
| console.log( | ||
| `Checking header account name ${account} on transaction confirmation page.`, | ||
| ); | ||
| await this.driver.waitForSelector({ | ||
| css: this.headerAccountName, | ||
| text: account, | ||
| }); | ||
| } | ||
|
|
||
| async checkPaidByMetaMask() { | ||
| await this.driver.findElement({ | ||
| css: this.paidByMetaMaskNotice, | ||
|
|
@@ -223,26 +236,18 @@ class TransactionConfirmation extends Confirmation { | |
| } | ||
|
|
||
| /** | ||
| * Checks if the sender account is displayed in the transaction confirmation page. | ||
| * Checks that the sender account is displayed on the transaction confirmation page. | ||
| * | ||
| * @param account - The sender account to check. | ||
| */ | ||
| async checkIsSenderAccountDisplayed(account: string): Promise<boolean> { | ||
| async checkSenderAccountIsDisplayed(account: string): Promise<void> { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the original method was called without asserting the return value in code base, making it effectively do nothing. I updated the implementation to prevent false positives. |
||
| console.log( | ||
| `Checking sender account ${account} on transaction confirmation page.`, | ||
| ); | ||
| try { | ||
| await this.driver.waitForSelector({ | ||
| css: this.senderAccount, | ||
| text: account, | ||
| }); | ||
| return true; | ||
| } catch (err) { | ||
| console.log( | ||
| `Sender account ${account} is not displayed on transaction confirmation page.`, | ||
| ); | ||
| return false; | ||
| } | ||
| await this.driver.waitForSelector({ | ||
| css: this.senderAccount, | ||
| text: account, | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -259,11 +264,23 @@ class TransactionConfirmation extends Confirmation { | |
| `Checking network ${network} is displayed on transaction confirmation page.`, | ||
| ); | ||
| await this.driver.waitForSelector({ | ||
| css: this.transactionDetails, | ||
| css: this.networkName, | ||
| text: network, | ||
| }); | ||
| } | ||
|
|
||
| async checkNetworkIsNotDisplayed(network: string): Promise<void> { | ||
| console.log( | ||
| `Checking network ${network} is not displayed on transaction confirmation page.`, | ||
| ); | ||
| await this.driver.assertElementNotPresent( | ||
| { css: this.networkName, text: network }, | ||
| { | ||
| waitAtLeastGuard: 1000, | ||
| }, | ||
| ); | ||
| } | ||
|
|
||
| async checkNoAlertMessageIsDisplayed() { | ||
| console.log( | ||
| `Checking no alert message is displayed on transaction confirmation page.`, | ||
|
|
@@ -355,6 +372,45 @@ class TransactionConfirmation extends Confirmation { | |
| await this.driver.fill(this.customNonceInput, nonce); | ||
| } | ||
|
|
||
| /** | ||
| * Gets the network name displayed on the transaction confirmation page. | ||
| * | ||
| * IMPORTANT: Make sure the transaction confirmation screen is fully loaded | ||
| * before calling this method to avoid race conditions, as the network name element | ||
| * might not be present or updated correctly immediately after navigation. | ||
| * | ||
| * @returns The network name. | ||
| */ | ||
| async getNetworkName(): Promise<string> { | ||
| const networkNameElement = await this.driver.findElement(this.networkName); | ||
| const networkName = await networkNameElement.getText(); | ||
| console.log( | ||
| 'Current network name displayed on transaction confirmation page: ', | ||
| networkName, | ||
| ); | ||
| return networkName; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the sender account name displayed on the transaction confirmation page. | ||
| * | ||
| * IMPORTANT: Make sure the transaction confirmation screen is fully loaded | ||
| * before calling this method to avoid race conditions. | ||
| * | ||
| * @returns The sender account name. | ||
| */ | ||
| async getSenderAccountName(): Promise<string> { | ||
| const senderAccountElement = await this.driver.findElement( | ||
| this.senderAccount, | ||
| ); | ||
| const senderAccountName = await senderAccountElement.getText(); | ||
| console.log( | ||
| 'Current sender account name displayed on transaction confirmation page: ', | ||
| senderAccountName, | ||
| ); | ||
| return senderAccountName; | ||
| } | ||
|
|
||
| async setCustomNonce(nonce: string) { | ||
| await this.clickCustomNonceButton(); | ||
| await this.fillCustomNonce(nonce); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in each iteration, we check that the network is different from the previous confirmation screen to ensure that we’ve switched to a new confirmation screen