This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix prompt clicking flakiness, fix multiple snap key permissions (…
…#194) * add retries when confirming prompts with lower timeout * better snap error handling, ability to accept multiple key permissions * bail on first fail * add context to screenshots * remove various random timeouts, add wait for overlay, more retrys * fix lint * increase timeout for loading network and token details * address PR comments * increase timeout * add retry to profile dropdown
- Loading branch information
Showing
23 changed files
with
199 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./actions"; | ||
export * from "./selectors"; | ||
export { retry } from "./utils"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export async function retry<R>( | ||
fn: () => Promise<R>, | ||
count: number | ||
): Promise<R> { | ||
let error; | ||
for (let i = 0; i < count; i++) { | ||
try { | ||
return await fn(); | ||
} catch (e: unknown) { | ||
error = e; | ||
} | ||
} | ||
throw error; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
import { clickOnButton } from "../helpers"; | ||
import { clickOnButton, retry, waitForOverlay } from "../helpers"; | ||
import { DappeteerPage } from "../page"; | ||
|
||
export const acceptAddToken = | ||
(page: DappeteerPage) => async (): Promise<void> => { | ||
await page.bringToFront(); | ||
await page.reload(); | ||
await clickOnButton(page, "Add token"); | ||
await retry(async () => { | ||
await page.bringToFront(); | ||
await page.reload(); | ||
await waitForOverlay(page); | ||
|
||
await clickOnButton(page, "Add token", { timeout: 500 }); | ||
}, 5); | ||
}; | ||
|
||
export const rejectAddToken = | ||
(page: DappeteerPage) => async (): Promise<void> => { | ||
await page.bringToFront(); | ||
await page.reload(); | ||
await clickOnButton(page, "Cancel"); | ||
await retry(async () => { | ||
await page.bringToFront(); | ||
await page.reload(); | ||
await waitForOverlay(page); | ||
|
||
await clickOnButton(page, "Cancel", { timeout: 500 }); | ||
}, 5); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import { clickOnButton } from "../helpers"; | ||
import { clickOnButton, retry, waitForOverlay } from "../helpers"; | ||
import { DappeteerPage } from "../page"; | ||
|
||
// TODO: thing about renaming this method? | ||
export const approve = (page: DappeteerPage) => async (): Promise<void> => { | ||
await page.bringToFront(); | ||
await page.reload(); | ||
await retry(async () => { | ||
await page.bringToFront(); | ||
await page.reload(); | ||
await waitForOverlay(page); | ||
|
||
// TODO: step 1 of connect chose account to connect? | ||
await clickOnButton(page, "Next"); | ||
await clickOnButton(page, "Connect"); | ||
// TODO: step 1 of connect chose account to connect? | ||
await clickOnButton(page, "Next", { timeout: 100 }); | ||
await clickOnButton(page, "Connect", { timeout: 2000 }); | ||
}, 5); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import { clickOnButton } from "../helpers"; | ||
import { clickOnButton, retry, waitForOverlay } from "../helpers"; | ||
import { DappeteerPage } from "../page"; | ||
|
||
export const acceptDialog = | ||
(page: DappeteerPage) => async (): Promise<void> => { | ||
await page.bringToFront(); | ||
await page.reload(); | ||
await clickOnButton(page, "Approve"); | ||
await retry(async () => { | ||
await page.bringToFront(); | ||
await page.reload(); | ||
await waitForOverlay(page); | ||
await clickOnButton(page, "Approve", { timeout: 100 }); | ||
}, 5); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.