Skip to content

Commit

Permalink
Change error logic
Browse files Browse the repository at this point in the history
  • Loading branch information
duckception committed Sep 7, 2023
1 parent 9f86186 commit 74259ec
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions commands/metamask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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))
Expand Down

0 comments on commit 74259ec

Please sign in to comment.