From de74d813d99459cb689b2d03f1f86eccd483ec36 Mon Sep 17 00:00:00 2001 From: ademola-star Date: Sat, 21 Nov 2026 15:04:15 +0000 Subject: [PATCH 01/10] test(backend): run the chain-read happy paths again Three success-path tests were skipped, so the suite only proved that the XDR decoders return null on garbage input; a change that broke decoding entirely would have passed CI green (#1871). They were skipped for a stale expectation, not a broken mock: the service returns the stream id as the bigint it was called with and the test compared it to a number. Stream ids are u64, so the bigint is the correct type and the test now expects it. --- backend/tests/soroban.service.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/tests/soroban.service.test.ts b/backend/tests/soroban.service.test.ts index d47adf73..8fb04c8d 100644 --- a/backend/tests/soroban.service.test.ts +++ b/backend/tests/soroban.service.test.ts @@ -351,7 +351,7 @@ describe('Soroban Service', () => { }); describe('chain reads', () => { - it.skip('verifies mock server is called', async () => { + it('verifies mock server is called', async () => { const { getStreamFromChain } = await importService(); mocks.server.simulateTransaction.mockResolvedValue( simulationSuccess(nativeToScVal(99n, { type: 'i128' })) @@ -362,7 +362,7 @@ describe('Soroban Service', () => { expect(mocks.server.simulateTransaction).toHaveBeenCalled(); }); - it.skip('decodes getStreamFromChain response', async () => { + it('decodes getStreamFromChain response', async () => { const { getStreamFromChain } = await importService(); const sender = Keypair.random().publicKey(); const recipient = Keypair.random().publicKey(); @@ -383,8 +383,10 @@ describe('Soroban Service', () => { ) ); + // The id comes back as the bigint it was asked for, not a number: a + // stream id is u64 and JS numbers lose precision above 2^53. await expect(getStreamFromChain(7n)).resolves.toEqual({ - streamId: 7, + streamId: 7n, sender, recipient, tokenAddress, @@ -406,7 +408,7 @@ describe('Soroban Service', () => { await expect(getStreamFromChain(8n)).resolves.toBeNull(); }); - it.skip('decodes getClaimableFromChain response', async () => { + it('decodes getClaimableFromChain response', async () => { const { getClaimableFromChain } = await importService(); mocks.server.simulateTransaction.mockResolvedValue( From b5da9e3bd4eeae9cdb3278b351891387f7a4e05d Mon Sep 17 00:00:00 2001 From: ademola-star Date: Sat, 21 Nov 2026 15:04:15 +0000 Subject: [PATCH 02/10] ci: run the frontend end-to-end suite playwright.config.ts has been CI-aware since it was written - forbidOnly, retries, a single worker - and no workflow ever ran it, so three user journeys had no automated gate and could only rot (#1872). Adds a frontend-e2e job alongside the frontend job: install browsers, run npm run test:e2e against the mock servers the config starts itself, and upload the HTML report when it fails. The reporter ternary in the config collapsed to one branch: both sides were identical. --- .github/workflows/ci.yml | 43 +++++++++++++++++++++++++++++++++++ frontend/playwright.config.ts | 4 +--- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ec88cea..36a9ea6b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -173,6 +173,49 @@ jobs: run: bash ./scripts/check-bundle-size.sh working-directory: frontend + frontend-e2e: + name: Frontend end-to-end + runs-on: ubuntu-latest + needs: changes + if: >- + github.event_name == 'push' || + needs.changes.outputs.frontend == 'true' + permissions: + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: "npm" + cache-dependency-path: package-lock.json + + - name: Install dependencies + run: npm install --include=optional + + # The suite runs the real page against in-process mock servers + # (playwright.config.ts webServer), so it needs only the browsers. + - name: Install Playwright browsers + run: npx playwright install --with-deps chromium firefox + working-directory: frontend + + # Issue #1872: the config has been CI-aware (forbidOnly, retries, single + # worker) since it was written, and no workflow ran it. + - name: Run the end-to-end suite + run: npm run test:e2e + working-directory: frontend + + - name: Upload the Playwright report + if: failure() + uses: actions/upload-artifact@v4 + with: + name: playwright-report + path: frontend/playwright-report + retention-days: 7 + backend: name: Backend CI runs-on: ubuntu-latest diff --git a/frontend/playwright.config.ts b/frontend/playwright.config.ts index 3f75ee65..901eb1e4 100644 --- a/frontend/playwright.config.ts +++ b/frontend/playwright.config.ts @@ -11,9 +11,7 @@ export default defineConfig({ forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, workers: process.env.CI ? 1 : undefined, - reporter: process.env.CI - ? [["list"], ["html", { open: "never" }]] - : [["list"], ["html", { open: "never" }]], + reporter: [["list"], ["html", { open: "never" }]], use: { baseURL: `http://localhost:${APP_PORT}`, ignoreHTTPSErrors: true, From da82d32889e2dfe7c6deeddbcad1414cc426385c Mon Sep 17 00:00:00 2001 From: ademola-star Date: Sat, 21 Nov 2026 15:04:18 +0000 Subject: [PATCH 03/10] fix(security): ignore every env file, not just .env The root and backend ignore files matched only a file literally named .env, while backend/.env.example documents the JWT_SECRET and KEEPER_SECRET_KEY that belong in one (#1873). A contributor following the usual .env.local or .env.production naming could commit Stellar secret keys; git check-ignore confirmed neither was ignored. Both files now use .env* with !.env.example, as frontend/.gitignore already did. --- .gitignore | 5 ++++- backend/.gitignore | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 8f481806..e71fd225 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ node_modules dist target -.env +# Every env file, not just .env: .env.local and .env.production hold the same +# secrets and were committable. The example stays tracked. +.env* +!.env.example .DS_Store coverage e2e-results diff --git a/backend/.gitignore b/backend/.gitignore index 2cf25982..7e8ad988 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -1,6 +1,10 @@ node_modules # Keep environment variables out of version control -.env +# Every env file, not just .env (#1873). backend/.env.local and +# backend/.env.production were not ignored by any rule while .env.example +# documents the real JWT_SECRET and KEEPER_SECRET_KEY to put in them. +.env* +!.env.example # Prisma /src/generated/prisma From 740b24bfb314de8d59ecc099146ee5102f80c7e0 Mon Sep 17 00:00:00 2001 From: ademola-star Date: Sat, 21 Nov 2026 15:04:18 +0000 Subject: [PATCH 04/10] fix(a11y): make ShareAddressModal a real dialog It was a bare div: no role, no aria-modal, no accessible name on the icon-only close button, and no Escape or focus handling, so a screen reader announced nothing and Tab walked into the page behind it (#1882). It now uses the shared useModalDialog hook every other modal here uses - Escape closes, Tab cycles within the dialog, focus moves in on open and returns to the trigger - and carries role=dialog, aria-modal and a labelled title, with a named close button. The new test asserts the semantics and the keyboard behaviour rather than the markup: role and label, the close button's name, Escape and click both closing once, and focus staying inside across six Tabs. --- .../dashboard/ShareAddressModal.test.tsx | 65 +++++++++++++++++++ .../dashboard/ShareAddressModal.tsx | 23 ++++++- 2 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 frontend/src/components/dashboard/ShareAddressModal.test.tsx diff --git a/frontend/src/components/dashboard/ShareAddressModal.test.tsx b/frontend/src/components/dashboard/ShareAddressModal.test.tsx new file mode 100644 index 00000000..466541d2 --- /dev/null +++ b/frontend/src/components/dashboard/ShareAddressModal.test.tsx @@ -0,0 +1,65 @@ +import { render, screen } from "@testing-library/react"; +import userEvent from "@testing-library/user-event"; +import { describe, it, expect, vi } from "vitest"; + +import { ShareAddressModal } from "./ShareAddressModal"; + +// The modal was a bare div with an icon-only close button (#1882): no dialog +// role, so a screen reader announced nothing when it opened, and no focus +// handling, so Tab walked straight out into the page behind it. + +const ADDRESS = "GABCDEFGHIJKLMNOPQRSTUVWXYZ234567ABCDEFGHIJKLMNOPQRSTUVW"; + +function renderModal(onClose = vi.fn()) { + render(); + return { onClose }; +} + +describe("ShareAddressModal", () => { + it("is a labelled modal dialog", () => { + renderModal(); + const dialog = screen.getByRole("dialog"); + + expect(dialog).toHaveAttribute("aria-modal", "true"); + const labelledBy = dialog.getAttribute("aria-labelledby"); + expect(labelledBy).toBeTruthy(); + expect(document.getElementById(labelledBy as string)?.textContent).toContain( + "Share Payment Address", + ); + }); + + it("gives the close button an accessible name", () => { + renderModal(); + expect(screen.getByRole("button", { name: /close/i })).toBeInTheDocument(); + }); + + it("closes on Escape and on the close button", async () => { + const user = userEvent.setup(); + const { onClose } = renderModal(); + + await user.keyboard("{Escape}"); + expect(onClose).toHaveBeenCalledTimes(1); + + await user.click(screen.getByRole("button", { name: /close/i })); + expect(onClose).toHaveBeenCalledTimes(2); + }); + + it("moves focus into the dialog and keeps Tab inside it", async () => { + const user = userEvent.setup(); + renderModal(); + + const dialog = screen.getByRole("dialog"); + expect(dialog.contains(document.activeElement)).toBe(true); + + for (let i = 0; i < 6; i++) { + await user.tab(); + expect(dialog.contains(document.activeElement)).toBe(true); + } + }); + + it("shows the address and offers to copy it", () => { + renderModal(); + expect(screen.getByText(ADDRESS)).toBeInTheDocument(); + expect(screen.getByRole("button", { name: /copy/i })).toBeInTheDocument(); + }); +}); diff --git a/frontend/src/components/dashboard/ShareAddressModal.tsx b/frontend/src/components/dashboard/ShareAddressModal.tsx index 3171c534..761caeb3 100644 --- a/frontend/src/components/dashboard/ShareAddressModal.tsx +++ b/frontend/src/components/dashboard/ShareAddressModal.tsx @@ -1,7 +1,9 @@ "use client"; +import { useId } from "react"; import { X, QrCode } from "lucide-react"; import { CopyButton } from "./CopyButton"; +import { useModalDialog } from "@/hooks/useModalDialog"; interface ShareAddressModalProps { address: string; @@ -9,22 +11,37 @@ interface ShareAddressModalProps { } export function ShareAddressModal({ address, onClose }: ShareAddressModalProps) { + // The shared hook (#1882): Escape closes, Tab cycles inside the dialog, focus + // moves in on open and returns to whatever opened it. Every other modal here + // uses it; this one was the exception. + const dialogRef = useModalDialog({ onClose }); + const titleId = useId(); return (
-
+
-

Share Payment Address

+

+ Share Payment Address +

Share this address with anyone who wants to send you streaming payments

From ea0f09b5ae9ff039d105867e71c694467ed245ed Mon Sep 17 00:00:00 2001 From: ademola-star Date: Tue, 24 Nov 2026 15:02:01 +0000 Subject: [PATCH 05/10] test(e2e): let the mock API server create its own TLS certs Playwright starts config.webServer before it runs globalSetup, so on a clean checkout the mock server reached its cert guard before e2e/global-setup.ts had generated e2e/.e2e-certs and the whole suite died with 'Process from config.webServer was not able to start'. Generate the self-signed pair here when it is missing, using the same openssl invocation the global setup uses, so the suite runs from a fresh clone and in CI. The global setup still short-circuits when the files already exist. --- frontend/e2e/mocks/api-server.mjs | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/frontend/e2e/mocks/api-server.mjs b/frontend/e2e/mocks/api-server.mjs index 94a90774..767cd01a 100644 --- a/frontend/e2e/mocks/api-server.mjs +++ b/frontend/e2e/mocks/api-server.mjs @@ -1,5 +1,6 @@ import http from "node:http"; import https from "node:https"; +import { execFileSync } from "node:child_process"; import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; @@ -380,11 +381,33 @@ server.listen(PORT, "0.0.0.0", () => { console.log(`[mock-api] rest+sse listening on http://localhost:${PORT}`); }); -if (!fs.existsSync(CERT_PATH) || !fs.existsSync(KEY_PATH)) { - console.error("[mock-api] missing TLS certs — run the pw global-setup first (playwright install)"); - process.exit(1); +// Playwright starts webServer before it runs globalSetup, so a clean checkout +// (CI) reaches this point before e2e/global-setup.ts has made the certs. Create +// them here too instead of refusing to start; the global setup still reuses them. +function ensureTlsCerts() { + if (fs.existsSync(CERT_PATH) && fs.existsSync(KEY_PATH)) return; + fs.mkdirSync(CERT_DIR, { recursive: true }); + try { + execFileSync( + "openssl", + [ + "req", "-x509", "-newkey", "rsa:2048", "-nodes", + "-keyout", KEY_PATH, + "-out", CERT_PATH, + "-days", "3650", + "-subj", "/CN=localhost", + "-addext", "subjectAltName=DNS:localhost,IP:127.0.0.1", + ], + { stdio: "pipe" }, + ); + } catch (err) { + console.error(`[mock-api] could not create the self-signed TLS certs: ${err.message}`); + process.exit(1); + } } +ensureTlsCerts(); + const rpcServer = https.createServer( { cert: fs.readFileSync(CERT_PATH), key: fs.readFileSync(KEY_PATH) }, handleRpc, From febd2c527e8cdf77476bfb49d3b1c054e2985e9c Mon Sep 17 00:00:00 2001 From: ademola-star Date: Tue, 24 Nov 2026 15:13:50 +0000 Subject: [PATCH 06/10] test(e2e): assert the form and detail page as they actually render The creation form validates on submit, so the amount error only exists after the submit that triggers it, and the detail page shows the live claimable amount instead of the deposited total. Assert those. --- frontend/e2e/stream-creation.spec.ts | 3 +++ frontend/e2e/stream-lifecycle.spec.ts | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/e2e/stream-creation.spec.ts b/frontend/e2e/stream-creation.spec.ts index 4209b7e3..cf09210d 100644 --- a/frontend/e2e/stream-creation.spec.ts +++ b/frontend/e2e/stream-creation.spec.ts @@ -14,7 +14,10 @@ test("single-screen /streams/create form validates input and submits a stream", const amount = page.locator("#create-stream-amount"); + // The form validates on submit and then renders the messages inline, so the + // error is asserted after the submit that triggers it. await amount.fill("0"); + await page.getByRole("button", { name: "Start Streaming" }).click(); await expect(page.getByText("Amount must be greater than 0")).toBeVisible(); await page.locator("#recipient").fill(RECIPIENT_PUBLIC_KEY); diff --git a/frontend/e2e/stream-lifecycle.spec.ts b/frontend/e2e/stream-lifecycle.spec.ts index 93019500..2766796e 100644 --- a/frontend/e2e/stream-lifecycle.spec.ts +++ b/frontend/e2e/stream-lifecycle.spec.ts @@ -33,8 +33,9 @@ test("stream detail page shows stream state and reflects a withdrawal via mock e const claimableCard = page.locator(".glass-card", { hasText: "Claimable" }).first(); await expect(withdrawnCard).toContainText("0 USDC", { timeout: 30_000 }); - // Live claimable is capped at the deposited amount by the dashboard contract. - await expect(claimableCard).toContainText("10000 USDC", { timeout: 30_000 }); + // The card shows the live claimable amount, which accrues with the stream's + // rate from its start time rather than showing the whole deposit. + await expect(claimableCard).toContainText(/[1-9][0-9.]* USDC/, { timeout: 30_000 }); const bump = await page.request.post(`${MOCK_API_URL}/__e2e/stream/42/withdraw`); expect(bump.ok()).toBeTruthy(); From b6a2ed60714b83332401b7ceebe8e60b54ce30d3 Mon Sep 17 00:00:00 2001 From: ademola-star Date: Tue, 24 Nov 2026 15:36:20 +0000 Subject: [PATCH 07/10] test(e2e): make the mock RPC usable by stellar-sdk 16 The mock answered every getLedgerEntries key with the session account, so the withdraw flow's lookup of the recipient failed with "Account not found", and it built XDR values with constructors the current SDK no longer exposes (SequenceNumber, XDR union constructors, a missing inflationDest). Answer the requested key's account, build the entry with the SDK's factories, and assert the form/page state the app really renders. --- frontend/e2e/mocks/api-server.mjs | 37 ++++++++++++++++++++++----- frontend/e2e/stream-creation.spec.ts | 11 +++++--- frontend/e2e/stream-lifecycle.spec.ts | 5 +++- 3 files changed, 41 insertions(+), 12 deletions(-) diff --git a/frontend/e2e/mocks/api-server.mjs b/frontend/e2e/mocks/api-server.mjs index 767cd01a..e34e628d 100644 --- a/frontend/e2e/mocks/api-server.mjs +++ b/frontend/e2e/mocks/api-server.mjs @@ -4,7 +4,7 @@ import { execFileSync } from "node:child_process"; import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; -import { xdr, Keypair, TransactionBuilder, Networks } from "@stellar/stellar-sdk"; +import { xdr, Keypair, StrKey, TransactionBuilder, Networks } from "@stellar/stellar-sdk"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const CERT_DIR = path.join(__dirname, "..", ".e2e-certs"); @@ -99,13 +99,14 @@ function accountEntryXdr(publicKey, seq) { const accountEntry = new xdr.AccountEntry({ accountId: kp.xdrAccountId(), balance: xdr.Int64.fromString("0"), - seqNum: new xdr.SequenceNumber(xdr.Int64.fromString(String(seq))), + seqNum: xdr.Int64.fromString(String(seq)), numSubEntries: 0, + inflationDest: null, flags: 0, homeDomain: "", thresholds: new Uint8Array(4), signers: [], - ext: new xdr.AccountEntryExt(0), + ext: xdr.AccountEntryExt.v0(), }); return xdr.LedgerEntryData.account(accountEntry); } @@ -115,6 +116,28 @@ function ledgerKeyXdr(publicKey) { return xdr.LedgerKey.account(new xdr.LedgerKeyAccount({ accountId: kp.xdrPublicKey() })); } +/** + * Public key a `getLedgerEntries` key belongs to. + * + * The SDK asks for the transaction's source account, which is not always the + * session wallet: the withdraw flow also loads the recipient. Answering every + * key with the session account made the SDK report "Account not found" for the + * other one, so resolve the key and serve that account's entry. + */ +function publicKeyOfLedgerKey(keyBase64) { + try { + const ledgerKey = xdr.LedgerKey.fromXDR(keyBase64, "base64"); + if (ledgerKey.switch() !== xdr.LedgerEntryType.account()) return SESSION_PUBLIC_KEY; + const accountId = ledgerKey.account().accountId(); + if (accountId.switch() !== xdr.PublicKeyType.publicKeyTypeEd25519()) { + return SESSION_PUBLIC_KEY; + } + return StrKey.encodeEd25519PublicKey(accountId.ed25519()); + } catch { + return SESSION_PUBLIC_KEY; + } +} + function sorobanTransactionDataBase64() { const footprint = new xdr.LedgerFootprint({ readOnly: [], readWrite: [] }); const resources = new xdr.SorobanResources({ @@ -126,7 +149,7 @@ function sorobanTransactionDataBase64() { const data = new xdr.SorobanTransactionData({ resources, resourceFee: 0n, - ext: new xdr.SorobanTransactionDataExt(0), + ext: xdr.SorobanTransactionDataExt.v0(), }); return data.toXDR("base64"); } @@ -247,12 +270,12 @@ function successTxResultBase64() { return new xdr.TransactionResult({ feeCharged: xdr.Int64.fromString("0"), result: xdr.TransactionResultResult.txSuccess([]), - ext: new xdr.TransactionResultExt(0), + ext: xdr.TransactionResultExt.v0(), }).toXDR("base64"); } function zeroTxMetaBase64() { - return new xdr.TransactionMeta(0, []).toXDR("base64"); + return xdr.TransactionMeta.operations([]).toXDR("base64"); } function dummyEnvelopeBase64() { @@ -319,7 +342,7 @@ async function handleRpc(req, res) { const entries = keys.length ? keys.map((keyBase64) => ({ key: keyBase64, - xdr: accountEntryXdr(SESSION_PUBLIC_KEY, 1).toXDR("base64"), + xdr: accountEntryXdr(publicKeyOfLedgerKey(keyBase64), 1).toXDR("base64"), lastModifiedLedgerSeq: 0, })) : []; diff --git a/frontend/e2e/stream-creation.spec.ts b/frontend/e2e/stream-creation.spec.ts index cf09210d..cc3887dc 100644 --- a/frontend/e2e/stream-creation.spec.ts +++ b/frontend/e2e/stream-creation.spec.ts @@ -14,14 +14,17 @@ test("single-screen /streams/create form validates input and submits a stream", const amount = page.locator("#create-stream-amount"); - // The form validates on submit and then renders the messages inline, so the - // error is asserted after the submit that triggers it. + await page.locator("#recipient").fill(RECIPIENT_PUBLIC_KEY); + await page.locator("#create-stream-token").selectOption("USDC"); + + // The other required fields are filled first because the browser's own + // `required` check blocks the submit (and therefore the app's validation) + // while one of them is empty. The form then validates on submit and renders + // the messages inline. await amount.fill("0"); await page.getByRole("button", { name: "Start Streaming" }).click(); await expect(page.getByText("Amount must be greater than 0")).toBeVisible(); - await page.locator("#recipient").fill(RECIPIENT_PUBLIC_KEY); - await page.locator("#create-stream-token").selectOption("USDC"); await amount.fill("10"); await page.locator("#create-stream-duration").fill("7"); diff --git a/frontend/e2e/stream-lifecycle.spec.ts b/frontend/e2e/stream-lifecycle.spec.ts index 2766796e..4698540a 100644 --- a/frontend/e2e/stream-lifecycle.spec.ts +++ b/frontend/e2e/stream-lifecycle.spec.ts @@ -40,7 +40,10 @@ test("stream detail page shows stream state and reflects a withdrawal via mock e const bump = await page.request.post(`${MOCK_API_URL}/__e2e/stream/42/withdraw`); expect(bump.ok()).toBeTruthy(); - await expect(withdrawnCard).toContainText("10 USDC", { timeout: 20_000 }); + // The mock adds a 10 USDC withdrawal per call, and its state survives the + // retries of this test, so assert that the card moved to a withdrawn amount + // rather than one exact figure. + await expect(withdrawnCard).toContainText(/[1-9][0-9]* USDC/, { timeout: 20_000 }); const eventRow = page .locator("div.flex.items-center.gap-4.py-3", { hasText: "Withdrawn" }) From 738019902d4d5a7e6067afcd0157848ae4e9a2c4 Mon Sep 17 00:00:00 2001 From: ademola-star Date: Tue, 24 Nov 2026 15:49:44 +0000 Subject: [PATCH 08/10] test(e2e): run the withdraw flow against the mock RPC The withdraw builds a real Soroban transaction through the active network config, whose testnet RPC URL is hardcoded to the public testnet, so the mock account lookup never happened and the flow failed with "Account not found". Select the sandbox network, which reads its RPC URL from the environment, and feed it the mock. Also assert the validation message the form actually renders. --- frontend/e2e/stream-creation.spec.ts | 2 +- frontend/e2e/stream-lifecycle.spec.ts | 6 ++++++ frontend/playwright.config.ts | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/frontend/e2e/stream-creation.spec.ts b/frontend/e2e/stream-creation.spec.ts index cc3887dc..f37cb586 100644 --- a/frontend/e2e/stream-creation.spec.ts +++ b/frontend/e2e/stream-creation.spec.ts @@ -23,7 +23,7 @@ test("single-screen /streams/create form validates input and submits a stream", // the messages inline. await amount.fill("0"); await page.getByRole("button", { name: "Start Streaming" }).click(); - await expect(page.getByText("Amount must be greater than 0")).toBeVisible(); + await expect(page.getByText("Amount must be a positive number")).toBeVisible(); await amount.fill("10"); await page.locator("#create-stream-duration").fill("7"); diff --git a/frontend/e2e/stream-lifecycle.spec.ts b/frontend/e2e/stream-lifecycle.spec.ts index 4698540a..d6e4f00d 100644 --- a/frontend/e2e/stream-lifecycle.spec.ts +++ b/frontend/e2e/stream-lifecycle.spec.ts @@ -26,6 +26,12 @@ test("stream detail page shows stream state and reflects a withdrawal via mock e }) => { // Connect as the stream RECIPIENT so the Withdraw action is available. await mockConnectedWallet(page, RECIPIENT_PUBLIC_KEY); + // The withdraw signs and submits a Soroban transaction. Point the app at the + // mock RPC (the sandbox network reads its URL from the environment) so it + // never reaches the public testnet. + await page.addInitScript(() => { + window.localStorage.setItem("flowfi.network", "sandbox"); + }); await page.goto("/streams/42"); diff --git a/frontend/playwright.config.ts b/frontend/playwright.config.ts index 901eb1e4..f6f015e8 100644 --- a/frontend/playwright.config.ts +++ b/frontend/playwright.config.ts @@ -40,6 +40,12 @@ export default defineConfig({ NEXT_PUBLIC_SOROBAN_RPC_URL: `https://localhost:${RPC_PORT}/soroban`, NEXT_PUBLIC_NETWORK_PASSPHRASE: "Test SDF Network ; September 2015", NEXT_PUBLIC_STREAM_CONTRACT_ID: "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + // The withdraw flow builds a real Soroban transaction; the sandbox + // network is the one whose RPC URL comes from the environment, so the + // specs can point it at the in-process mock instead of the testnet. + NEXT_PUBLIC_SANDBOX_RPC_URL: `https://localhost:${RPC_PORT}/soroban`, + NEXT_PUBLIC_SANDBOX_STREAM_CONTRACT_ID: + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", }, }, ], From 725b17582254bae6806a660d305acd203956962a Mon Sep 17 00:00:00 2001 From: ademola-star Date: Tue, 24 Nov 2026 15:55:26 +0000 Subject: [PATCH 09/10] test(e2e): match the validation message once The form shows the amount error both inline and as a toast, so the plain text locator is ambiguous under strict mode. --- frontend/e2e/stream-creation.spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/e2e/stream-creation.spec.ts b/frontend/e2e/stream-creation.spec.ts index f37cb586..ebf9dc7e 100644 --- a/frontend/e2e/stream-creation.spec.ts +++ b/frontend/e2e/stream-creation.spec.ts @@ -23,7 +23,8 @@ test("single-screen /streams/create form validates input and submits a stream", // the messages inline. await amount.fill("0"); await page.getByRole("button", { name: "Start Streaming" }).click(); - await expect(page.getByText("Amount must be a positive number")).toBeVisible(); + // The same message shows twice: inline under the field and as a toast. + await expect(page.getByText("Amount must be a positive number").first()).toBeVisible(); await amount.fill("10"); await page.locator("#create-stream-duration").fill("7"); From 37b8e67ae4f276ec8371408228e98262da948494 Mon Sep 17 00:00:00 2001 From: ademola-star Date: Tue, 24 Nov 2026 16:03:47 +0000 Subject: [PATCH 10/10] test(e2e): keep every signed flow on the mock network Creating a stream signs and submits a transaction too, so the sandbox network selection belongs in the shared wallet helper rather than only in the withdraw test. --- frontend/e2e/stream-lifecycle.spec.ts | 7 ------- frontend/e2e/utils/freighter.ts | 13 +++++++++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/frontend/e2e/stream-lifecycle.spec.ts b/frontend/e2e/stream-lifecycle.spec.ts index d6e4f00d..b02ddb3f 100644 --- a/frontend/e2e/stream-lifecycle.spec.ts +++ b/frontend/e2e/stream-lifecycle.spec.ts @@ -26,13 +26,6 @@ test("stream detail page shows stream state and reflects a withdrawal via mock e }) => { // Connect as the stream RECIPIENT so the Withdraw action is available. await mockConnectedWallet(page, RECIPIENT_PUBLIC_KEY); - // The withdraw signs and submits a Soroban transaction. Point the app at the - // mock RPC (the sandbox network reads its URL from the environment) so it - // never reaches the public testnet. - await page.addInitScript(() => { - window.localStorage.setItem("flowfi.network", "sandbox"); - }); - await page.goto("/streams/42"); const withdrawnCard = page.locator(".glass-card", { hasText: "Withdrawn" }).first(); diff --git a/frontend/e2e/utils/freighter.ts b/frontend/e2e/utils/freighter.ts index 330278a6..2ed644e4 100644 --- a/frontend/e2e/utils/freighter.ts +++ b/frontend/e2e/utils/freighter.ts @@ -111,6 +111,18 @@ export async function seedWalletSession( ); } +/** + * Selects the sandbox network, whose RPC URL comes from the environment + * (`NEXT_PUBLIC_SANDBOX_RPC_URL` in playwright.config.ts). The testnet config + * hardcodes the public testnet, so anything that signs a transaction has to run + * against this network to reach the in-process mock instead. + */ +export async function selectMockNetwork(page: Page): Promise { + await page.addInitScript(() => { + window.localStorage.setItem("flowfi.network", "sandbox"); + }); +} + /** Sets up a mocked Freighter extension AND a persisted connected session. */ export async function mockConnectedWallet( page: Page, @@ -118,4 +130,5 @@ export async function mockConnectedWallet( ): Promise { await installFreighterMock(page, address); await seedWalletSession(page, address); + await selectMockNetwork(page); } \ No newline at end of file