From 08e7140f127e24c485492ea37ed8027903942398 Mon Sep 17 00:00:00 2001 From: Daniel Izdebski Date: Thu, 30 Nov 2023 00:02:14 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(metamask):=20Use=20`.first()?= =?UTF-8?q?`=20in=20`closePopover`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metamask/src/pages/HomePage/actions/popups/closePopover.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wallets/metamask/src/pages/HomePage/actions/popups/closePopover.ts b/wallets/metamask/src/pages/HomePage/actions/popups/closePopover.ts index 8d3f9e28e..dba4a03f1 100644 --- a/wallets/metamask/src/pages/HomePage/actions/popups/closePopover.ts +++ b/wallets/metamask/src/pages/HomePage/actions/popups/closePopover.ts @@ -4,7 +4,8 @@ import Selectors from '../../selectors' // Closes the popover with news, rainbows, unicorns, and other stuff. export async function closePopover(page: Page) { - const closeButtonLocator = page.locator(Selectors.popover.closeButton) + // We're using `first()` here just in case there are multiple popovers, which happens sometimes. + const closeButtonLocator = page.locator(Selectors.popover.closeButton).first() // TODO: Extract & make configurable await clickLocatorIfCondition(closeButtonLocator, () => closeButtonLocator.isVisible(), 1_000)