diff --git a/src/snap/install.ts b/src/snap/install.ts index ba9205fb..e2d298aa 100644 --- a/src/snap/install.ts +++ b/src/snap/install.ts @@ -28,7 +28,7 @@ export async function installSnap( await installPage.goto("https://google.com"); const installAction = installPage.evaluate( (opts: { snapId: string; version?: string }) => - window.ethereum.request({ + window.ethereum.request<{ snaps: { [snapId: string]: {} } }>({ method: "wallet_enable", params: [ { @@ -57,14 +57,14 @@ export async function installSnap( await clickOnButton(page, "Install"); } - await installAction; - await installPage.close({ runBeforeUnload: true }); - for (const step of opts.customSteps ?? []) { await step(page); } - if (!(await isSnapInstalled(page, snapId))) { - throw new Error("Failed to install snap " + snapId); + + const result = await installAction; + await installPage.close({ runBeforeUnload: true }); + if (!(snapId in result.snaps)) { + throw new Error("Failed to install snap"); } } diff --git a/test/flask/snaps.spec.ts b/test/flask/snaps.spec.ts index 64d42bf4..597d0f92 100644 --- a/test/flask/snaps.spec.ts +++ b/test/flask/snaps.spec.ts @@ -4,7 +4,7 @@ import { TestContext } from "../constant"; import { Snaps } from "../deploy"; import { toUrl } from "../utils/utils"; -describe.only("snaps", function () { +describe("snaps", function () { let metamask: dappeteer.Dappeteer; before(function (this: TestContext) {