Skip to content

Commit

Permalink
new home
Browse files Browse the repository at this point in the history
  • Loading branch information
futurepaul committed Mar 20, 2024
1 parent e1843e6 commit 9db86a9
Show file tree
Hide file tree
Showing 165 changed files with 6,736 additions and 10,991 deletions.
2 changes: 2 additions & 0 deletions android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ dependencies {
implementation project(':capacitor-mlkit-barcode-scanning')
implementation project(':capacitor-app')
implementation project(':capacitor-app-launcher')
implementation project(':capacitor-camera')
implementation project(':capacitor-clipboard')
implementation project(':capacitor-filesystem')
implementation project(':capacitor-haptics')
implementation project(':capacitor-share')
implementation project(':capacitor-status-bar')
implementation project(':capacitor-toast')
implementation project(':capacitor-secure-storage-plugin')

}

Expand Down
6 changes: 6 additions & 0 deletions android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ project(':capacitor-app').projectDir = new File('../node_modules/.pnpm/@capacito
include ':capacitor-app-launcher'
project(':capacitor-app-launcher').projectDir = new File('../node_modules/.pnpm/@capacitor+app-launcher@5.0.6_@capacitor+core@5.5.1/node_modules/@capacitor/app-launcher/android')

include ':capacitor-camera'
project(':capacitor-camera').projectDir = new File('../node_modules/.pnpm/@capacitor+camera@5.0.9_@capacitor+core@5.5.1/node_modules/@capacitor/camera/android')

include ':capacitor-clipboard'
project(':capacitor-clipboard').projectDir = new File('../node_modules/.pnpm/@capacitor+clipboard@5.0.6_@capacitor+core@5.5.1/node_modules/@capacitor/clipboard/android')

Expand All @@ -28,3 +31,6 @@ project(':capacitor-status-bar').projectDir = new File('../node_modules/.pnpm/@c

include ':capacitor-toast'
project(':capacitor-toast').projectDir = new File('../node_modules/.pnpm/@capacitor+toast@5.0.6_@capacitor+core@5.5.1/node_modules/@capacitor/toast/android')

include ':capacitor-secure-storage-plugin'
project(':capacitor-secure-storage-plugin').projectDir = new File('../node_modules/.pnpm/capacitor-secure-storage-plugin@0.9.0_@capacitor+core@5.5.1/node_modules/capacitor-secure-storage-plugin/android')
43 changes: 21 additions & 22 deletions e2e/encrypt.spec.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
import { expect, test } from "@playwright/test";

import { loadHome, visitSettings } from "./utils";

test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3420/");
});

