diff options
| author | Adam Soltys <[email protected]> | 2026-03-05 15:05:37 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-03-05 15:51:36 -0800 |
| commit | 4c519faaf748cea25f9d0be87dd0f3e09d7bae4c (patch) | |
| tree | 1fbda1930d8a8f8d6d03871274105dbfb7e1caa8 /test/e2e/dm-subscribe.spec.ts | |
| parent | 4a74d51e92365a731a2e5322783b88a39e14f046 (diff) | |
| download | coinos-ui-4c519faaf748cea25f9d0be87dd0f3e09d7bae4c.tar.gz coinos-ui-4c519faaf748cea25f9d0be87dd0f3e09d7bae4c.zip | |
android hce nfc
Diffstat (limited to 'test/e2e/dm-subscribe.spec.ts')
| -rw-r--r-- | test/e2e/dm-subscribe.spec.ts | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/test/e2e/dm-subscribe.spec.ts b/test/e2e/dm-subscribe.spec.ts index abc7c293..b2f7d6fa 100644 --- a/test/e2e/dm-subscribe.spec.ts +++ b/test/e2e/dm-subscribe.spec.ts @@ -81,22 +81,27 @@ test("recipient receives DM via relay subscription in real-time", async ({ brows await bobPage.goto(`/messages/${alicePubkey}`); await bobPage.waitForLoadState("domcontentloaded"); + // Wait for textarea to become enabled (canSend=true after relay query) const bobTextarea = bobPage.locator("#message-contents"); - await expect(bobTextarea).toBeVisible({ timeout: 15_000 }); + await expect(bobTextarea).toBeEnabled({ timeout: 15_000 }); - const sendButton = bobPage.locator("#send-message"); - await expect(sendButton).toBeEnabled({ timeout: 5_000 }); - - // --- Bob sends a message --- + // --- Bob sends a message (fill text first, then button enables) --- const testMessage = `realtime-test-${Date.now()}`; console.log(`[bob] Sending: ${testMessage}`); await bobTextarea.fill(testMessage); + const sendButton = bobPage.locator('button[aria-label="Send"]'); + await expect(sendButton).toBeEnabled({ timeout: 5_000 }); await sendButton.click(); await expect(bobTextarea).toHaveValue("", { timeout: 15_000 }); - console.log("[bob] Message sent"); + console.log("[bob] Message sent (textarea cleared)"); - // Verify Bob's relay accepted the events - const bobAccepts = bobWsFrames.filter((m) => m.includes('"OK"') && m.includes(",true,")); + // Wait for relay to accept events (publish is async after textarea clears) + let bobAccepts: string[] = []; + for (let i = 0; i < 30; i++) { + bobAccepts = bobWsFrames.filter((m) => m.includes('"OK"') && m.includes(",true,")); + if (bobAccepts.length > 0) break; + await bobPage.waitForTimeout(500); + } console.log(`[bob] Relay accepted ${bobAccepts.length} events`); expect(bobAccepts.length, "Relay should accept at least 1 event").toBeGreaterThanOrEqual(1); |
