|
| 1 | +# Maestro flows for `ethora-sample-swift` |
| 2 | + |
| 3 | +End-to-end smoke tests that drive the SDKPlayground app on an iOS |
| 4 | +Simulator (or a real device) against an Ethora server. Layer 2 of |
| 5 | +the SDK testing strategy — see [`ethora-sdk-swift` README → Testing](https://github.com/dappros/ethora-sdk-swift/blob/main/README.md#testing) |
| 6 | +for the split with hermetic XCTest unit tests. |
| 7 | + |
| 8 | +## Cross-platform parity |
| 9 | + |
| 10 | +The flow YAMLs here mirror the Android sample's flows |
| 11 | +(`ethora-sample-android/.maestro/flows/`) one-for-one, with the |
| 12 | +same numbering and intent. They resolve UI nodes by accessibility |
| 13 | +identifier — the same string IDs Compose's `testTag(...)` uses on |
| 14 | +Android — so a single flow exercises the same intent on either |
| 15 | +platform. |
| 16 | + |
| 17 | +iOS-specific differences from the Android equivalents: |
| 18 | +- `appId: com.ethora.SDKPlayground` (Android uses `com.ethora`) |
| 19 | +- Tab labels are `"Setup"`, `"Chat"`, `"Logs"` in title-case |
| 20 | + (Android uses `"SETUP"`, `"CHAT"`, `"LOGS"` in the segmented |
| 21 | + control) |
| 22 | +- The system search bar (iOS `.searchable`) renders differently |
| 23 | + from Android's RoomListView search; flow `17-search-rooms` |
| 24 | + resolves it via SwiftUI's default search affordance, not via |
| 25 | + the `rooms_search_input` ID |
| 26 | + |
| 27 | +Otherwise the YAMLs are byte-for-byte aligned where they can be. |
| 28 | + |
| 29 | +## Repo layout |
| 30 | + |
| 31 | +``` |
| 32 | +.maestro/ |
| 33 | +├── README.md (you are here) |
| 34 | +├── config.yaml project-level Maestro config |
| 35 | +├── assets/ binary fixtures (test images etc.) |
| 36 | +│ └── test-image.png 8×8 PNG used by 06-attach-file |
| 37 | +├── fixtures/ shared test data (do not commit real credentials) |
| 38 | +│ └── test-users.yaml |
| 39 | +├── scripts/ helpers invoked by flows or by CI before flows |
| 40 | +│ ├── sendAsBob.js Maestro JS helper — POSTs a message as bob |
| 41 | +│ │ via REST, used by 05-receive-text |
| 42 | +│ └── sendPushIntent.sh |
| 43 | +│ adb-equivalent for iOS via xcrun simctl |
| 44 | +│ push, invoked by CI BEFORE 08-push-deep-link |
| 45 | +└── flows/ |
| 46 | + ├── 01-login-email.yaml |
| 47 | + ├── 02-login-jwt.yaml |
| 48 | + ├── 03-list-rooms.yaml |
| 49 | + ├── 04-send-text.yaml |
| 50 | + ├── 05-receive-text.yaml uses scripts/sendAsBob.js |
| 51 | + ├── 06-attach-file.yaml uses assets/test-image.png seeded |
| 52 | + │ into the simulator's Photos library |
| 53 | + │ by CI |
| 54 | + ├── 07-reconnect-airplane.yaml drives reconnect via the Setup |
| 55 | + │ tab's Disconnect button (no shell |
| 56 | + │ dependency) |
| 57 | + ├── 08-push-deep-link.yaml CI runs sendPushIntent.sh first |
| 58 | + ├── 09-logout-relogin.yaml |
| 59 | + ├── 10-switch-app.yaml |
| 60 | + ├── 11-login-wrong-password.yaml |
| 61 | + ├── 13-message-edit.yaml |
| 62 | + ├── 14-message-delete.yaml |
| 63 | + ├── 15-message-reaction.yaml |
| 64 | + ├── 16-create-room.yaml |
| 65 | + ├── 17-search-rooms.yaml |
| 66 | + ├── 18-multi-message-rapid.yaml |
| 67 | + ├── 19-room-info.yaml |
| 68 | + └── 20-offline-pending-resend.yaml |
| 69 | +``` |
| 70 | + |
| 71 | +(Flow 12 reserved for typing-indicator — needs a `sendAsBob`-style |
| 72 | +helper for XMPP composing-state.) |
| 73 | + |
| 74 | +## Running locally |
| 75 | + |
| 76 | +1. Install Maestro: `brew install maestro` (or `curl -fsSL https://get.maestro.mobile.dev | bash`). |
| 77 | +2. Boot a Simulator and install the app: |
| 78 | + |
| 79 | + ```bash |
| 80 | + ./generate_xcodeproj.sh # if SDKPlayground.xcodeproj is stale |
| 81 | + xcodebuild -project SDKPlayground.xcodeproj \ |
| 82 | + -scheme SDKPlayground \ |
| 83 | + -destination 'platform=iOS Simulator,name=iPhone 15' \ |
| 84 | + -configuration Debug \ |
| 85 | + -derivedDataPath build/ |
| 86 | + xcrun simctl install booted \ |
| 87 | + build/Build/Products/Debug-iphonesimulator/SDKPlayground.app |
| 88 | + ``` |
| 89 | + |
| 90 | +3. Populate `SDKPlayground/PlaygroundSession.swift`'s defaults via |
| 91 | + `npx @ethora/setup` against your QA app — same flow as Android. |
| 92 | +4. Run a single flow: |
| 93 | + |
| 94 | + ```bash |
| 95 | + maestro test .maestro/flows/01-login-email.yaml |
| 96 | + ``` |
| 97 | + |
| 98 | + Or all flows: |
| 99 | + |
| 100 | + ```bash |
| 101 | + maestro test .maestro/flows |
| 102 | + ``` |
| 103 | + |
| 104 | +## Running in CI |
| 105 | + |
| 106 | +`.github/workflows/maestro.yml` runs the suite on every push, PR, |
| 107 | +and SDK release tag on a macOS runner with an iOS Simulator. |
| 108 | + |
| 109 | +## Coverage table |
| 110 | + |
| 111 | +What each flow proves end-to-end against `chat-qa.ethora.com`. |
| 112 | +Identical to the Android sample's coverage table — the same 19 |
| 113 | +flows, the same regression classes, same expected assertions. |
| 114 | + |
| 115 | +| # | Flow | Asserts | Catches | |
| 116 | +|---|------|---------|---------| |
| 117 | +| 01 | `login-email` | Email + password → connected | Wrong app token, broken `/users/login-with-email` shape | |
| 118 | +| 02 | `login-jwt` | Custom JWT → `/users/client` accepts | `TOKEN_WRONG_TYPE`, missing JWTLoginConfig wiring | |
| 119 | +| 03 | `list-rooms` | After login, room list renders | `GET /chats/my` regression, unread-count desync | |
| 120 | +| 04 | `send-text` | Send round-trips and renders the bubble | XMPP BIND-result match, ConnectionStore stuck CONNECTING | |
| 121 | +| 05 | `receive-text` | Bob's REST-sent message arrives via XMPP | MAM subscription missing, XMPPClient duplication | |
| 122 | +| 06 | `attach-file` | Pick from gallery → upload → image bubble | Upload 401 (wrong auth), MIME rejection | |
| 123 | +| 07 | `reconnect-airplane` | Disconnect → Connect → history survives | XMPP client not torn down, banner stuck | |
| 124 | +| 08 | `push-deep-link` | Synthetic notification → right room | Intent extras lost, room JID URL-decoded wrong | |
| 125 | +| 09 | `logout-relogin` | Full logout → re-login same user → state isolated | Persisted state leaking across sessions | |
| 126 | +| 10 | `switch-app` | App A → App B in-process | Store not flushed, XMPP client persisting wrong-app JID | |
| 127 | +| 11 | `login-wrong-password` | 401 surfaces as error, form remains editable | Error suppressed, retry loop | |
| 128 | +| 13 | `message-edit` | Long-press → Edit → bubble updates | edit prop not flowing, optimistic-update reconciliation | |
| 129 | +| 14 | `message-delete` | Long-press → Delete → bubble gone or tombstoned | Delete RPC silently failing, MAM still returning deleted | |
| 130 | +| 15 | `message-reaction` | Long-press → React → emoji + count visible | Reaction not stored, picker missing presets | |
| 131 | +| 16 | `create-room` | "+" → Create dialog → new room visible + writable | Create-room RPC silent failure, JID collision | |
| 132 | +| 17 | `search-rooms` | RoomListView SearchBar narrows + restores list | Predicate not case-insensitive, list not re-rendering | |
| 133 | +| 18 | `multi-message-rapid` | 5 back-to-back sends all visible in order | Out-of-order ack reorder, optimistic UI dropping bubbles | |
| 134 | +| 19 | `room-info` | Room info → participants + leave control | `GET /chats/:jid/details` regression | |
| 135 | +| 20 | `offline-pending-resend` | Disconnect → send → reconnect → message lands | Send dropped silently, sendFailed never clearing | |
| 136 | + |
| 137 | +## Why some helpers live outside the flow YAML |
| 138 | + |
| 139 | +Maestro's JS runtime can drive HTTP (`http.post(...)`) but can't |
| 140 | +shell out — anything that needs `xcrun simctl` (synthetic push |
| 141 | +intents, pushing files into the Photos library, network simulation) |
| 142 | +is invoked from the CI workflow before/after the flow runs. The |
| 143 | +flow then asserts on the resulting state. |
| 144 | + |
| 145 | +## Authoring a new flow |
| 146 | + |
| 147 | +- Use accessibility-identifier anchors (`id: "chat_input"`) over |
| 148 | + text matching where possible — labels move under localization / |
| 149 | + copy edits, IDs don't. |
| 150 | +- Keep each flow under ~30 lines. If you need more, split it. |
| 151 | +- Pull credentials from `fixtures/` rather than inlining them. |
| 152 | +- Always end with at least one `assertVisible` / `assertNotVisible` |
| 153 | + so a flow that silently no-ops fails loudly. |
| 154 | + |
| 155 | +When a regression slips through Layer 1 unit tests, add a flow for |
| 156 | +it in the same PR as the fix. |
0 commit comments