Skip to content

Commit

Permalink
chore: add browser close
Browse files Browse the repository at this point in the history
  • Loading branch information
zixiang2018 committed Oct 2, 2023
1 parent 79361a9 commit 8bda9a2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions integration/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ import { metamaskInit } from "./metamask-init.mjs";
const issueAndRevoke = async () => {
const { metamask, browser } = await metamaskInit();

await issue(metamask, browser);
await revoke(metamask, browser);

process.exit(0);
try {
await issue(metamask, browser);
await revoke(metamask, browser);
} catch (e) {
console.error(e);
} finally {
browser.close();
process.exit(0);
}
};

issueAndRevoke();
2 changes: 1 addition & 1 deletion integration/issue.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { sleep, waitForAndClickElement, waitForElement } from "./utils.mjs";
export const issue = async (metamask, browser) => {
try {
const page = await browser.newPage();
await page.goto("http://localhost:4173/", { waitUntil: "networkidle" });
await page.goto("http://localhost:5173/", { waitUntil: "networkidle" });

// START - approve application once, subsequent tests no longer need
await metamask.approve();
Expand Down
2 changes: 1 addition & 1 deletion integration/revoke.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { sleep, waitForAndClickElement, waitForElement } from "./utils.mjs";
export const revoke = async (metamask, browser) => {
try {
const page = await browser.newPage();
await page.goto("http://localhost:4173/");
await page.goto("http://localhost:5173/");

await waitForAndClickElement(page, "[data-testid='connectToWallet']");

Expand Down

0 comments on commit 8bda9a2

Please sign in to comment.