aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-27 15:24:13 -0800
committerAdam Soltys <[email protected]>2026-02-27 15:24:13 -0800
commit16da2cb00d16f87d02535bfdae815f83f19f251f (patch)
tree2e6d003975d5a7a67cc81243da4a59bc476fff48 /test
parent11fbf552ebbb9d1d5ae6823893ee80ae23f450a0 (diff)
downloadcoinos-ui-16da2cb00d16f87d02535bfdae815f83f19f251f.tar.gz
coinos-ui-16da2cb00d16f87d02535bfdae815f83f19f251f.zip
fix race condition
Diffstat (limited to 'test')
-rw-r--r--test/e2e/register-ark-receive.spec.ts53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/e2e/register-ark-receive.spec.ts b/test/e2e/register-ark-receive.spec.ts
new file mode 100644
index 00000000..abfc64c0
--- /dev/null
+++ b/test/e2e/register-ark-receive.spec.ts
@@ -0,0 +1,53 @@
+import { expect, test } from "@playwright/test";
+
+/**
+ * Registers a brand-new user via the two-step register flow,
+ * creates an Ark vault, then clicks Receive on the Ark card
+ * and verifies navigation to /invoice.
+ */
+test("register new user, create ark vault, click Receive", async ({ page }) => {
+ test.setTimeout(60_000);
+
+ const username = `test${Date.now()}`;
+ const password = "testpass123";
+
+ // ── Step 1: /register — pick username ──
+ await page.goto("/register");
+ await page.waitForLoadState("networkidle");
+
+ const usernameInput = page.locator('input[name="username"]');
+ await expect(usernameInput).toBeVisible({ timeout: 5_000 });
+ await usernameInput.fill(username);
+
+ const continueBtn = page.locator("button.btn-accent", { hasText: "Continue" });
+ await continueBtn.click();
+
+ await page.waitForURL(/\/register\/auth\?/, { timeout: 10_000 });
+
+ // ── Step 2: /register/auth — register with password ──
+ const passwordInput = page.locator('input[name="password"]');
+ await expect(passwordInput).toBeVisible({ timeout: 5_000 });
+ await passwordInput.fill(password);
+
+ const registerBtn = page.locator("button.btn-accent[type='submit']");
+ await registerBtn.click();
+
+ await page.waitForURL(new RegExp(`/${username}(?:[/?#]|$)`), { timeout: 30_000 });
+
+ // ── Step 3: Create Ark vault ──
+ await page.goto("/account/ark");
+ await page.waitForURL((u) => !u.pathname.includes("/account/ark"), { timeout: 30_000 });
+
+ // ── Step 4: Click Receive on Ark card ──
+ await page.goto(`/${username}`);
+ await page.waitForLoadState("networkidle");
+
+ const arkCard = page.locator('[data-testid="account-card"][data-account-type="ark"]');
+ await expect(arkCard.first()).toBeVisible({ timeout: 10_000 });
+
+ const receiveBtn = arkCard.first().getByTestId("account-receive");
+ await receiveBtn.click();
+
+ await page.waitForURL(/\/invoice\/[^/?#]+/, { timeout: 15_000 });
+ expect(page.url()).toContain("/invoice/");
+});