Skip to content

Commit

Permalink
fix: scrollbuttonvisible race condition
Browse files Browse the repository at this point in the history
Signed-off-by: drptbl <[email protected]>
  • Loading branch information
drptbl committed Jun 20, 2024
1 parent 894106e commit dcc649d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions wallets/metamask/src/pages/NotificationPage/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ export class NotificationPage {
private async beforeMessageSignature(extensionId: string) {
const notificationPage = await getNotificationPageAndWaitForLoad(this.page.context(), extensionId)

// TODO: Make this configurable.
// Most of the time, this function will be used to sign structured messages, so we check for the scroll button first.
const isScrollButtonVisible = await waitFor(
() => notificationPage.locator(Selectors.SignaturePage.structuredMessage.scrollDownButton).isVisible(),
1_500,
false
)
const scrollButton = notificationPage.locator(Selectors.SignaturePage.structuredMessage.scrollDownButton);
const isScrollButtonPresent = await scrollButton.count() > 0;

let isScrollButtonVisible = false;
if (isScrollButtonPresent) {
await scrollButton.waitFor({ state: 'visible' });
isScrollButtonVisible = true;
}

return {
notificationPage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function getNotificationPageAndWaitForLoad(context: BrowserContext,
height: 592
})

await notificationPage.waitForLoadState('load')
await notificationPage.waitForLoadState('domcontentloaded')

return notificationPage
}

0 comments on commit dcc649d

Please sign in to comment.