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

fix: add evaluate element click for closeWhatsNewModal #346

Merged
merged 3 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions src/helpers/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,13 @@ export const clickOnLittleDownArrowIfNeeded = async (
await littleArrowDown.click();
}
};

export const evaluateElementClick = async (
page: DappeteerPage,
selector: string
): Promise<void> => {
/* For some reason popup deletes close button and then create new one (react stuff)
* hacky solution can be found here => https://github.com/puppeteer/puppeteer/issues/3496 */
await new Promise((resolve) => setTimeout(resolve, 1000));
await page.$eval(selector, (node) => node.click());
};
8 changes: 3 additions & 5 deletions src/setup/setupActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
openSettingsScreen,
typeOnInputField,
waitForOverlay,
evaluateElementClick,
} from "../helpers";
import { DappeteerPage } from "../page";
import { MetaMaskOptions } from "../types";
Expand Down Expand Up @@ -90,14 +91,11 @@ export async function importAccount(
}

export const closePopup = async (page: DappeteerPage): Promise<void> => {
/* For some reason popup deletes close button and then create new one (react stuff)
* hacky solution can be found here => https://github.com/puppeteer/puppeteer/issues/3496 */
await new Promise((resolve) => setTimeout(resolve, 1000));
await page.$eval(".popover-header__button", (node) => node.click());
await evaluateElementClick(page, ".popover-header__button");
};

export const closeWhatsNewModal = async (
page: DappeteerPage
): Promise<void> => {
await clickOnButton(page, "popover-close");
await evaluateElementClick(page, '[data-testid="popover-close"]');
};
Loading