Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Canestin committed Oct 7, 2024
1 parent 40af448 commit 5edb506
Showing 1 changed file with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { render } from "@tests/test-renderer";
import { AppManifest } from "@ledgerhq/live-common/wallet-api/types";
import { Web3HubTest } from "./shared";
import { Text } from "@ledgerhq/native-ui";
import deviceStorage from "~/logic/storeWrapper";

// Need to fix some stuff if we want to test the player too
jest.mock(
Expand All @@ -29,6 +30,10 @@ async function waitForLoader() {
}

describe("Web3Hub integration test", () => {
beforeEach(() => {
deviceStorage.delete("web3hub__TabHistory");
});

it("Should list manifests and navigate to app page", async () => {
const { user } = render(<Web3HubTest />);

Expand Down Expand Up @@ -201,8 +206,8 @@ describe("Web3Hub integration test", () => {

expect(await screen.findByText("Explore web3")).toBeOnTheScreen();

expect(await screen.findByRole("button", { name: /2/i })).toBeOnTheScreen();
await user.press(screen.getByRole("button", { name: /2/i }));
expect(await screen.findByRole("button", { name: /0/i })).toBeOnTheScreen();
await user.press(screen.getByRole("button", { name: /0/i }));

expect(await screen.findByText("New tab")).toBeOnTheScreen();

Expand All @@ -215,8 +220,8 @@ describe("Web3Hub integration test", () => {
expect(await screen.findByRole("searchbox")).toBeOnTheScreen();
expect(screen.getByRole("searchbox")).toBeEnabled();

expect(await screen.findByRole("button", { name: /2/i })).toBeOnTheScreen();
await user.press(screen.getByRole("button", { name: /2/i }));
expect(await screen.findByRole("button", { name: /0/i })).toBeOnTheScreen();
await user.press(screen.getByRole("button", { name: /0/i }));

expect(await screen.findByText("New tab")).toBeOnTheScreen();

Expand All @@ -227,8 +232,8 @@ describe("Web3Hub integration test", () => {
expect(await screen.findByText("wallet-api-tools-0")).toBeOnTheScreen();
expect(await screen.findByText("Wallet API Tools")).toBeOnTheScreen();

expect(await screen.findByRole("button", { name: /2/i })).toBeOnTheScreen();
await user.press(screen.getByRole("button", { name: /2/i }));
expect(await screen.findByRole("button", { name: /0/i })).toBeOnTheScreen();
await user.press(screen.getByRole("button", { name: /0/i }));

expect(await screen.findByText("New tab")).toBeOnTheScreen();

Expand Down Expand Up @@ -318,7 +323,7 @@ describe("Web3Hub integration test", () => {
expect(await screen.findByText("Explore web3")).toBeOnTheScreen();
});

it("Should navigate to app page, capture it and list the tabs", async () => {
it("Should navigate to app page, capture it, list the tabs and increments the tab counter", async () => {
const { user } = render(<Web3HubTest />);

expect(await screen.findByText("Explore web3")).toBeOnTheScreen();
Expand All @@ -332,8 +337,8 @@ describe("Web3Hub integration test", () => {
expect(await screen.findByText("dummy-0")).toBeOnTheScreen();
expect(await screen.findByText("Dummy Wallet App")).toBeOnTheScreen();

expect(await screen.findByRole("button", { name: /2/i })).toBeOnTheScreen();
await user.press(screen.getByRole("button", { name: /2/i }));
expect(await screen.findByRole("button", { name: /0/i })).toBeOnTheScreen();
await user.press(screen.getByRole("button", { name: /0/i }));
expect(await screen.findByText("New tab")).toBeOnTheScreen();

expect(await screen.findByText("New tab")).toBeOnTheScreen();
Expand All @@ -351,8 +356,8 @@ describe("Web3Hub integration test", () => {
expect(await screen.findByText("wallet-api-tools-0")).toBeOnTheScreen();
expect(await screen.findByText("Wallet API Tools")).toBeOnTheScreen();

expect(await screen.findByRole("button", { name: /2/i })).toBeOnTheScreen();
await user.press(screen.getByRole("button", { name: /2/i }));
expect(await screen.findByRole("button", { name: /1/i })).toBeOnTheScreen();
await user.press(screen.getByRole("button", { name: /1/i }));

expect(await screen.findByText("New tab")).toBeOnTheScreen();
await waitFor(() => expect(screen.getByText("2 tabs")).toBeOnTheScreen());
Expand Down

0 comments on commit 5edb506

Please sign in to comment.