diff --git a/commands/metamask.js b/commands/metamask.js index b1e288cc9..d783350fe 100644 --- a/commands/metamask.js +++ b/commands/metamask.js @@ -1269,7 +1269,14 @@ const metamask = { .count(); while (txIndex >= visibleTxsCount) { - await playwright.metamaskWindow().getByText('View more').click(); + try { + await playwright.metamaskWindow().getByText('View more').click(); + } catch (error) { + log('[openTransactionDetails] Clicking "View more" failed!'); + throw new Error( + `Transaction with index ${txIndex} is not found. There are only ${visibleTxsCount} transactions.`, + ); + } visibleTxsCount = await playwright .metamaskWindow() @@ -1279,12 +1286,6 @@ const metamask = { .count(); } - if (txIndex >= visibleTxsCount) { - throw new Error( - `Transaction with index ${txIndex} is not found. There are only ${visibleTxsCount} transactions.`, - ); - } - await playwright .metamaskWindow() .locator(mainPageElements.activityTab.completedTransaction(txIndex))