-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 Navigation Signature - Different signature types initiates multiple signatures and rejects all
#27481
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { strict as assert } from 'assert'; | ||
import { TransactionEnvelopeType } from '@metamask/transaction-controller'; | ||
import { Suite } from 'mocha'; | ||
import { By } from 'selenium-webdriver'; | ||
import { | ||
DAPP_HOST_ADDRESS, | ||
WINDOW_TITLES, | ||
openDapp, | ||
regularDelayMs, | ||
unlockWallet, | ||
WINDOW_TITLES, | ||
} from '../../helpers'; | ||
import { Driver } from '../../webdriver/driver'; | ||
import { withRedesignConfirmationFixtures } from './helpers'; | ||
|
@@ -98,7 +98,6 @@ describe('Navigation Signature - Different signature types', function (this: Sui | |
await unlockWallet(driver); | ||
await openDapp(driver); | ||
await queueSignatures(driver); | ||
await driver.delay(regularDelayMs); | ||
|
||
await driver.clickElement('[data-testid="confirm-nav__reject-all"]'); | ||
|
||
|
@@ -166,11 +165,13 @@ async function queueSignatures(driver: Driver) { | |
await driver.waitUntilXWindowHandles(3); | ||
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog); | ||
await driver.findElement({ text: 'Reject all' }); | ||
await driver.waitForSelector(By.xpath("//div[normalize-space(.)='1 of 2']")); | ||
|
||
await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp); | ||
await driver.clickElement('#signTypedDataV4'); | ||
await driver.waitUntilXWindowHandles(3); | ||
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog); | ||
await driver.waitForSelector(By.xpath("//div[normalize-space(.)='1 of 3']")); | ||
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. 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. @seaona, small nit could it possible to wait for any other stable element in the dialog to load? 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. hi @hjetpoluru I've seen that waiting for the navigation to be loaded ensures that the signatures have been queued. [Edit] I think with page objects, we could add a function for checking that the complete signature page is loaded if we want to, though I would leave this out of scope for this fix 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. @seaona, I was thinking about waiting for the buttons to load. But after reading your reply, it looks like we need to wait for the navigation to be loaded to ensure the signatures are queued. Maybe we could add a data-testId to the page loader? Otherwise, I will approve this PR as it looks good. 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. so in this case, we need to wait for the content of the element, to ensure that it has the expected value ( 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. Oh perfect @seaona thanks for your patience and explaining this to me. 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. no problem! Thank you for your detailed review @hjetpoluru 🙇♀️ |
||
} | ||
|
||
async function queueSignaturesAndTransactions(driver: Driver) { | ||
|
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.
this makes the test fail when the delay is not enough