Keybase E2E Flow Tests
Overview
Two harnesses, one shared testID registry. Implement each flow on Electron and iOS together.
Shared testID Registry
shared/tests/e2e/shared/test-ids.ts — single source of truth for all testID values.
Adding a testID to a component:
import * as TestIDs from '@/tests/e2e/shared/test-ids'
// ...
<Kb.ScrollView testID={TestIDs.SETTINGS_ADVANCED}>
Rule: Add testID prop to an already-existing element (input, scroll view, pre-existing wrapper). Never add a new container just to attach a testID.
Desktop — Playwright
| What | Where |
|------|-------|
| Test files | shared/tests/e2e/electron/flows/*.test.ts |
| Nav helpers | shared/tests/e2e/electron/helpers/navigate.ts |
| Run all | yarn test:e2e:desktop |
| Run branch | yarn test:e2e:desktop:branch |
Navigation helpers: navigateToChat, navigateToFiles, navigateToTeams, navigateToGit, navigateToSettings, navigateToPeople, navigateToCrypto, navigateToDevices
Common pitfall — hidden nav stack elements: React Navigation keeps prior screens mounted but hidden. getByTestId(X) may match 2+ elements (one hidden, one visible), causing Playwright strict-mode failures. Fix: use a selector unique to the destination screen rather than one shared with the source screen. Example: after navigating into a Files subfolder, the root screen's files-browser is still in the DOM but hidden — check for the Filter textbox instead, which only exists in subfolder views.
Desktop release gate
The gate's code lives in tests/e2e/shared/gate/ (shared with the iOS gate); its lists stay in tests/e2e/electron/.
yarn test:e2e:desktop:release (from shared/, about 45 min) runs everything and exits 1 on any failure, a flaky or skipped flow test included (retries stay at 1, so a flake shows as flaky: <test>).
- Env: accounts come from
~/.config/keybase-e2e/env(mode 600, its dir 700;yarn test:e2e:accounts:setupfills in the peers); the environment wins over the file, and the run hands its children the account names (never paper keys).KB_E2E_TEST_ACCOUNT_PREFIXis the prefix every test account's name starts with: setup's repair of a block flow's leftovers writes only to accounts that have it, and refuses without it;accounts:setup --checkreports it missing only when there is something to repair. Like every account name, it lives only in the env file.KB_LEGACY_USER(optional) names an older account signed in on the host's service and in the phone's app that holds what a new account cannot get (a Stellar wallet); it has no peer, a flow switches the app to it withasLegacy(page, f)only to read that state, and a flow that needs it fails naming the variable when it is unset. The main service must already be signed in asKB_SMOKE_USER(every flow test checks it again before it runs), and KBFS must answerkeybase fs ls /keybase/private/$KB_SMOKE_USER; the FUSE mount itself is manual-only. The command never switches, stops or starts the main service or its components, and refuses with the command to run instead. - Peers: the other accounts run in their own
keybase --homeservices; the command starts them if they are down and leaves them running. - Phases: preflight (release lock
/tmp/kb-e2e-release.lock, one run at a time; account, ports 4000/9222, visual gate lock, an unlocked macOS session (a locked one refuses the window the native fullscreen the video flows need, so keep it unlocked for the whole run), KBFS, peers,accounts:setup --check) → launch the app → sweep leftovers once →electron-flows(light only) → relaunch with--visualandvisual:render→ census → report. It stops the app it launched at the end or on Ctrl-C. - Outputs (
shared/tests/results/):electron-report.html(flows, then tour entries, failures first),census.md(routes, windows and write RPCs no run reached; the windows besides the main one are listed by hand intests/e2e/electron/census-windows.tsand credited by theirwindow/*tour entries),manual-checklist.md(what to do by hand),watchdog.log(written only when the renderer went blank, which fails the run), plus one summary line per phase and a macOS notification. - Known failures:
tests/e2e/electron/known-failures.tslists failures seen on master with their cause. They still fail the run; the report labels them "known on master", and says "now passes — remove it" when one passes. - Knobs:
KB_E2E_RELEASE_ONLY=<grep>runs only matching flows and thesettings/*tour entries (to try the command; the census then reports gaps),KB_E2E_RELEASE_TIMEOUT_MIN(default 150),KB_E2E_NO_OPEN=1.
Desktop flow rules
Running while you change things: run one test at a time with yarn test:e2e:desktop:flows <file> --grep '<title>', once. Use --repeat-each=N --retries=0 only on the ONE test whose flake fix you are proving. The full release runs at the end of a change, never between edits. A test stuck for more than about 5 minutes without clear progress gets reported with evidence, not dug into.
Accounts and names: every flow runs on the test accounts from ~/.config/keybase-e2e/env (loadE2EEnv() / loadE2EAccounts()). Never put an account, team, password or paper key in the repo, a step name, an error or a log line. Team writes go only in KB_E2E_TEAM or a stamped subteam. Rows are found by exact name (inboxRow(page, title), openE2ETeam, openE2EChannel), never "first row".
Stamped names: everything a flow creates carries the run id (e2eRunId(), accounts/run-id.ts), so the sweeper can find what a run left behind:
- channels, repos, emails, KBFS entries, devices:
stampedChannelName(label, runId)→e2e-<runid>-<label>, label[A-Za-z0-9_-]. Emails aree2e-<runid>-<label>@example.com. - message bodies and titles: `
e2e-${e2eRunId()}-…`. - teams:
stampedTeamName(label, runId)→e2e<runid><label>, label[a-z0-9_]with no double underscore. - emoji:
stampedEmojiName(label, runId)→e2e_<runid>_<label>, label[a-z0-9]. An alias the service renames on a clash (a#Nsuffix) is no longer recognised as stamped, so pick labels unique within the run. - a new kind of object needs a sweep rule in
accounts/sweep-lib.tstoo.yarn test:e2e:accounts:sweep --dry-runright after a run may list only that run's stamped chat messages (flows leave what they post for the next sweep, which deletes them by run stamp); anything else it lists, from that run or older, is a failure: every other object a flow makes it removes itself.
Helpers (tests/e2e/electron/helpers/, tests/e2e/shared/):
asSecond(page, f)runsfwith the app (and so the main service) switched to the second account through the account switcher, and switches back whetherfpassed or threw.signedOutThenBack(page, f)runsfon the login screen and signs smoke back in.restoreToSmoke(page)is the recovery both use. Any flow that switches accounts or signs out must end on smoke (requireMainIsSmoke).dropFiles(page, target, paths)drops real files onto an element;pasteFilespastes an image (the main process's clipboard read is stubbed). UsedropFilesor Playwright'sfilechooserevent for avatar and emoji pickers: they open a Chromium file chooser, not an Electron dialog.connectMainProcess()reaches the Electron main process through its Node inspector:stubOpenDialog/stubSaveDialog,recordNotifications/takeNotifications,openUrl(akeybase://link as the OS hands it),recordExternalUrls/takeExternalUrls(stubsshell.openExternal),clipboardText,dropServiceSocket(callers assert the count is above 0). Every stub in the main process, whoever left it, is restored after each test and before the inspector closes.openRemoteWindow(context, main, name, props)opens a remote window (menubar, tracker, pinentry, unlock-folders) and returns its page once its props have rendered; close it withcloseRemoteWindow.expectPersists(page, read, expected, what)reloads the renderer, thenreadnavigates back and reads the value. Use it for every "survives a reload" claim.mainRpc(method, arg)sends one RPC to the main service after checking it is on smoke;mainRpcAsSecondthe same insideasSecond. They are for setup, read-backs and restores only.CORPUS/TEXT_CORPUS(tests/e2e/fixtures/corpus/corpus.ts) are the checked-in files and texts flows attach, drop and paste. Flows never send large data: an action that only runs while a transfer or job is in flight (cancel a download, delete an upload, pause a backup) is covered by a unit test of the real component, not by making the transfer slow. The one exception is iOS save-photos' cancel of a large image (about 43MB): the phone's menu opens in a bottom sheet the unit tests can't render, so that cancel is tested end to end.openMenu(page, trigger, item, what)opens every popup menu: the popup drops a show or hide within 100ms of its last one, so it waits that out, clicks once, fails if the menu does not open, and waits it out again before the pick. Any other show or hide right after one (an outside click to close) goes afterwaitOutPopupDebounce(page).retriedNavigation(what, attempt, opts)is the only retry loop for getting somewhere (a list that redraws under the click, a search slow to find something new); it puts the try count on the test as aretriedannotation. An asserted action is never retried: wait for its precondition (waitSteady(locator, what)for a row that must stop being replaced,waitEnabledSteady(button, what)for a button whose inputs reload) and press once.step(...)at every state change;manualEdge(page, testInfo, id)where a person takes over (the id is aMANUAL_ONLYentry inmanual-only.ts).
Coverage counts only from the app's UI. Setup and read-back through the CLI, the peers or mainRpc are fine, but a census item is closed only when the app sends it. Every new write RPC in protocol/bin/enabled-calls.json, route or window needs a flow (or a tour entry, for routes and windows) or an entry in census-exclusions.ts with a real reason (manual-only: <id> names a MANUAL_ONLY entry). The census fails on an exclusion that is no longer needed, so remove it once a flow covers the item.
Assertions: check the outcome (the row, the setting after a reload, a CLI or peer read-back), never only "the modal opened". A flow that changes a setting reads it first and restores it in finally; a failed restore fails the test. No silent skips (test.skip, conditional early returns): missing setup fails and names what is missing. No blind retries, longer sleeps or soft-passes: retries stay at 1 and a flaky test counts as a failure, so find the cause.
Known failures: a deterministic app or service bug on master gets a strict test of the default user path that fails, plus an entry in known-failures.ts keyed <file> › <describe…> › <title> with its cause. The run still fails, and the report labels it "known" (check that it does: a key that does not match shows as a new failure). When the bug is fixed the report says "known now passes" and the entry is removed. A route-around for the rest of the coverage is a separate test, never a replacement. A strict failing test never goes in a serial describe: its failure and retry would rerun or taint the rest of the group.
Secrets: a password, paper key or provisioning phrase is typed only through submitSecret / secret-input.ts, which type through the main process and read back lengths only, so no Playwright action, assertion, trace or failure snapshot ever holds the value. A file that types a secret sets test.describe.configure({retries: 0}) and test.use({trace: 'off'}). The secret-scan reporter (secret-scan-reporter.ts, and the release's secrets phase) scans every artifact for the env file's secrets, every second-account password the env file held during the run included (the start value, a KB_SECOND_PASSWORD_NEXT, the promoted one; kept in memory only), deletes any file that holds one and fails the run. insertSecret types only into a focused element matching its selector.
The second account's password is the harness's own: KB_SECOND_PASSWORD in the env file, a random value set by yarn test:e2e:accounts:second-password. Read it only with requireSecondPassword. A change goes through rotateSecondPassword: the new value is written as KB_SECOND_PASSWORD_NEXT first, then set, then checkSecondSecretSurvives (repaired once with repairSecondSecret on failure) and only then promoted. A leftover KB_SECOND_PASSWORD_NEXT stops every password flow until the owner checks which value the server holds; never edit the env file by hand. After a file signs second in through the app, or does anything as second that can drop its stored secret, its afterAll runs checkOrRepairSecondSecret(env, requireSecondPassword(env), appRepairDeps(_electronPage)) and its afterEach runs restoreToSmoke. Such a file holds only those tests, so the rest of its area keeps traces and retries. The smoke account's password is never touched.
Paper keys and devices: a paper key a flow makes is recorded in the paper-key ledger (accounts/paper-key-ledger.ts: run id, device id and name, never the words) with recordPaperKey, and removed with forgetPaperKey once revoked; the sweeper revokes only ledger entries. A provisioned device is a new peer home homes/prov-<runid> with the file secret store, stopped with ctl stop --shutdown before it is revoked. Nothing provisions the main service.
iOS gate harness
The iOS release gate's flows run through shared/tests/e2e/ios-appium/gate.test.ts (specs wired in wdio.gate.conf.ts); its helpers are in tests/e2e/ios-appium/gate/, and the gate core it shares with desktop in tests/e2e/shared/gate/.
- Run:
yarn test:e2e:ios:flows(fromshared/). Results go totests/results/ios-report/(a Playwright-format json plus per-attempt records), project nameios-flows.KB_E2E_RELEASE_ONLY=<grep>runs only matching tests. Retries are 1; a flake is a failure, as on desktop. gate/step.ts:step(name, opts),manualEdge(id)(aMANUAL_ONLYentry) andretriedNavigation(what, attempt, opts), same contracts as desktop. A step on the inbox, or on a screen listing the account's other conversations or people (the inbox filter's results, the forward picker, the new-chat team builder), takes{screenshot: false}(its name only): those hold conversations and users that are not test ones. Failure screenshots stay in the local results, as on desktop.gate/errors.ts: console errors and uncaught errors (thrown, or an unhandled promise rejection) from the app, captured from a test's start (beginErrorCapture/takeErrors); an uncaught one fails the test.appLogTailadds the app log to a failure.gate/accounts.ts:asSecond(f),signedOutThenBack(f),restoreToSmoke(),requireAppIsSmoke(); every one ends on the smoke account.gate/secret-input.ts:submitSecret(fieldTestID, secret), plusfocusSecretField,emptySecretField,fieldLength; failures never carry the value.gate/device.ts: simulator helpers (openLink,pushNotification,setLocation/clearLocation,setPasteboard,grantPrivacy/restorePrivacy,ensurePhotoCorpus,toBackground/toForeground) andrelaunchApp(), which terminates and launches the app and waits for its new JS runtime with error capture and the app-log capture running again.launchedBy(deliver)terminates the app and letsdeliver(a link, a tapped banner) launch it, never launching it itself; a cold launch is then proved by the new runtime's first recording (startRoutes), since the app-log capture can't hold what it logged before it was installed. In a flow'safterEach,launchIfGone()(simctl and reads only) brings back an app a test left terminated; one that doesn't come back poisons the gate.openLink's errors never hold the link. What changes the phone beyond the app runs only againstKB_IOS_UDID(the release command sets it to the udid preflight proved booted) and nameskeybase.ios:grantPrivacy(service)(location,location-always,photos,photos-add; never contacts) reads the original first (photos from the simulator'sTCC.db, location from locationd'sclients.plist), refuses one it can't put back, and returns the token a flow-levelafterEachhands toawait restorePrivacy(token)(simctl and reads only, once, read back over a few seconds; a failed restore poisons the gate). A photos or photos-add grant or reset kills the app; a location one doesn't: a photos restore that ran waits out that kill, so thelaunchIfGoneafter it brings the app back. The release refuses a phone whose location for keybase.ios was ever asked.ensurePhotoCorpus()adds the corpus's photos and videos once per simulator data (recorded in~/.config/keybase-e2e/ios-photo-corpus.jsonwith the simulator data directory's creation time, so an erase adds them again); nothing else may grow the library. Pick an item and prove it by read-back, never by grid position.- Save to Photos read-backs need full photo access, which no simctl grant gives (PhotoKit reads
simctl privacy grant photosas undetermined, and a library query then reads empty): a flow takesgrantPrivacy('photos-add')andgrantPrivacy('photos')(their tokens put both back: iOS then holds Photos in place of PhotosAdd), thensystem-ui.tsgrantFullPhotoAccess()has the app ask and taps the system prompt's Allow Full Access (credits nothing; the user-facing prompts stay manual-only). With it, a flow reads only the library's asset ids (app-ask.tslibraryAssetIds,assetInfo) and proves a save by the one id that was not there before (gate/save-photos-lib.ts; never the newest by date: a saved file keeps its own date, which can tie with the corpus's), then deletes exactly that id withdeleteSavedPhoto(id, before)(refuses an id the library held before the test, taps iOS's Delete confirm once it has settled, reads it back gone). A deleted photo sits in the library's Recently Deleted for 30 days (the OS delete; the library a query reads does not hold it, so it is no per-run growth there). A photo a flow saved and could not delete poisons the gate. seedDocumentFolder(label, names)makes a folder of this run (e2e-<runid>-<label>-<hex>) in the Files app's On My iPhone holding corpus files, for the document picker; the flow's afterEach removes it (removeSeedFolder, read back).pushNotification({convID, uid, body: e2eMarker('push-…')}): it builds the one payload it sends, achat.newmessage, never a silent type; the payload file is mode 600 under/tmp/kb-e2e, removed after.gate/app-log.ts: the app's logger lines, captured in its JS runtime (appLogMark(),appLogSince(mark)); neverstart.logormetro.log. A "didn't happen" read usesappLogUntilMarker(mark, label), which logs a stamped marker through the app's logger and reads only the lines before it.gate/system-ui.ts:findBanner(body)(bounded: undefined after its deadline),tapBanner(body), andwithNotificationCenter(fn), which opens it, runsfn, clears this run's notifications and closes it (a failure poisons the gate). The system pickers:pickFromLibrary(names)selects corpus items in the photo picker (its cells carry only a kind and a date and its search finds no file name, so the corpus is the one run of cells sharing a date ingate/picker-lib.tsLIBRARY_GRID_ORDER; cells are tapped at their frames, the selection read back before the confirm),pickOnePhoto(name)taps one corpus photo in the photos-only, single-pick picker an avatar or an emoji opens (it shows no videos, so the corpus is the run inLIBRARY_PHOTO_ORDER, and it hands the photo over on the tap, with no confirm),pickDocument(folder, file)opens On My iPhone > a seed folder in the document picker and opens the file, and a flow's afterEach runscloseSystemPickers()(escapeToTabs can't leave a document picker holding a selection; a failure poisons the gate). A pick is proven by what the app was handed:pickedFiles(urls)(a titles screen's paths) orpickerCacheFile(cache, name)(an upload keeps the copy's name) read the copy in the app's picker cache; a chat library pick is the corpus file byte for byte, a Files upload's library copy is re-encoded, so no hash ties it to the corpus: match it withimagePropsby the format its bytes say and its pixel size together (the corpus png, jpg and heic are all 64x48, and the copy's file extension is only the picker's naming), a document pick is the file itself; an avatar's or emoji's pick is read off the screen withhelpers/profile.tspickedImagesShown()(the picker-cache images it draws: exactly one) and matched as a Files upload's. The flow creditsphoto-picker/file-pickerafter that read. Push permission is the owner's one-time grant: the release refuses without it, and no flow asks for it (asking opens the Settings app).- Device helpers:
shared/devices.ts'srequireRevocableFromPhone(env, device, phoneDeviceID)is the guard before any revoke from a phone flow: it refuses unless exactly one active device carries the expected name and it is not the host service's device, the env file's protected paper key or the phone's own device (an empty phone id is refused), and a flow's cleanup (revokeLeftoverFromPhoneFlow) goes through it too.gate/accounts.ts'sphoneDeviceId()(andphoneDevice()for the name) reads the phone's own device from the app over Metro, since the host'skeybaseCLI knows only the host's device. Pass it to the guard; never revoke by name alone. - Paper keys: a flow that makes a paper key revokes it in the same test. While the words are on screen the flow takes no
step()and no screenshot (nothing hides them there), the paper key is ledgered the moment the service lists it, and its cleanup revokes whatever the run made, relaunching the app if the paper key screen is still up. A paper key is read from the screen only to be revoked; no real paper key is ever submitted. A paper key's device name is the first two words of its phrase, so it goes into no error, step or log: the device helpers take it as{name, label}and say only the label, and replace the name with the label in any error from under them. That masking covers the errors wdio and Appium raise, not their logs: it relies on wdio'slogLevel: 'warn'and on Appium running with nologPath, since a debug log records every selector, and a selector names the key. The app's dev RPC log redacts a paper key device's name, and every iOS run's secret scan (the flow run's, and the release's secrets phase) also looks for the names of the paper keys its own run made (KB_E2E_SCAN_PAPER_KEY_NAMES,paper-key-names.jsonnext to the ledger, holding only the current run's names; the run's final scan deletes it, and the sweep deletes one a dead run left). - Provisioning by phrase: the phone's code page offers only a camera scan, which the simulator lacks. A flow hands the computer's verification phrase to the app's own
submitProvisionTextCodethroughgate/secret-input.ts'ssubmitProvisionPhrase(no Appium typing, never logged, held only in the wdio worker's memory, whose own scan at the end of the run looks for it in what the run wrote:gate/run-secrets.ts), and the scan itself is the manual-onlyprovision-qr-camera. The phone's own code page shows a QR the whole time it is up, so no step runs then. Device names are never reusable, so a provisioning flow runs once per run id. gate/recorder.ts,gate/recording.ts:PhoneRecordingrecords the simulator per attempt;attemptRecording()returns the running attempt's recording.- Harness RPCs are never credited. Any eval that makes the app send an RPC itself (an
...RpcPromise, a store action that sends one,startAppAccountSwitch, the configured-accounts ask, an outboxCancelPostcleanup,askApp) runs insidewithHarnessRpcs(what, f)(gate/recorder.ts), which pauses the app's recorder and resumes it infinally. Wrap only the eval and its own wait: a UI tap inside the window goes uncredited. The recorder'sstart()clears any pause left open.gate/harness-rpcs-lib.test.tsscansgate/andhelpers/and fails on an eval body outsidewithHarnessRpcsthat is not a literal, a name or a builder on its read-only list. - Outgoing-RPC checks read the recorder's call log through
gate/recorder.ts: a mark fromcurrentCallSeq()before, thenwaitForUiCall(what, mark, method)/uiCallsSince(mark, method)(the UI's calls: a call sent during a harness pause is left out), orcallsSince(mark)for every call (each call's method andpaused; the only param kept isupdateTyping'styping). A read throws when the app's JS runtime changed or its recording stopped inside the window (a relaunch or checkpoint), so an absence never reads an empty log; an absence check also waits for one positive call after its mark where it can. Never Metro's log or.expo/dev/logs/start.log. - "attempt over": a test body is over once it settles or once mocha has moved on from it (a timeout). Every app command (wdio commands,
jsEval,simctl, the gate's waits,step()) checks the attempt it is bound to (AsyncLocalStorage,gate/attempt-binding-lib.ts) and throwsattempt over: <title>from an over body, so a timed-out body cannot drive the app while the afterEach or the next test runs. Hooks bind to no body and are never refused. Per-test timeouts stay the first line: each test'sthis.timeout()is at least the sum of its helper bounds plus its cleanup, with the sum in a comment.
iOS differs from desktop:
- The app's account is checked over Metro (
requireAppIsSmoke): the app has its own service, so the host'skeybaseCLI says nothing about it. - Secrets go in through Metro eval into the focused field's own
onChangeText, never Appium typing, so no wdio command, log or screenshot holds the value. A file that types one setsthis.retries(0)in its describe. relaunchAppkeeps the recording going across the relaunch (a checkpoint before, one after), so a flow that relaunches still gets one recording.- Flows are attributed to their own file:
gate/hooks.tswrapsdescribe, so the aggregatorgate.test.tsdoes not become every test's file. A test or hook outside adescribeis refused as the file loads. - Flow hooks run outside the attempt. A
before/beforeEach/afterEach/afterin a flow is not account-checked, the console errors it causes are cleared when the test starts, andstep(),relaunchApp()andattemptRecording()throw there. Put app-driving setup in the test body. A hook that has to bring the app back to a known screen usesescapeToTabs,goBackUntilGoneor a testID'd close (the inbox filter'sSEARCH_FILTER_CLEAR), never a relaunch. A failing flow hook fails the tests it kept from running (or, for anafterEach, the test before it), citing the hook's error. - Restores that must not race go in a flow-level
afterEach: idempotent, bounded, with a read-back, its steps throughwithCleanupso one failed step does not skip the rest. Not a bodyfinally: a timed-out body'sfinallyis refused as "attempt over", and would race the next test anyway. - A crashed app is brought back by the root hooks (
gate/crash.ts): at each body's end and before its cleanup steps (inside the attempt), in the rootafterEachand in the rootbeforeEach. A gone app is relaunched through the hang watch's relaunch and read back on the smoke account; the newest Keybase crash report since the app was last seen running is printed ([ios gate] the app crashed; its crash report: <path>) and the test it died in fails with "the app crashed (its crash report: <path>)". At a body's end an app gone with no report is left to the flow (it may have terminated it on purpose) and the rootafterEachrelaunches it; one gone between tests is a run error. A relaunch or read-back that fails poisons the gate (poison-lib.ts, as "the Keybase app"), so every later test is refused with what to put back by hand. - A JS reload that no checkpoint saw (anything but
relaunchApp/grantPrivacy/attemptRecording().checkpoint()after it) fails the test: the recording and errors from before it are lost. yarn visual:render --ios <patterns>renders the entries on the simulator and records the phone tour.- Render inspector-drop recovery: the render driver's evals wait up to 15s for the app's inspector page and never run an eval twice. A capture whose first error is the lost inspector page is taken once more only when the app lived through the drop: the same pid in the simulator's
launchctl listand the same JS runtime (the token the run last set, read back once the page is back). A process that died or a runtime that restarted keeps the entry failed, so a route that takes the app down is never hidden. A recaptured entry passes with a note on its own✓line, the release's render line counts it (N recaptured after the inspector page dropped), and its report card's label says(recaptured).
iOS release gate
Same core as the desktop gate (tests/e2e/shared/gate/); the iOS code is tests/e2e/ios-appium/release.mts (with release-lib.ts, release-secrets.mts, launch.mts, census.mts / census-platform.mts, report.mts / report-platform.mts).
yarn test:e2e:ios:release (from shared/) runs everything and exits 1 on any failure, a flaky or skipped flow test included.
- Env: same env file as desktop. The host service must be signed in as
KB_SMOKE_USER(the sweep and setup run through it), and the app on the simulator must already be on the smoke account: the command refuses and says to switch with the app's account switcher. TheiPhoneTestsimulator (KB_IOS_DEVICE) must be booted and visible, with a signed dev build installed (detected through thegroup.keybasecontainer insimctl appinfo). It never installs or uninstalls the app and never switches the host service. - Peers: as on desktop; started if down and left running.
- Phases: preflight (release lock, same one as the desktop command; account; ports 8081/4723/8100; visual gate lock; unlocked macOS session; KBFS; peers;
accounts:setup --check) → launch (its own Metro in watch mode, app relaunch onto that bundle, app-on-smoke check) → sweep leftovers once → flows (wdio gate,ios-flows) → render (visual render --ios) → census → report (each passes only on what its child wrote this run). However the run ends once it holds the release lock (a refused preflight, a failed phase, the deadline, Ctrl-C, a crash), it then stops only what it started (its Metro, the Appium its children left on 4723, and the WebDriverAgent that Appium left on this simulator); the simulator and app stay up. Then, even if stopping failed, the secrets scan (the env file's secrets, the run's paper key names and invite links, and saltpack armor of any message type) covers everything undertests/results/and the visual render root whenKB_VISUAL_RESULTSmoves it (a hit is deleted, named, and fails the run). The armor rule skips the desktop flows' files (desktopFlowOutputsinshared/gate/secret-scan.ts): the desktop scan does not treat armor as a secret, and a failed desktop crypto flow leaves its own test ciphertext there; a run refused at preflight scans onlyios-logs/, as the rest may be another live run's files. Only then is the report opened, if it is still there. Preflight also stops a WebDriverAgent it finds on 8100 for this simulator once every other check passes: that is any earlier Appium session's on this simulator, the owner's own included, so finish your own Appium work on it first. - Outputs (
shared/tests/results/):ios-report.html,ios-census.md/ios-census.json,ios-manual-checklist.md, and the logs inios-logs/(emptied when the run takes the lock). - Known failures:
tests/e2e/ios-appium/gate/lists/known-failures.ts, same contract as desktop (still fail the run; the report labels them). The crypto peer-decrypt entry can pass in a full run, because earlier chat flows send from the second peer and sync its keyring; that "known failure passed" is expected, and the entry stays until the Go fix lands (a run without those flows fails it again). - Lists (
tests/e2e/ios-appium/gate/lists/):manual-only.ts(what a person must do by hand; feeds the checklist),census-exclusions.ts(routes, write RPCs and surfaces the run need not reach, each with why;manual-only: <id>reasons name a manual-only entry),surfaces.ts(the native surfaces with no route). A flow credits a surface withcreditSurface(<surface>)right after it asserts the app used it. Thegate/device.tsandgate/system-ui.tshelpers (openLink,pushNotification,setLocation,setPasteboard,relaunchApp,toBackground/toForeground,tapBanner) only deliver and credit nothing (a jest source scan keepscreditSurface(out ofdevice.ts):background-foregroundis credited by the flow once it has asserted the round trip. - Knobs:
KB_E2E_RELEASE_ONLY=<grep>(only matching flows and thesettings/*tour entries; the census then reports gaps),KB_E2E_RELEASE_TIMEOUT_MIN(default 275: the full run of the whole stack took 183 minutes),KB_E2E_NO_OPEN=1.
iOS chat flows
The chat flows (flows/chat-*.test.ts) run in the gate like every other flow. Seeding is each file's describe-level before(ensureChatData) (20-minute bound on a first run).
- The host stays smoke. The host CLI and
mainRpcact as the smoke account and are never switched. Incoming messages, typing, attachments and "second leaves" come from the second account's peer (peerSender(loadE2EEnv()),sendWithRetry,IncomingSender.leave/attach); a host CLI send is smoke's own message from another device, used only where that is the intent. The second account's own state is read throughensurePeer('second').rpc(). requireSecondNotBlocked()runs in thebefore()of every file that needs the second account (messages from it,asSecond), in chat and in later PRs' files: a chat-blocks restore that failed refuses there instead of running blind.chat-blocksregisters last among the chat files ingate.test.ts.- Inbox rows: the native inbox is a LegendList that draws only near rows.
scrollInboxTo(name)finds a row by its exact name (a channel as#channel, only underKB_E2E_TEAM's header), refuses a name more than one drawn row matches, and never names a row in its errors;openFromInbox(name)taps it. The inbox's end is two drags in a row that change nothing. An absence (inboxHasRowfalse) follows a row the test expects there, and is paired with the app's own layout read (appInboxLists(convID)). A flow that claims "open from the inbox" taps the row, neverkeybase://convid. Never pick or name other rows: the inbox holds conversations with the personal account. - A control with no element of its own (rulings in the PR 5 ledger), two cases:
- It has a native view (a
Kb.Buttoninside a row whose tappable box merges it into one element, such as Browse all channels' Join):tapControlIn(rowElement, {prop, value}, label)finds exactly one button labelled exactlylabelunder the one component whose prop matches, measures its view and the row component's view (measureInWindowis in the app's window, which for a modal sheet is not the screen), places them by the row element's on-screen frame, and taps the middle of the button only when it lies wholly inside the row element and on screen. - It has no frame (inline pressable text inside a message's text, such as a failed send's "Edit or Cancel", which Fabric draws as virtual text inside its paragraph):
pressInlineText(ordinal, text)calls the handler a tap fires, found under that message only (exactly one text rendering exactlytext), outsidewithHarnessRpcssince it is the app's own UI handler; the flow adds amanualEdgeso a person checks the physical tap.
A control with no label (the profile's avatar, merged into its avatar-and-name element PROFILE_AVATAR_NAME) is named as {handlerOf: 'onEditIcon'}: the one component whose onClick is the scope's own prop of that name.
Either way, read back the effect, not the call alone.
- A modal's switches (Kb.Switch, e.g. the block modal's): XCUITest's frames for them are not where they are drawn, so taps there do nothing.
tapSwitchLabelled(label, anchorElement, anchorLabel)measures the switch's own view, places it on screen by a button of the same modal whose element is on screen (measureInWindowis in the modal's window), taps it, and waits for it to turn. Before ruling that a control takes no tap, tap its own measured frame. - A pressable text whose element is wider than its word (an attachment's "Collapsed" label is reported with its line's full width while the word sits at the left, so a tap on the element's middle lands beside it and does nothing):
tapTextIn(element, ordinal, text)finds exactly one pressable text rendering exactlytextunder that message, measures its own view, and taps that frame's middle only when it lies wholly inside the element and on screen. - Search filters (
SearchFilter: the inbox filter, the forward, channel, member and bot pickers) are one accessible box (SEARCH_FILTER), so the text field inside is not in the tree:typeInSearchFilter(text)focuses the box and types with paired key actions (typeIntoFocused). WDA refusesbrowser.keyswith more than one key (an unpaired keyDown). An elementaddValuetaps the field's middle first, which moves a multi-line composer's cursor: to type on where the app left the cursor, usetypeIntoFocused. - Labels with an icon carry the icon font's glyph (Unicode private use) and ", " before the text: a menu item reads "<glyph>, Edit", a danger-zone button "<glyph>, Block", a pinned inbox row "<glyph>, <name>, …". Match by
ENDSWITH ", <text>"(iconButton, and the sheet itemschooseMenuItemandmenuHasread), neverBEGINSWITH ", ". - Many-element reads go through one page source (
gate/page-source-lib.ts): a WebDriver call per element and attribute costs ~65ms. Leave outvisible(mobile: sourcewithexcludedAttributes) where the reader does not need it: it is most of a source's cost on a long list. - The simulator's pasteboard takes no writes from outside on this host (
simctl pbcopy, WDA'smobile: setPasteboardboth leave it empty):setPasteboardwrites through the app's own clipboard module and reads it back. expectPersists(what, read, want)relaunches the app (relaunchApp, recording checkpointed), waits for it to sign in (waitSignedIn), and reads the value back where it shows. Pick a non-defaultwant, or it proves nothing.- What a chat flow puts back (flow afterEach, read back): conversation status (hide, mute, block), pinned conversations and pinned messages, notification settings, min writer role, unfurl settings, blocks plus the smoke and second folder favorite (
shared/favorites.ts, thenaccounts:setup --check), installed bots, exploding mode, skin tone; throwaway channels and subteams are deleted by the host. The sweeper catches stamped messages, channels and subteams only.
iOS files, teams and git flows
flows/files-*.test.ts, flows/teams-*.test.ts and flows/git.test.ts run in the gate after the chat flows; teams-second registers last, after the other second-account files.
- Phone-local state goes through
askApp(gate/app-ask.ts): the files settings (filesSettings/setFilesSettings), and a folder's sync config (folderSyncConfig/setFolderSyncConfig) live in the phone's own service, so the host'smainRpcwould read the Mac's copy. An ask runs insidewithHarnessRpcsand is anchored by arelaunchApp()read in the body. - Files writes stay in a work folder: the host makes a stamped work folder (
newWorkFolder(),shared/files.ts) under the smoke account's private folder, every path a flow touches passesrequireOwnPath, and the flow-levelafterEachremoves it throughremoveOwnKbfs. The route's path is checked inside the work folder before "Yes, delete", "Move here" / "Copy here" and a rename's Save. Never press Backup folder, Archive, Save to Photos or Share to another app; Upload only into the test's own work folder (files-upload). - No regular downloads on iOS: the phone has no download-to-disk, and its Save (to Photos) is no regular download either, so no download card shows:
flows/files-save-photos.test.tsreads a save on the menu's own "In progress, Save" item and its calls (simpleFSStartDownload, thensimpleFSDismissDownloadonce the photo is saved). The user's cancel is the sheet's Close while it saves, which sendssimpleFSDismissDownload(the service cancels a download it dismisses); the phone sendssimpleFSCancelDownloadonly when another file action is picked mid-save (census-excluded). A cancel is proven by the service holding no download of it and the library holding no new asset. - Contacts: the Contacts settings page is opened view only (
settings-subpages), and only once the app has loaded the contacts import setting: the page loads it itself when it is missing, and that load writes the address book (or an empty one) to the server. Its "Import phone contacts" is never pressed; the More row of that same text isSETTINGS_ROW_CONTACTS. - XCUITest's
visibleis not to be trusted: below the Files folder-type screens it reports every element visible=false; on team pages, modals, bottom sheets and pickers it does so now and then. A click on a visible=false row, card or sheet item taps nothing (a click on a button still works). So, inhelpers/menus.ts,press(e)clicks a visible element and taps an invisible one at its own frame (tapFrame/tapElement, on screen only), andonScreen(e)/onScreenID(id)replaceisDisplayed()with a frame-on-screen read;pressTestID(id)(helpers/files.ts) presses by testID. Rows (filesRowNamed,helpers/files.ts) are read off one page source: Files rows inside the files browser's frame; other lists byvisible, falling back to the unseen rows on screen; a Files row the tree holds off screen (the list is not virtualized) is dragged toward; another list steers by on-screen reads only. Label lookups (labelledElement,elementWithLabelPart,helpers/menus.ts) read only what their selector finds; with{forTap: true}they go throughelementsOrUnseen, which falls back to unseen on-screen elements when none reads visible;textShown,textPartShownandlabelPartInside(helpers/teams.ts) read one page source (an attribute call per labelled box took minutes). A presence read throughtextShown/textPartShown/elementWithLabelPartIntakes visible elements only; only a text about to be tapped passes{forTap: true}, which falls back to unseen elements whose frame lies wholly on screen. A menu sheet counts as open when it reads visible or its top is above the window's bottom 114pt (a closed message menu's sheet can stay in the tree, moved below the screen);waitForSheetGonealso reads a navigation or tab bar under it.closeMessageMenu(helpers/chat.ts) taps the sheet's own Close or the backdrop above the sheet, never inside it (its first row is the quick reactions), and fails when it can do neither. The destination picker's rows sit under the modal screen (MODAL_SCREEN) holdingFILES_DESTINATION_PICKER.innermost(gate/chat-lib.ts) allows the one rounded point a text can read past its box. - Fields and keys: a field inside one accessible box (the files editing row, the attachment caption) is not in the tree:
fillHiddenField(testID, text, what)focuses it through the app and sets it through the field's own onChange (setFieldText), then reads it back withfocusedFieldText(gate/secret-input.ts, for fields that hold no secret).fillFieldtaps a field at its frame's bottom-right corner, deletes what it holds and types by keys. No iOS code calls WDA'ssetValueorclearValue(gate/keyboard-mode-scan.test.tsfails on one): either leaves the app's process in hardware-keyboard mode, so no later focus draws a software keyboard until the app relaunches. A SearchFilter (the team builder, Share to Chat) takestypeInFilter. With the keyboard up, the first tap on a button below it only closes the keyboard, andisKeyboardShownis not reliable either: a tap right after typing goes throughclickUntil(button, done, what), which taps again only when the first did not take. - Team modals:
backToTeamPage/backToTeamsRootclick a navigation bar's Cancel or Close (else its Back; never Save or Done) and wait for the route to leave and the slide-out to end. goBack's leftmost-visible pick could land on the page under a modal. The Teams tab's Create a team and Join a team are cards (tapTeamsCard), and the header's Add/Invite people is the upper one (tapHeaderAddInvite). On the phone the git list is the More tab'ssettingsTabs.gitTab. - Team writes only in a stamped subteam: every team write (channels, the team repo, members, invites, settings, retention, emoji) runs in a throwaway subteam of
KB_E2E_TEAMnamed<KB_E2E_TEAM>.e2e<runid><label>, withrequireOnSubteam(the route'steamIDor conversation) checked before each writing tap;KB_E2E_TEAMitself is opened read-only. A picker that lists every team reads back that only the subteam is picked before submit. The flow-levelafterEachdeletes the subteam (deleteSubteamIfPresent). - A team repo goes before its subteam: delete and read back the repo (
deleteRepoIfPresent) before the subteam it lives in; the sweeper deletes a stale subteam's stamped repos first, as it cannot see repos of a deleted subteam. - Invite links are secrets: the host makes a single-use, one-day link on the subteam; it reaches the app only by
setPasteboardand the field's own Paste (neveraddValueoropenLink), the pasteboard is overwritten right after, the link is appended to the run's 0600 scan record (KB_E2E_SCAN_INVITE_LINKS) that the run's final scan (the release's secrets phase, or a direct run's wdio scan) reads and then deletes (a dead run's goes in the next sweep), and the recorder keeps noinviteKeyroute param. While it is in the field the gate's secret-screen flag withholdsstep()screenshots and failure screenshots or page source. A failed Metro eval's error withholds any line repeating the code it ran (withholdQuotedCode,shared/metro-eval.ts), so the textsetPasteboardwrites never reaches an error. The file runs withretries(0). - The pasteboard read:
pasteboardText()reads through WDA'smobile: getPasteboard, assetPasteboardreads back;simctl pbpastedoes not see the app's pasteboard on this host.
iOS people, profile, crypto and settings flows
flows/people-*.test.ts, flows/profile-*.test.ts, flows/crypto*.test.ts and flows/settings-*.test.ts run after the files, teams and git flows. settings-persisted runs after the chat unfurl flow; profile-proofs and settings-remember-password run after teams-second; settings-password runs last.
- Phone-local settings go through
askApp(gate/app-ask.ts): remember-password, the proxy, the GUI values (theme), the photo compress preference, the backup jobs and the KBFS debug level live in the phone's own service, so the host'smainRpcwould read the Mac's copy. What the account keeps on the server (emails, contact, unfurl, notification and email settings, lockdown, animated emoji, profile fields, follows) is read and put back through the host (shared/settings.ts,shared/profile.ts,shared/people.ts), which checks it is the smoke account first. A failed restore of the proxy, lockdown or the theme stops the whole gate (gate/poison-lib.ts): every later test refuses, and so does every flow file'sbeforeandbeforeEachbefore it runs (hooks.tswraps them inpoisonCheckedFirst), whileafterEachandafterstill put things back. - Another device's sigchain change lags: a device sees a follow its other device made only once the server's merkle tree holds it, which on this server can take ten minutes. people-follow reads the server's own follower list (
serverSaysFollowsSecond), changes the follow only from the phone, and the host writes only to put a state back (retried until the server lists it; the app is then relaunched until the button reads it). - The second account's password rotates from the phone through desktop's contract (
rotateSecondPasswordwithiosRotateDeps,gate/password.ts):KB_SECOND_PASSWORD_NEXTis written first, set from the phone, checked (the peer, the phone's stored secret, a switch with no prompt) and only then promoted. The host's main service is never switched from the phone flow: right after a phone-made change, the host's login switch deadlocks in a logout hook, so the flow passes at the manual-only edgesecond-password-host-check(manualEdge) and the manual checklist has the owner runyarn test:e2e:accounts:second-password --checkafter the release (which also settles a pending_NEXTon the second peer).requireRotatablerefuses a pending_NEXTor server-synced PGP keys. The file runs withretries(0)and reads no page source; a password reaches a field only throughsubmitSecret; the smoke account's password is never read or set. A change that stopped part way is the owner's:yarn test:e2e:accounts:second-password --check. The flow's afterEach only promotes a pending_NEXTthe second peer takes; it drops one only when the phone's call log proves nopassphraseChangewent out in that attempt (a sent change can still be on its way), and otherwise leaves it for the owner's--check. The--check(and desktop's rotation) switches the host's main service to the second account and back; a switch that gives no answer gets one switch back and then the owner action. - The secret-on-screen flag (
gate/secret-screen.ts) is on while a password field may hold a password and while a crypto screen draws anything but the run's marker (a pasted or output saltpack message):step()refuses and failure screenshots are withheld, so steps go before the field fills and after the screen leaves. - Crypto on the phone is text only (the file and save-to-file saltpack calls are census exclusions). The operation's field sits inside its tappable box, one accessible element: a marker goes in through the field's own onChange (
fillHiddenField), a message is pasted by a long press on the field's measured first line (pasteIntoCryptoField), and the output, a selectable text XCUITest does not expose, is compared with the marker inside the app (cryptoOutputReads, a yes or no only). The host and the second peer decrypt and verify from 0600 files under the run's crypto folder, never argv. Recipients are only the smoke and second accounts, by exact name. - Proofs only on the second account (
asSecond), one per test, revoked in the same test by the sig id it recorded; the afterEach revokes a sig the test made but never recorded (only the one new sig of the pending kind since the test's own before-snapshot,recordProofSig; the burn address is the same every run, so its statement alone cannot say which run added it) and purges a peer-made PGP key with its export (purgePeerPgp; pgpPurge removes every local key at once, so earlier runs' stamped keys go with it, and a key no run made, or one of this run's the flow did not make, purges nothing and is the owner's). A run killed before its afterEach leaves a stamped DNS proof (dns://e2e<runid>.example.com) or PGP key (e2e-<runid>-pgp@example.com) live on the second account and the key's secret half in the second peer's keyring; once the run is older the sweeper revokes the proof by sig id, drops the key by key id and purges the local secret halves (localPgpKey, named by the identity the sigchain gives each fingerprint), all of them or none: one unstamped or this run's holds the purge back. - Avatars: the profile and subteam avatar flows upload the corpus png and read the server's answer (
smokeAvatarUrl,subteamAvatarUrl: the image lookup APIs, not the host service's avatar cache) changing from the one read before; a new subteam answers its parent's avatar until it has its own. An avatar is not put back (desktop precedent); each upload gives a new url. - Emails only stamped
@example.com, on the smoke account; the afterEach makes the original primary first, then deletes the stamped one. - Never pressed: "Open keybase.io in web browser", the Delete account confirm (Cancel only, nothing ticked), Add-phone Continue, DB Nuke, Make searchable, Share, a real proof service, "I fixed it - recheck", "View proof", "Unsubscribe from all", the People feed's verify-phone todo, "Allow TLS Interception" / "Yes, I am sure", Trace, CPU Profile, Clear Logs, Dark (the gate runs light: light and "Respect system settings" only), "Backup all files" and "Backup all Git repos" (they copy every folder and repo of the account, non-test teams' too, onto the phone; manual-only
backup-all). - Backups: each test snapshots the phone's backup jobs first, and its afterEach removes only the jobs the test started (before any check that could throw: a job left running fills the phone), with their output. "See progress" opens the Backup page as a sheet with no Close, so it is swiped down.
- Long pages' texts (a profile with its teams and proofs) are read off one page source (
textShown): an attribute call per text outlived its wait.
iOS native surfaces
The app-level and native flows (app-deep-links, app-push, app-lifecycle, chat-location, chat-attachments-picker, files-upload, files-save-photos, profile-avatar, teams-avatar-emoji, share-extension) reach outside the app through gate/device.ts (simctl, attempt-checked, udid from preflight) and gate/system-ui.ts (springboard, Notification Center, the photo and document pickers, system alerts). Neither credits anything: a flow calls creditSurface(...) once it has asserted the app used the surface.
- Privacy:
grantPrivacy(service)reads the original from the simulator'sTCC.db(location fromlocationd's clients plist), grants with the bundle idkeybase.ios(neverall, never a reset without the bundle id) and returns a restore token;restorePrivacy(token)in the flow'safterEachputs it back exactly and reads it back. Every photos grant or reset terminates the app within a second; location ones do not. - simctl's photos grant is invisible to PhotoKit: the app reads full access as undetermined after
simctl privacy grant photos. Full access comes only through the app's own prompt, accepting "Allow Full Access" (grantFullPhotoAccess). The pickers need no grant at all (PHPicker runs out of process). - Photo corpus once per simulator:
ensurePhotoCorpus()adds the committed corpus (fixtures/corpus/) once and records the udid and sha256 list in~/.config/keybase-e2e/; it is never added per run. A flow picks corpus items by name and proves the pick by read-back (sha256, or format and pixel size where the picker re-encodes), never by grid position. - Save to Photos deletes only recorded saved ids: the test reads the whole library first, records the one new asset id the save made, and its
afterEachdeletes exactly the recorded ids. Deleted assets sit in Photos' Recently Deleted for 30 days; nothing else in the library is ever touched. - Push:
pushNotificationdelivers throughsimctl push(payload file 0600 under/tmp/kb-e2e/, never a silent payload). Push permission is granted once on the simulator by the owner (simctl privacy has no notification service); preflight refuses without it. No flow calls the app'srequestPermissions. - App log capture, not log files:
gate/app-log.tscaptures the app's logger lines inside the JS runtime after each launch (appLogMark/appLogSince/appLogMarker); flows read it and the recorder, neverstart.logormetro.log. Cold-launch checks readstartRoutes/appSnapshot. - The share extension runs in its own process: its log (
extensionLogSince) and the group container's manifest are its read-backs, and every share ends with a host CLI read-back of the sent message in smoke's self conversation. - A context menu is held once on a frame read twice: the hold's target frame is read until two reads half a second apart agree, then held once; there is no second hold, since one made while a menu is up lands on that menu.
- No gate wait outlives Appium's newCommandTimeout silently: a wait that sends no WebDriver command pings the session (
gate/hang-lib.ts) or refuses; a 300 s silent wait once ended the session and the rest of the run. - The release refuses a pending outbox: launch reads the app's outbox and refuses while any entry is pending (a failed post retries for a long time and holds the app background-active). A flow that can leave one (chat-location's map posts) cancels its own in
afterEachand reads the cancel back. - The poisoned flag: a restore whose failure leaves the phone broken (a privacy or location restore, Notification Center left open, a stuck share manifest, a seed folder left, the app not relaunchable) calls
poisonGate(what, byHand)(a flow wraps such a restore ingate/poison-lib.tsguarded(what, byHand, restore), which also clears the poison once it lands, and which poisons nothing for an attempt that is over, as a retry restores the same setting). A cleanup of something an attempt made (a seed folder, throughremoveSeedFolder, a saved photo, the pasteboard's image) passesguardedaleftovercheck as well: when it does not finish, cut off or not, it poisons only if the thing is still there or the check cannot read it. Every later test fails at once naming it, and the release fails. A person clears the phone by hand. - Inline pressable Text: iOS draws inline pressable text (
RCTVirtualText) with no accessibility element or frame; the flow calls that control's ownonPressover Metro (exact text, in its row, exactly one) and adds amanualEdgefor the physical tap. Never a coordinate guess. - State-carrying testIDs: where iOS shows no control state (a checkbox, a radio, a toggle-like row), the testID carries it (
<ID>:on/<ID>:off), registered inshared/test-ids.ts; reads go through the testID. - Never pressed: the camera's "Take photo or video", the composer's audio record button, "Import phone contacts", "Share to another app" (the system sheet out), Photos' Delete on anything but the test's exact saved asset,
pbsync(the host's clipboard), and anything that cuts the network (offline and reconnect are manual-only). The account and settings never-press list above still holds.
iOS — Appium + WebdriverIO (TypeScript)
| Command (from shared/) | What it runs |
|------|-------|
| yarn test:e2e:ios:release | the whole iOS release gate (preflight, launch, sweep, flows, render, census, report, secrets) |
| yarn test:e2e:ios:flows | the gate flows alone (wdio.gate.conf.ts, spec gate.test.ts, one session) |
| yarn test:e2e:ios:census | the census again over the last run's results |
| yarn test:e2e:ios:gate-report | the report again over the last run's results |
| yarn test:e2e:accounts:second-password --check | after a release: the host's stored secret for the second account |
Flow files are shared/tests/e2e/ios-appium/flows/*.test.ts, the gate's helpers ios-appium/gate/, the element and navigation helpers ios-appium/helpers/.
Drives the already-installed app black-box (no rebuild). Selectors: ~<testID> (testID → iOS accessibilityIdentifier). Helpers: el/els/waitForTestID/byText/tab (elements), escapeToTabs/goBack/navigateTo*/scrollDownToText (navigate). escapeToTabs runs before every test (resets to the tab root).
Gotchas (hard-won — read before adding flows):
- Native tab bar: tap tabs by label (
tab('People')→~People), NOTnav-tab-*testIDs — those don't reach the nativeUITabBar. - Container testIDs (a flex
Kb.Box2wrapping a list) reportvisible="false"to XCUITest even when on screen → usewaitForTestID(it useswaitForExist, presence), nevertoBeDisplayed. - testIDs must be on the MOBILE-rendered element. Many components branch on
isMobile/.desktop/.native; a desktop-only testID is invisible on iOS, so a flow that waits on it passes on desktop while testing nothing on iOS. Put the testID on the clickable/leaf element (e.g.Kb.ListItem'stestID, aClickableBox), not a non-clickable wrappingBox2— wdio.click()no-ops on a non-accessible container. byTextuses CONTAINS — tappable rows have merged accessibility labels (e.g.", Crypto"), so exact match fails.Kb.Tabssupports a per-tabtestID(needed for icon-only tabs like the team Settings gear). The app remembers the last-selected team tab → select tabs by testID, don't assume the default.- Modals: dismiss via Done/Close/Cancel (
escapeToTabsdoes this first, before back buttons — a modal's back button is a no-op that loops). - HMR applies testID/component changes to the running sim app — no manual reload needed when adding testIDs.
- Wait for a real data row (not just the list container) before asserting/screenshotting, so shots show loaded content.
iOS tab structure: People & Teams are direct tabs; Chat & Files have their own nav helpers; Crypto/Devices/Git/Settings live under the More tab (navigateToMore).