test("test local encrypt", async ({ page }) => {
// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Mutiny Wallet/);

// Wait for an element matching the selector to appear in DOM.
await page.waitForSelector("text=0 SATS");

console.log("Page loaded.");

// Wait for a while just to make sure we can load everything
await page.waitForTimeout(1000);

// Navigate to settings
const settingsLink = await page.getByRole("link", { name: "Settings" });

settingsLink.click();

// Wait for settings to load
await page.waitForSelector("text=Settings");
await loadHome(page);
await visitSettings(page);

// Click the "Backup" link
await page.click("text=Backup");
Expand All @@ -48,6 +34,13 @@ test("test local encrypt", async ({ page }) => {
// Click the "I wrote down the words" button
await wroteDownButton.click();

// Make sure the balance box ready light is on
await page.locator("title=READY");

// Go back to settings / change password
await visitSettings(page);
await page.click("text=Change Password");

// The header should now say "Encrypt your seed words"
await expect(page.locator("h1")).toContainText(["Encrypt your seed words"]);

Expand All @@ -56,35 +49,41 @@ test("test local encrypt", async ({ page }) => {
const passwordInput = await page.locator(`input[name='password']`);

// 2. Type the password into the input field
await passwordInput.type("test");
await passwordInput.fill("test");

// 3. Find the input field with the name "confirmPassword"
const confirmPasswordInput = await page.locator(
`input[name='confirmPassword']`
);

// 4. Type the password into the input field
await confirmPasswordInput.type("test");
await confirmPasswordInput.fill("test");

// The "Encrypt" button should not be disabled
const encryptButton = await page.locator("button", { hasText: "Encrypt" });
await expect(encryptButton).not.toBeDisabled();

// wait 5 seconds for no reason (SADLY THIS IS IMPORTANT FOR THE TEST TO PASS)
await page.waitForTimeout(5000);

// Click the "Encrypt" button
await encryptButton.click();

// wait for a while just to see what happens
// await page.waitForTimeout(10000);

// Wait for a modal with the text "Enter your password"
await page.waitForSelector("text=Enter your password");

// Find the input field with the name "password"
const passwordInput2 = await page.locator(`input[name='password']`);

// Type the password into the input field
await passwordInput2.type("test");
await passwordInput2.fill("test");

// Click the "Decrypt Wallet" button
await page.click("text=Decrypt Wallet");

// Wait for an element matching the selector to appear in DOM.
await page.waitForSelector("text=0 SATS");
await page.locator(`text=0 sats`).first();
});
71 changes: 27 additions & 44 deletions e2e/fedimint.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { expect, test } from "@playwright/test";

import { loadHome, visitSettings } from "./utils";

const SIGNET_INVITE_CODE =
"fed11qgqzc2nhwden5te0vejkg6tdd9h8gepwvejkg6tdd9h8garhduhx6at5d9h8jmn9wshxxmmd9uqqzgxg6s3evnr6m9zdxr6hxkdkukexpcs3mn7mj3g5pc5dfh63l4tj6g9zk4er";

Expand All @@ -8,24 +10,8 @@ test.beforeEach(async ({ page }) => {
});

test("fedmint join, receive, send", async ({ page }) => {
// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Mutiny Wallet/);

// Wait for an element matching the selector to appear in DOM.
await page.waitForSelector("text=0 SATS");

console.log("Page loaded.");

// Wait for a while just to make sure we can load everything
await page.waitForTimeout(1000);

// Navigate to settings
const settingsLink = await page.getByRole("link", { name: "Settings" });

settingsLink.click();

// Wait for settings to load
await page.waitForSelector("text=Settings");
await loadHome(page);
await visitSettings(page);

// Click "Manage Federations" link
await page.click("text=Manage Federations");
Expand All @@ -45,21 +31,27 @@ test("fedmint join, receive, send", async ({ page }) => {
await page.goBack();
await page.goBack();

// Make sure there's a fedimint icon
await expect(page.getByRole("img", { name: "community" })).toBeVisible();
// Click the top left button (it's the profile button), a child of header
// TODO: better ARIA stuff
await page.locator(`header button`).first().click();

// Click the receive button
await page.click("text=Receive");
// Make sure there's text that says "fedimint"
await page.locator("text=fedimint").first();

// Navigate back home
await page.goBack();

// Click the fab button
await page.locator("#fab").click();
// Click the receive button in the fab
await page.locator("text=Receive").last().click();

// Expect the url to conain receive
await expect(page).toHaveURL(/.*receive/);

// At least one h1 should show "0 sats"
await expect(page.locator("h1")).toContainText(["0 SATS"]);

// At least one h2 should show "0 USD"
await expect(page.locator("h2")).toContainText(["$0 USD"]);

// Type 100 into the input
await page.locator("#sats-input").pressSequentially("100");

Expand All @@ -72,11 +64,7 @@ test("fedmint join, receive, send", async ({ page }) => {
});
await expect(continueButton).not.toBeDisabled();

// Wait one second
// TODO: figure out how to not get an error without waiting
await page.waitForTimeout(1000);

continueButton.click();
await continueButton.click();

await expect(
page.getByText("Keep Mutiny open to complete the payment.")
Expand Down Expand Up @@ -109,31 +97,26 @@ test("fedmint join, receive, send", async ({ page }) => {
);

// Wait for an h1 to appear in the dom that says "Payment Received"
await page.waitForSelector("text=Payment Received", { timeout: 30000 });
await page.waitForSelector("text=Payment Received");

// Click the "Nice" button
await page.click("text=Nice");

// Make sure we have 100 sats in the fedimint balance
await expect(
page
.locator("div")
.filter({ hasText: /^100 eSATS$/ })
.nth(1)
).toBeVisible();
// Make sure we have 100 sats in the top balance
await page.waitForSelector("text=100 SATS");

// Now we send
await page.click("text=Send");
await page.locator("#fab").click();
await page.locator("text=Send").last().click();

// type refund@lnurl-staging.mutinywallet.com
const sendInput = await page.locator("input");
await sendInput.fill("refund@lnurl-staging.mutinywallet.com");

await page.click("text=Continue");

// Wait two seconds (the destination doesn't show up immediately)
// TODO: figure out how to not get an error without waiting
await page.waitForTimeout(2000);
// Wait for the destination to show up
await page.waitForSelector("text=LIGHTNING");

// Type 90 into the input
await page.locator("#sats-input").fill("90");
Expand All @@ -147,8 +130,8 @@ test("fedmint join, receive, send", async ({ page }) => {
});
await expect(confirmButton).not.toBeDisabled();

confirmButton.click();
await confirmButton.click();

// Wait for an h1 to appear in the dom that says "Payment Sent"
await page.waitForSelector("text=Payment Sent", { timeout: 30000 });
await page.waitForSelector("text=Payment Sent");
});
19 changes: 4 additions & 15 deletions e2e/load.spec.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
import { expect, test } from "@playwright/test";
import { test } from "@playwright/test";

import { loadHome } from "./utils";

test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3420/");
});

test("initial load", async ({ page }) => {
// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Mutiny Wallet/);

await expect(page.locator("header")).toContainText(["Activity"], {
timeout: 30000
});

// Wait up to 30 seconds for an image element matching the selector to be visible
await page.waitForSelector("img[alt='lightning']", { timeout: 30000 });

// Wait for an element matching the selector to appear in DOM.
await page.waitForSelector("text=0 SATS");

console.log("Page loaded.");
await loadHome(page);
});
60 changes: 22 additions & 38 deletions e2e/restore.spec.ts
Original file line number Diff line number Diff line change
@@ -1,49 +1,37 @@
import { expect, test } from "@playwright/test";

import { visitSettings } from "./utils";

test.beforeEach(async ({ page }) => {
await page.goto("http://localhost:3420/");
});

test("restore from seed @slow", async ({ page }) => {
// should have 100k sats on-chain
const TEST_SEED_WORDS =
"rival hood review write spoon tide orange ill opera enrich clip acoustic";

// Expect a title "to contain" a substring.
// Start on the home page
await expect(page).toHaveTitle(/Mutiny Wallet/);
await page.waitForSelector("text=Welcome to the Mutiny!");

// Wait for an element matching the selector to appear in DOM.
await page.waitForSelector("text=0 SATS");

console.log("Page loaded.");

// Wait for a while just to make sure we can load everything
await page.waitForTimeout(1000);

// Navigate to settings
const settingsLink = await page.getByRole("link", { name: "Settings" });

settingsLink.click();
console.log("Waiting for new wallet to be created...");

// Wait for settings to load
await page.waitForSelector("text=Settings");
await page.locator(`button:has-text('Import Existing')`).click();

// Click the "Restore" link
page.click("text=Restore");
// should have 100k sats on-chain
const TEST_SEED_WORDS =
"rival hood review write spoon tide orange ill opera enrich clip acoustic";

// There should be some warning text: "This will replace your existing wallet"
await expect(page.locator("p")).toContainText([
"This will replace your existing wallet"
]);

let seedWords = TEST_SEED_WORDS.split(" ");
const seedWords = TEST_SEED_WORDS.split(" ");

// Find the input field with the name "words.0"
for (let i = 0; i < 12; i++) {
const wordInput = await page.locator(`input[name='words.${i}']`);

// Type the seed words into the input field
await wordInput.type(seedWords[i]);
await wordInput.fill(seedWords[i]);
}

// There should be a button with the text "Restore" and it should not be disabled
Expand All @@ -54,33 +42,29 @@ test("restore from seed @slow", async ({ page }) => {

// A modal should pop up, click the "Confirm" button
const confirmButton = await page.locator("button", { hasText: "Confirm" });
confirmButton.click();

// Wait for the wallet to load
await page.waitForSelector("img[alt='lightning']");
await confirmButton.click();

// Eventually we should have a balance of 100k sats
await page.waitForSelector("text=100,000 SATS");
await page.locator("text=100,000 SATS");

// Now we should clean up after ourselves and delete the wallet
settingsLink.click();

// Wait for settings to load
await page.waitForSelector("text=Settings");
await visitSettings(page);

// Click the "Restore" link
page.click("text=Admin Page");
await page.click("text=Admin Page");

// Clicke the Delete Everything button
page.click("text=Delete Everything");
await page.click("text=Delete Everything");

// A modal should pop up, click the "Confirm" button
const confirmDeleteButton = await page.locator("button", {
hasText: "Confirm"
});
confirmDeleteButton.click();

// Wait for the wallet to load
// Wait for the wallet to load
await page.waitForSelector("img[alt='lightning']");
// wait 5 seconds for no reason
await page.waitForTimeout(5000);

await confirmDeleteButton.click();

await page.locator("text=Welcome to the Mutiny!");
});
Loading

0 comments on commit 9db86a9

Please sign in to comment.