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

Commit

Permalink
fix errors after version update
Browse files Browse the repository at this point in the history
  • Loading branch information
Lykhoyda committed Dec 9, 2022
1 parent cde14b8 commit 7c5f319
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export * from "./setup";
export { DapeteerJestConfig } from "./jest/global";

// default constants
export const RECOMMENDED_METAMASK_VERSION = "v10.22.2";
export const RECOMMENDED_METAMASK_VERSION = "v10.23.0";
1 change: 1 addition & 0 deletions src/snap/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export const installSnap =
}

const result = await installAction;
await installPage.waitForTimeout(1000);
await installPage.close({ runBeforeUnload: true });
if (!(snapIdOrLocation in result.snaps)) {
throw new Error("Failed to install snap");
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ export type Dappeteer = {
opts?: {
customSteps?: InstallStep[];
version?: string;
},
installationSnapUrl?: string
installationSnapUrl?: string;
}
) => Promise<string>;
/**
* Accepts snap_confirm dialog
Expand Down
3 changes: 1 addition & 2 deletions test/constant.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Provider, Server } from "ganache";

import web3 from "web3";
import { Dappeteer, DappeteerPage } from "../src";
import { Dappeteer, DappeteerPage, DappeteerBrowser } from "../src";

import { DappeteerBrowser } from "../src/browser";
import { Contract, Snaps } from "./deploy";

export type InjectableContext = Readonly<{
Expand Down
41 changes: 23 additions & 18 deletions test/flask/snaps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,33 @@ describe("snaps", function () {
metaMaskPage = this.metaMaskPage;
});

beforeEach(function (this: TestContext) {
//skip those tests for non flask metamask
if (!this.browser.isMetaMaskFlask()) {
this.skip();
}
});
describe("Snaps Installation", () => {
beforeEach(function (this: TestContext) {
//skip those tests for non flask metamask
if (!this.browser.isMetaMaskFlask()) {
this.skip();
}
});

it("should install base snap from local server", async function (this: TestContext) {
await metaMask.snaps.installSnap(this.snapServers[Snaps.BASE_SNAP]);
});
it("should install base snap from local server", async function (this: TestContext) {
await metaMask.snaps.installSnap(this.snapServers[Snaps.BASE_SNAP]);
});

it("should install permissions snap local server", async function (this: TestContext) {
await metaMask.snaps.installSnap(this.snapServers[Snaps.PERMISSIONS_SNAP]);
});
it("should install permissions snap local server", async function (this: TestContext) {
await metaMask.snaps.installSnap(
this.snapServers[Snaps.PERMISSIONS_SNAP]
);
});

it("should install keys snap from local server", async function (this: TestContext) {
await metaMask.snaps.installSnap(this.snapServers[Snaps.KEYS_SNAP]);
it("should install keys snap from local server", async function (this: TestContext) {
await metaMask.snaps.installSnap(this.snapServers[Snaps.KEYS_SNAP]);
});
});

describe("should test snap methods", function () {
let testPage: DappeteerPage;
let snapId: string;
let permissionSnapId: string;

beforeEach(function (this: TestContext) {
//skip those tests for non flask metamask
Expand All @@ -49,6 +54,10 @@ describe("snaps", function () {
snapId = await metaMask.snaps.installSnap(
this.snapServers[Snaps.METHODS_SNAP]
);
permissionSnapId = await metaMask.snaps.installSnap(
this.snapServers[Snaps.PERMISSIONS_SNAP]
);

testPage = await metaMaskPage.browser().newPage();
await testPage.goto(EXAMPLE_WEBSITE);
return testPage;
Expand Down Expand Up @@ -78,10 +87,6 @@ describe("snaps", function () {
});

it("should return all notifications", async function (this: TestContext) {
const permissionSnapId = await metaMask.snaps.installSnap(
this.snapServers[Snaps.PERMISSIONS_SNAP]
);

const emitter = await metaMask.snaps.getNotificationEmitter();
const notificationPromise = emitter.waitForNotification();

Expand Down

0 comments on commit 7c5f319

Please sign in to comment.