Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

fix: snap install faster, run all tests #163

Merged
merged 2 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/snap/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down Expand Up @@ -57,14 +57,15 @@ 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");
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/flask/snaps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down