Skip to content

Expand Playwright suite with auth-flow + chat-component testid scaffold#101

Merged
derensdima22 merged 2 commits into
devfrom
tf/playwright-chat-flows
May 12, 2026
Merged

Expand Playwright suite with auth-flow + chat-component testid scaffold#101
derensdima22 merged 2 commits into
devfrom
tf/playwright-chat-flows

Conversation

@phwizard
Copy link
Copy Markdown
Member

Summary

Expands the e2e Playwright suite from 3 public-page smoke tests to 9 (3 existing + 3 runnable new + 3 fixme'd stubs). Establishes single-source-of-truth testid constants matching Android `*TestTags` and iOS `*AccessibilityID`, so Playwright resolves the same chat-component nodes that mobile Maestro flows do.

Files

  • `tests/e2e/_chatComponentTestIds.ts` (new) — local mirror of `@ethora/chat-component`'s public testid constants (`ChatInputTestIds`, `MessageBubbleTestIds`, `RoomListTestIds`, `AuthTestIds`). Once chat-component PR #71 lands and a version >= 26.3.18 publishes, swap to `import from '@ethora/chat-component'`.
  • `tests/e2e/auth-flows.spec.ts` (new) — 3 runnable tests covering the host's own login form (validation + POST body shape).
  • `tests/e2e/chat-flows.spec.ts` (new) — 3 `test.fixme`-flagged stubs covering chat-component flows (room list mount, send text, attach button visible). Each stub references the right testid constants and has a body showing the expected flow.

Cross-platform parity (now four-way)

testid This repo chat-component Android iOS
`chat_input` `ChatInputTestIds.inputField` same `ChatInputTestTags.INPUT_FIELD` `ChatInputAccessibilityID.inputField`
`chat_send_button` `ChatInputTestIds.sendButton` same `ChatInputTestTags.SEND_BUTTON` `ChatInputAccessibilityID.sendButton`
`rooms_list` `RoomListTestIds.roomsList` same `RoomListViewTestTags.ROOMS_LIST` `RoomListAccessibilityID.roomsList`
`room_row` `RoomListTestIds.roomRow` same `RoomListViewTestTags.ROOM_ROW` `RoomListAccessibilityID.roomRow`
`chat_message_image` `MessageBubbleTestIds.mediaContent` same `MessageBubbleTestTags.MEDIA_CONTENT` `MessageBubbleAccessibilityID.mediaContent`

A Maestro YAML using `id: "chat_input"` and a Playwright test using `[data-testid="chat_input"]` now resolve to the same intent on Android, iOS, and Web.

Pre-existing issue flagged

The existing `smoke.spec.ts` tests fail locally on `dev` — the app boots into a loading-spinner state because some API call beyond `/v1/apps/get-config` isn't mocked (likely a chat-component SDK boot fetch added in a recent bump). Not introduced by this PR. The new `auth-flows.spec.ts` tests will fail in the same way until that root cause is addressed (probably one extra route mock).

Once that's resolved, the 3 new auth-flow tests pass on their merits, and the 3 chat-flow stubs unfreeze as we wire post-login bootstrap mocks (or add a `PLAYWRIGHT_REAL_BACKEND=1` mode pointing at `chat-qa`).

Test plan

  • `npx playwright test --list` discovers all 9 tests across 3 files.
  • After the boot-path fix, `npx playwright test auth-flows` passes 3/3.
  • After post-login bootstrap mocks are wired, the 3 `test.fixme` stubs in `chat-flows.spec.ts` can be promoted to `test()` and exercise chat-component testid resolution end-to-end.
  • Once chat-component publishes a version with testids in its public API, swap the inline constants in `_chatComponentTestIds.ts` for an `import from '@ethora/chat-component'`.

Companion PRs

  • `ethora-chat-component` PR #71 — exposes `testIds` from `src/main.ts` so this repo can drop its local mirror.
  • `ethora-sdk-android` PR #4 — Compose `testTag` modifiers using the same string IDs.
  • `ethora-sdk-swift` PR #6 — SwiftUI `accessibilityIdentifier` modifiers using the same string IDs.

phwizard added 2 commits May 10, 2026 18:08
…tIds

Three new files under tests/e2e/, expanding coverage from the
existing 3-test public-page smoke suite. None of the new tests
modify host source code — they observe what's already there.

tests/e2e/_chatComponentTestIds.ts (new)
  Local mirror of @ethora/chat-component's public testid constants
  (ChatInputTestIds, MessageBubbleTestIds, RoomListTestIds,
  AuthTestIds). The chat-component package exports these via its
  src/main.ts in
  dappros/ethora-chat-component#71;
  once that lands and a version >= 26.3.18 publishes, swap the
  inline definitions for an `import from '@ethora/chat-component'`.
  Until then, the local mirror keeps this PR landable
  independently of the upstream merge.

  String values match Android's *TestTags Kotlin objects (in
  ethora-sdk-android's chat-ui module) and iOS's
  *AccessibilityID Swift enums (in ethora-sdk-swift's
  XMPPChatUI/AccessibilityIdentifiers.swift), so a Playwright
  test using `[data-testid="chat_input"]` exercises the same
  intent as a Maestro flow with `id: "chat_input"` on either
  mobile platform. Three platforms, one selector contract.

tests/e2e/auth-flows.spec.ts (new)
  Three runnable tests against the host's own login form (the
  one in src/pages/AuthPage/Login/Steps/LoginForm.tsx, distinct
  from chat-component's <Login> for embed scenarios):
    - login form rejects empty submit with required-field validation
    - login form rejects invalid email format with regex error
    - login form posts to /v1/users/login-with-email on valid input

  Mocks /v1/apps/get-config with the same fixture shape as
  smoke.spec.ts. The third test intercepts the login POST,
  asserts the body has the right email + password, then replies
  401 to short-circuit the post-login bootstrap chain (which
  would need /me, /apps/get-config-by-token, /chats/my, etc.
  mocked too). Behavior we want — "submit fired with the right
  body" — is observed before that complexity matters.

tests/e2e/chat-flows.spec.ts (new)
  Three test.fixme()-flagged stubs for chat-component coverage:
    - mounts the room list when the user lands on /app/chat
    - send a message via the chat input
    - attach button is visible and enabled when media is allowed

  Each stub references the right testid constants, has a brief
  body showing the expected flow, and is left fixme until the
  post-login bootstrap mocks are wired (or the suite gains a
  PLAYWRIGHT_REAL_BACKEND=1 mode that points at chat-qa). The
  shape and selector anchors are in place so filling each in
  is a mechanical follow-up.

Pre-existing concern flagged: the dev branch's existing smoke
tests (smoke.spec.ts) currently fail locally — the app boots
into a loading-spinner state because some non-/v1/apps/get-config
API call isn't mocked. This PR doesn't fix that (out of scope),
but the auth-flows tests will fail in the same way until the
underlying boot-path issue is resolved. Once that's addressed
(probably another mock route for whatever endpoint changed),
the auth-flow tests should pass on their own merits.
Expands the Browser Smoke Tests section with what each new spec
covers + a cross-platform testing overview table showing how this
repo's Playwright e2e layer is the Web Layer 2 counterpart to
Maestro on mobile.

Selector contract: [data-testid='chat_input'] here resolves the
same intent as id: 'chat_input' in any Maestro flow. The testid
constants in tests/e2e/_chatComponentTestIds.ts mirror the public
testIds exported by @ethora/chat-component.
@derensdima22 derensdima22 merged commit a46cc66 into dev May 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants