Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Commit

Permalink
making review changes - mostly removing console logs, tidying up comm…
Browse files Browse the repository at this point in the history
…ents and fixing workflow issues
  • Loading branch information
ggilchrist-ledger committed May 3, 2022
1 parent 0b92a27 commit 0dc6d71
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 51 deletions.
1 change: 0 additions & 1 deletion e2e/e2e-bridge-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
import Config from "react-native-config";

if (Config.MOCK) {
console.log("SETTING UP TEST CLIENT");
import("./bridge/client").then(({ init }) => init());
}
1 change: 0 additions & 1 deletion e2e/global-setup.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const detox = require("detox");

async function globalSetup() {
console.log("==============> STARTING GLOBAL SETUP");
await detox.globalInit();
}

Expand Down
1 change: 0 additions & 1 deletion e2e/global-teardown.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const detox = require("detox");

async function globalTeardown() {
console.log("==============> STARTING GLOBAL TEARDOWN");
await detox.globalCleanup();
}

Expand Down
12 changes: 0 additions & 12 deletions e2e/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,37 @@ import { readFileSync } from "fs";
const DEFAULT_TIMEOUT = 30000;

export function waitAndTap(elementId, timeout) {
console.log(`==================> Waiting for element with id: ${elementId}`);
waitFor(element(by.id(elementId)))
.toBeVisible()
.withTimeout(timeout || DEFAULT_TIMEOUT);

console.log(`==================> Tapping element with id: ${elementId}`);
return element(by.id(elementId)).tap();
}

export function waitForElement(elementId, timeout) {
console.log(`==================> Waiting for element with id: ${elementId}`);
return waitFor(element(by.id(elementId)))
.toBeVisible()
.withTimeout(timeout || DEFAULT_TIMEOUT);
}

export function tap(elementId) {
console.log(`==================> Tapping element with id: ${elementId}`);
return element(by.id(elementId)).tap();
}

export function tapByText(text, index) {
console.log(`==================> Tapping element with text: ${text}`);
return element(by.text(text))
.atIndex(index || 0)
.tap();
}

export async function typeText(elementId, text, focus = true) {
console.log(
`==================> Typing text '${text}' into element with id ${elementId}`,
);
if (focus) {
await tap(elementId);
}
return element(by.id(elementId)).typeText(text);
}

export function clearField(elementId) {
console.log(`==================> Clearing field with id: ${elementId}`);
element(by.id(elementId)).replaceText("");
}

Expand All @@ -54,9 +45,6 @@ export async function scrollToElementById(
startPositionXAxis = NaN,
startPositionYAxis = 0.5,
) {
console.log(
`==================> Scrolling to element with id: ${elementToScrollToId}`,
);
await waitFor(element(by.id(elementToScrollToId)))
.toBeVisible()
.whileElement(by.id(parentElementId))
Expand Down
19 changes: 3 additions & 16 deletions e2e/models/onboarding/onboardingSteps.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@ export default class OnboardingSteps {
}

static async chooseToConnectYourNano() {
// scroll probably not needed now
// await testHelpers.scrollToElementById(
// `Onboarding - Connect|${device}`,
// "UseCaseSelectScrollView",
// 200,
// "down",
// NaN,
// 0.5,
// );

await testHelpers.tap(`Onboarding - Connect`);
}

Expand All @@ -46,15 +36,12 @@ export default class OnboardingSteps {

static async addDeviceViaBluetooth() {
bridge.addDevices();
await testHelpers.delay(5000);
await testHelpers.delay(5000); // give time for devices to appear
await testHelpers.tapByText("Nano X de David");
// await testHelpers.waitAndTap(`DeviceItemEnter ${david}`);

// set globally installed apps on device?
bridge.setInstalledApps();
bridge.setInstalledApps(); // tell LLM what apps the mock device has

// open ledger manager
bridge.open();
bridge.open(); // open ledger manager

// Continue to welcome screen
// await waitFor(
Expand Down
1 change: 0 additions & 1 deletion e2e/models/passwordEntryPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as testHelpers from "../helpers";

export default class PasswordEntryPage {
static async enterPassword(password) {
// await testHelpers.typeText("password-text-input", password);
if (device.getPlatform() === "ios") {
await element(by.type("RCTUITextField")).typeText(password);
}
Expand Down
4 changes: 0 additions & 4 deletions e2e/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@ import { execSync } from "child_process";
import * as bridge from "./bridge/server";

beforeAll(() => {
console.log("==============> STARTING BRIDGE INIT");
bridge.init();

console.log("==============> SETTING UP DEMO MODE");
setupDemoModeForScreenshots();
});

afterAll(() => {
console.log("==============> CLOSING BRIDGE");
bridge.close();
});

Expand Down
8 changes: 0 additions & 8 deletions e2e/specs/onboarding.spec.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import OnboardingSteps from "../models/onboarding/onboardingSteps";
import PortfolioPage from "../models/portfolioPage";
// import { expectBitmapsToBeEqual } from "../helpers";

describe("Onboarding", () => {
beforeAll(async () => {
console.log("==============> STARTING ONBOARDING DEVICE LAUNCH");
await device.launchApp();
});

it("should be able to connect a Nano X", async () => {
console.log("==============> STARTING ONBOARDING TEST");
await OnboardingSteps.waitForPageToBeVisible();
await OnboardingSteps.startOnboarding();
await OnboardingSteps.chooseToSetupLedger();
Expand All @@ -23,10 +20,5 @@ describe("Onboarding", () => {

await PortfolioPage.waitForPageToBeVisible();
await PortfolioPage.emptyPortfolioIsVisible();

// in future for screenshot comparison
// const image = await device.takeScreenshot("nanoX-onboarding-snapshot");
// const snapshottedImagePath = `e2e/specs/snapshots/${device.getPlatform()}-nanoX-onboarding-snapshot.png`;
// expectBitmapsToBeEqual(image, snapshottedImagePath);
});
});
9 changes: 2 additions & 7 deletions e2e/specs/password.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ const CORRECT_PASSWORD = "passWORD$123!";

describe("Password Lock Screen", () => {
beforeAll(async () => {
console.log("==============> STARTING PASSWORD DEVICE LAUNCH");
await device.launchApp();
});

it("should be able to enter the correct password", async () => {
console.log("==============> STARTING PASSWORD TEST");
await loadConfig("1AccountBTC1AccountETH", true);

await PortfolioPage.waitForPageToBeVisible();
Expand All @@ -23,14 +21,11 @@ describe("Password Lock Screen", () => {
await GeneralSettingsPage.togglePassword();
await GeneralSettingsPage.enterNewPassword(CORRECT_PASSWORD);
await GeneralSettingsPage.enterNewPassword(CORRECT_PASSWORD); // confirm password step

await device.sendToHome();
await device.sendToHome(); // leave LLM app and go to phone's home screen
await delay(60001); // password takes 60 seconds of app inactivity to activate
await device.launchApp();

await device.launchApp(); // restart LLM
await PasswordEntryPage.enterPassword(CORRECT_PASSWORD);
await PasswordEntryPage.login();

await GeneralSettingsPage.isVisible();
});
});

0 comments on commit 0dc6d71

Please sign in to comment.