aboutsummaryrefslogtreecommitdiffstats
path: root/test/e2e/ark-receive-from-server-wallet.spec.ts
blob: 3ad7205ff20a47543bf70c576cc72d86397db096 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { expect, test } from "@playwright/test";
import {
  bobUsername,
  bobPassword,
  testSecret,
  arkWalletPassword,
  login,
  ensureArkAccount,
  createArkInvoiceViaUI,
  sendArkFromTestEndpoint,
  waitForInvoicePaid,
} from "./helpers";

test("bob receives 100 sats in ark vault after server wallet send", async ({ page }) => {
  test.setTimeout(90_000);
  test.skip(!testSecret, "E2E_TEST_SECRET is required for /test/ark/send");

  await login(page, bobUsername, bobPassword);
  await ensureArkAccount(page, arkWalletPassword);

  // Navigate back to dashboard after account setup
  await page.goto(`/${bobUsername}`);
  await page.waitForLoadState("networkidle");

  const { invoiceId, address } = await createArkInvoiceViaUI(page, arkWalletPassword);
  console.log(`[e2e] Bob ark address: ${address}, invoice: ${invoiceId}`);

  await sendArkFromTestEndpoint(page, address, 100, invoiceId);

  const status = await waitForInvoicePaid(page, invoiceId, 100);
  expect(status.received).toBeGreaterThanOrEqual(100);

  console.log(
    `[e2e] ark invoice ${invoiceId} funded with 100 sats (received=${status?.received || 0})`,
  );
});