Skip to content

2.1.0

Choose a tag to compare

@nikolainobadi nikolainobadi released this 12 Apr 00:35
· 11 commits to main since this release

NnTestKit 2.1.0

Released 2026-04-11

Adds a typed seeding pipeline for driving app state from UI tests, plus a configurable global timeout for UI helpers.

Highlights

  • Seeded UI tests — push a Codable config from test → app via environment variables, decode it at launch, and run your app-side seeder before UI renders.
  • Global UI timeout — all UI helpers now fall back to UITestSeedDefaults.timeout (default 10s, was 3s). Override once in setUpWithError instead of passing timeout: everywhere.
  • iOS 26+ alert fix — tapFirstButton(_:) resolves duplicate matches in the accessibility tree.

Added

NnTestVariables

  • UITestSeedContext<Config> — typed seed payload (runId, config, userEmail, userPassword) with fromEnvironment(_:) factory that decodes UITEST_SEED_CONFIG JSON.
  • UITestSeedKey enum — canonical env var names (UITEST_RUN_ID, UITEST_USER_EMAIL, UITEST_SEED_CONFIG).
  • UITestSeedDefaults — shared password constant and mutable timeout (default 10s).

NnUITestHelpers (on BaseUITestCase)

  • launchSeeded(config:envKeys:) — encodes config, assigns a unique runId + test email, launches the app.
  • setSeedConfig(_:envKeys:) — same, without launching (for flows that own app.launch()).
  • mainUserEmail — generated email for the current run.
  • seedEmail(for:) — derive additional seeded-user emails by name.
  • makeUniqueName(_:) — collision-free names across runs.
  • dismissPasswordPromptIfNeeded(timeout:) — dismisses the iOS "Save Password?" system prompt.
  • tapFirstButton(_:query:timeout:) — taps the first matching button when iOS duplicates elements in the accessibility tree.

Changed

  • UI helper timeouts now default to UITestSeedDefaults.timeout (10s) instead of hard-coded 3s. Affects: tapButton, tapAlertButton, tapAlertSheetButton, tapToggle, tapSegmentedControl, adjustStepper, waitForElement, elementAppeared, elementNotAppeared, typeInField, typeInAlertField.

Migration

No breaking changes. Existing tests keep working; explicit timeout: arguments still win over the new global default.

If you were relying on the 3-second default, either pass timeout: 3 at the call site or set UITestSeedDefaults.timeout = 3 in setUpWithError.