{"size": 2061, "ext": "js", "max_stars_repo_path": "tests/specs/manager.spec.js", "max_stars_repo_name": "pitpite/ledger-live-desktop", "max_stars_repo_stars_event_min_datetime": "2018-04-30T14:59:56.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T22:21:50.000Z", "max_issues_repo_path": "tests/specs/manager.spec.js", "max_issues_repo_name": "pitpite/ledger-live-desktop", "max_issues_repo_issues_event_min_datetime": "2018-04-20T09:59:28.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T16:44:52.000Z", "max_forks_repo_path": "tests/specs/manager.spec.js", "max_forks_repo_name": "JunichiSugiura/ledger-live-desktop", "max_forks_repo_forks_event_min_datetime": "2018-04-20T14:59:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-27T14:57:37.000Z"}
{"max_stars_count": 1003, "max_issues_count": 2540, "max_forks_count": 354, "avg_line_length": 27.48, "max_line_length": 97, "alphanum_fraction": 0.6327025716}
import initialize, { app, mockListAppsResult, mockDeviceEvent, managerPage } from "../common.js";

describe("Manager", () => {
  initialize("manager", {
    userData: "onboardingcompleted",
  });

  const deviceInfo = {
    version: "2.0.0",
    isBootloader: false,
    isOSU: false,
    managerAllowed: false,
    mcuVersion: "1.12",
    pinValidated: false,
    providerName: null,
    majMin: "2.0",
    targetId: 823132164,
  };

  it("can access manager", async () => {
    await managerPage.goToManager();
    await mockDeviceEvent(
      {
        type: "listingApps",
        deviceInfo,
      },
      {
        type: "result",
        result: mockListAppsResult(
          "Bitcoin,Ethereum,Litecoin,Stellar,Tron,Ripple,Polkadot",
          "Bitcoin,Ethereum (outdated)",
          deviceInfo,
        ),
      },
      { type: "complete" },
    );
    await app.client.pause(4000);
    expect(await app.client.screenshot()).toMatchImageSnapshot({
      customSnapshotIdentifier: "manager-catalog",
    });
  });

  it("can install an app", async () => {
    await managerPage.installApp("Tron");
    await app.client.pause(3000);
    expect(await app.client.screenshot()).toMatchImageSnapshot({
      customSnapshotIdentifier: "manager-install-tron",
    });
  });

  it("can access installed apps tab", async () => {
    await managerPage.goToInstalledAppTab();
    expect(await app.client.screenshot()).toMatchImageSnapshot({
      customSnapshotIdentifier: "manager-appsOnDevice",
    });
  });

  it("can uninstall an app", async () => {
    await managerPage.uninstallApp("Tron");
    await app.client.pause(3000);
    expect(await app.client.screenshot()).toMatchImageSnapshot({
      customSnapshotIdentifier: "manager-uninstall-tron",
    });
  });

  it("can update all apps", async () => {
    await managerPage.goToCatalogTab();
    await managerPage.updateAllApps();
    await app.client.pause(3000);
    expect(await app.client.screenshot()).toMatchImageSnapshot({
      customSnapshotIdentifier: "manager-updateAll",
    });
  });
});
