From b6637c1d6988dbf6fdffb47027b5b97da117a878 Mon Sep 17 00:00:00 2001 From: duckception Date: Sat, 9 Sep 2023 19:25:30 +0200 Subject: [PATCH] Remove text based locators --- commands/metamask.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/commands/metamask.js b/commands/metamask.js index 6e06bf40d..3b796c48f 100644 --- a/commands/metamask.js +++ b/commands/metamask.js @@ -1266,13 +1266,19 @@ const metamask = { .locator( `${mainPageElements.activityTab.completedTransactionsList} > div`, ) - .filter({ hasNotText: 'History' }) - .filter({ hasNotText: 'View more' }) + .filter({ + has: playwright.metamaskWindow().locator('div.list-item__heading'), + }) .all(); while (txIndex >= visibleTxs.length) { try { - await playwright.metamaskWindow().getByText('View more').click(); + await playwright + .metamaskWindow() + .locator( + `${mainPageElements.activityTab.completedTransactionsList} > button`, + ) + .click(); } catch (error) { log('[openTransactionDetails] Clicking "View more" failed!'); throw new Error( @@ -1285,8 +1291,9 @@ const metamask = { .locator( `${mainPageElements.activityTab.completedTransactionsList} > div`, ) - .filter({ hasNotText: 'History' }) - .filter({ hasNotText: 'View more' }) + .filter({ + has: playwright.metamaskWindow().locator('div.list-item__heading'), + }) .all(); }