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

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
BeroBurny committed Jan 19, 2023
1 parent 87caf77 commit 30f7e66
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion test/basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
signLongTypedData,
signShortTypedData,
} from "./testPageFunctions";
import { isUserDataTest } from "./utils/utils";

use(chaiAsPromised);

Expand All @@ -31,7 +32,7 @@ describe("basic interactions", function () {
let metaMaskPage: DappeteerPage;

before(async function (this: TestContext) {
if (Boolean(process.env.USER_DATA_TEST) === true) {
if (isUserDataTest()) {
this.skip();
}

Expand Down
3 changes: 2 additions & 1 deletion test/contract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ import { ContractInfo } from "./contract/contractInfo";
import { TestContract } from "./deploy";

import { requestAccounts, sendTx } from "./testPageFunctions";
import { isUserDataTest } from "./utils/utils";

describe("contract interactions", function () {
let contract: TestContract;
let testPage: DappeteerPage;
let metamask: Dappeteer;

before(async function (this: TestContext) {
if (Boolean(process.env.USER_DATA_TEST) === true) {
if (isUserDataTest()) {
this.skip();
}

Expand Down
10 changes: 6 additions & 4 deletions test/userData.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
SHORT_ACCOUNT_ADDRESS,
TestContext,
} from "./constant";
import { pause } from "./utils/utils";
import { isUserDataTest, pause } from "./utils/utils";

describe("userData", function () {
this.timeout(120000);
Expand All @@ -28,7 +28,7 @@ describe("userData", function () {
const headless = true;

beforeEach(function (this: TestContext) {
if (Boolean(process.env.USER_DATA_TEST) === false) {
if (!isUserDataTest()) {
this.skip();
}
});
Expand All @@ -54,9 +54,10 @@ describe("userData", function () {
// give some pause to store state into files
await pause(1);

browser.storeUserData(userDataDir);
const isSuccess = browser.storeUserData(userDataDir);
await browser.close();

expect(isSuccess).to.be.true;
expect(isEmpty(userDataDir)).to.be.false;
});

Expand Down Expand Up @@ -105,9 +106,10 @@ describe("userData", function () {
// give some pause to store state into files
await pause(1);

browser.storeUserData(userDataDir);
const isSuccess = browser.storeUserData(userDataDir);
await browser.close();

expect(isSuccess).to.be.true;
expect(isEmpty(userDataDir)).to.be.false;
});

Expand Down
4 changes: 4 additions & 0 deletions test/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ export async function clickElement(
const element = await page.$(selector);
await element.click();
}

export function isUserDataTest(): boolean {
return Boolean(process.env.USER_DATA_TEST);
}

0 comments on commit 30f7e66

Please sign in to comment.