Skip to content

Commit 33b8190

Browse files
committed
new home
1 parent ee32e59 commit 33b8190

File tree

165 files changed

+6736
-10991
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+6736
-10991
lines changed

android/app/capacitor.build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ dependencies {
1212
implementation project(':capacitor-mlkit-barcode-scanning')
1313
implementation project(':capacitor-app')
1414
implementation project(':capacitor-app-launcher')
15+
implementation project(':capacitor-camera')
1516
implementation project(':capacitor-clipboard')
1617
implementation project(':capacitor-filesystem')
1718
implementation project(':capacitor-haptics')
1819
implementation project(':capacitor-share')
1920
implementation project(':capacitor-status-bar')
2021
implementation project(':capacitor-toast')
22+
implementation project(':capacitor-secure-storage-plugin')
2123

2224
}
2325

android/capacitor.settings.gradle

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ project(':capacitor-app').projectDir = new File('../node_modules/.pnpm/@capacito
1111
include ':capacitor-app-launcher'
1212
project(':capacitor-app-launcher').projectDir = new File('../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/app-launcher/android')
1313

14+
include ':capacitor-camera'
15+
project(':capacitor-camera').projectDir = new File('../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/camera/android')
16+
1417
include ':capacitor-clipboard'
1518
project(':capacitor-clipboard').projectDir = new File('../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/clipboard/android')
1619

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

2932
include ':capacitor-toast'
3033
project(':capacitor-toast').projectDir = new File('../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/toast/android')
34+
35+
include ':capacitor-secure-storage-plugin'
36+
project(':capacitor-secure-storage-plugin').projectDir = new File('../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/capacitor-secure-storage-plugin/android')

e2e/encrypt.spec.ts

+21-22
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,14 @@
11
import { expect, test } from "@playwright/test";
22

3+
import { loadHome, visitSettings } from "./utils";
4+
35
test.beforeEach(async ({ page }) => {
46
await page.goto("http://localhost:3420/");
57
});
68

79
test("test local encrypt", async ({ page }) => {
8-
// Expect a title "to contain" a substring.
9-
await expect(page).toHaveTitle(/Mutiny Wallet/);
10-
11-
// Wait for an element matching the selector to appear in DOM.
12-
await page.waitForSelector("text=0 SATS");
13-
14-
console.log("Page loaded.");
15-
16-
// Wait for a while just to make sure we can load everything
17-
await page.waitForTimeout(1000);
18-
19-
// Navigate to settings
20-
const settingsLink = await page.getByRole("link", { name: "Settings" });
21-
22-
settingsLink.click();
23-
24-
// Wait for settings to load
25-
await page.waitForSelector("text=Settings");
10+
await loadHome(page);
11+
await visitSettings(page);
2612

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

37+
// Make sure the balance box ready light is on
38+
await page.locator("title=READY");
39+
40+
// Go back to settings / change password
41+
await visitSettings(page);
42+
await page.click("text=Change Password");
43+
5144
// The header should now say "Encrypt your seed words"
5245
await expect(page.locator("h1")).toContainText(["Encrypt your seed words"]);
5346

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

5851
// 2. Type the password into the input field
59-
await passwordInput.type("test");
52+
await passwordInput.fill("test");
6053

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

6659
// 4. Type the password into the input field
67-
await confirmPasswordInput.type("test");
60+
await confirmPasswordInput.fill("test");
6861

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

66+
// wait 5 seconds for no reason (SADLY THIS IS IMPORTANT FOR THE TEST TO PASS)
67+
await page.waitForTimeout(5000);
68+
7369
// Click the "Encrypt" button
7470
await encryptButton.click();
7571

72+
// wait for a while just to see what happens
73+
// await page.waitForTimeout(10000);
74+
7675
// Wait for a modal with the text "Enter your password"
7776
await page.waitForSelector("text=Enter your password");
7877

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

8281
// Type the password into the input field
83-
await passwordInput2.type("test");
82+
await passwordInput2.fill("test");
8483

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

8887
// Wait for an element matching the selector to appear in DOM.
89-
await page.waitForSelector("text=0 SATS");
88+
await page.locator(`text=0 sats`).first();
9089
});

e2e/fedimint.spec.ts

+27-44
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { expect, test } from "@playwright/test";
22

3+
import { loadHome, visitSettings } from "./utils";
4+
35
const SIGNET_INVITE_CODE =
46
"fed11qgqzc2nhwden5te0vejkg6tdd9h8gepwvejkg6tdd9h8garhduhx6at5d9h8jmn9wshxxmmd9uqqzgxg6s3evnr6m9zdxr6hxkdkukexpcs3mn7mj3g5pc5dfh63l4tj6g9zk4er";
57

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

1012
test("fedmint join, receive, send", async ({ page }) => {
11-
// Expect a title "to contain" a substring.
12-
await expect(page).toHaveTitle(/Mutiny Wallet/);
13-
14-
// Wait for an element matching the selector to appear in DOM.
15-
await page.waitForSelector("text=0 SATS");
16-
17-
console.log("Page loaded.");
18-
19-
// Wait for a while just to make sure we can load everything
20-
await page.waitForTimeout(1000);
21-
22-
// Navigate to settings
23-
const settingsLink = await page.getByRole("link", { name: "Settings" });
24-
25-
settingsLink.click();
26-
27-
// Wait for settings to load
28-
await page.waitForSelector("text=Settings");
13+
await loadHome(page);
14+
await visitSettings(page);
2915

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

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

51-
// Click the receive button
52-
await page.click("text=Receive");
38+
// Make sure there's text that says "fedimint"
39+
await page.locator("text=fedimint").first();
40+
41+
// Navigate back home
42+
await page.goBack();
43+
44+
// Click the fab button
45+
await page.locator("#fab").click();
46+
// Click the receive button in the fab
47+
await page.locator("text=Receive").last().click();
5348

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

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

60-
// At least one h2 should show "0 USD"
61-
await expect(page.locator("h2")).toContainText(["$0 USD"]);
62-
6355
// Type 100 into the input
6456
await page.locator("#sats-input").pressSequentially("100");
6557

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

75-
// Wait one second
76-
// TODO: figure out how to not get an error without waiting
77-
await page.waitForTimeout(1000);
78-
79-
continueButton.click();
67+
await continueButton.click();
8068

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

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

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

117-
// Make sure we have 100 sats in the fedimint balance
118-
await expect(
119-
page
120-
.locator("div")
121-
.filter({ hasText: /^100 eSATS$/ })
122-
.nth(1)
123-
).toBeVisible();
105+
// Make sure we have 100 sats in the top balance
106+
await page.waitForSelector("text=100 SATS");
124107

125108
// Now we send
126-
await page.click("text=Send");
109+
await page.locator("#fab").click();
110+
await page.locator("text=Send").last().click();
127111

128112
// type refund@lnurl-staging.mutinywallet.com
129113
const sendInput = await page.locator("input");
130114
await sendInput.fill("[email protected]");
131115

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

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

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

150-
confirmButton.click();
133+
await confirmButton.click();
151134

152135
// Wait for an h1 to appear in the dom that says "Payment Sent"
153-
await page.waitForSelector("text=Payment Sent", { timeout: 30000 });
136+
await page.waitForSelector("text=Payment Sent");
154137
});

e2e/load.spec.ts

+4-15
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
1-
import { expect, test } from "@playwright/test";
1+
import { test } from "@playwright/test";
2+
3+
import { loadHome } from "./utils";
24

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

79
test("initial load", async ({ page }) => {
8-
// Expect a title "to contain" a substring.
9-
await expect(page).toHaveTitle(/Mutiny Wallet/);
10-
11-
await expect(page.locator("header")).toContainText(["Activity"], {
12-
timeout: 30000
13-
});
14-
15-
// Wait up to 30 seconds for an image element matching the selector to be visible
16-
await page.waitForSelector("img[alt='lightning']", { timeout: 30000 });
17-
18-
// Wait for an element matching the selector to appear in DOM.
19-
await page.waitForSelector("text=0 SATS");
20-
21-
console.log("Page loaded.");
10+
await loadHome(page);
2211
});

e2e/restore.spec.ts

+22-38
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,37 @@
11
import { expect, test } from "@playwright/test";
22

3+
import { visitSettings } from "./utils";
4+
35
test.beforeEach(async ({ page }) => {
46
await page.goto("http://localhost:3420/");
57
});
68

79
test("restore from seed @slow", async ({ page }) => {
8-
// should have 100k sats on-chain
9-
const TEST_SEED_WORDS =
10-
"rival hood review write spoon tide orange ill opera enrich clip acoustic";
11-
12-
// Expect a title "to contain" a substring.
10+
// Start on the home page
1311
await expect(page).toHaveTitle(/Mutiny Wallet/);
12+
await page.waitForSelector("text=Welcome to the Mutiny!");
1413

15-
// Wait for an element matching the selector to appear in DOM.
16-
await page.waitForSelector("text=0 SATS");
17-
18-
console.log("Page loaded.");
19-
20-
// Wait for a while just to make sure we can load everything
21-
await page.waitForTimeout(1000);
22-
23-
// Navigate to settings
24-
const settingsLink = await page.getByRole("link", { name: "Settings" });
25-
26-
settingsLink.click();
14+
console.log("Waiting for new wallet to be created...");
2715

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

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

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

39-
let seedWords = TEST_SEED_WORDS.split(" ");
27+
const seedWords = TEST_SEED_WORDS.split(" ");
4028

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

4533
// Type the seed words into the input field
46-
await wordInput.type(seedWords[i]);
34+
await wordInput.fill(seedWords[i]);
4735
}
4836

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

5543
// A modal should pop up, click the "Confirm" button
5644
const confirmButton = await page.locator("button", { hasText: "Confirm" });
57-
confirmButton.click();
58-
59-
// Wait for the wallet to load
60-
await page.waitForSelector("img[alt='lightning']");
45+
await confirmButton.click();
6146

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

6550
// Now we should clean up after ourselves and delete the wallet
66-
settingsLink.click();
67-
68-
// Wait for settings to load
69-
await page.waitForSelector("text=Settings");
51+
await visitSettings(page);
7052

7153
// Click the "Restore" link
72-
page.click("text=Admin Page");
54+
await page.click("text=Admin Page");
7355

7456
// Clicke the Delete Everything button
75-
page.click("text=Delete Everything");
57+
await page.click("text=Delete Everything");
7658

7759
// A modal should pop up, click the "Confirm" button
7860
const confirmDeleteButton = await page.locator("button", {
7961
hasText: "Confirm"
8062
});
81-
confirmDeleteButton.click();
8263

83-
// Wait for the wallet to load
84-
// Wait for the wallet to load
85-
await page.waitForSelector("img[alt='lightning']");
64+
// wait 5 seconds for no reason
65+
await page.waitForTimeout(5000);
66+
67+
await confirmDeleteButton.click();
68+
69+
await page.locator("text=Welcome to the Mutiny!");
8670
});

0 commit comments

Comments
 (0)