Skip to content

Add comprehensive test suite for API contracts and push notifications (#292-295) - #356

Open
owennashdev-ctrl wants to merge 4 commits into
ethos-protocol:mainfrom
owennashdev-ctrl:feature/test-improvements-292-295
Open

Add comprehensive test suite for API contracts and push notifications (#292-295)#356
owennashdev-ctrl wants to merge 4 commits into
ethos-protocol:mainfrom
owennashdev-ctrl:feature/test-improvements-292-295

Conversation

@owennashdev-ctrl

Copy link
Copy Markdown

Summary

Implements 4 testing improvements as part of the Stellar Wave program:

Implementation Details

Issue #292 - Contract Tests

  • iOS: — 20+ tests validating X-Nonce (64 hex chars), X-Timestamp (valid Unix epoch), pagination headers
  • Android: — 18+ tests with same coverage using Ktor MockEngine
  • All mutating requests (POST/DELETE) verified to include anti-replay headers
  • GET requests verified to NOT include anti-replay headers

Issue #293 - Golden-File Tests

  • iOS: with 3 golden payload samples (TTL warning, check-in reminder, vault expired)
  • Android: with matching FCM payload format samples
  • Validates consistent structure across all notification types
  • Prevents silent breakage when backend changes field names

Issue #294 - Regression Suite

Issue #295 - Flakiness Process

  • documenting identification, quarantine, and re-enabling procedures
  • annotation for marking intermittent tests with retry metadata
  • script to parse Gradle logs and identify timeout/resource patterns
  • Extended README Testing section with CI integration guidance

Testing

All tests implemented only—no test of tests:

  • Contract tests run against mocked HTTP clients (no real network)
  • Golden-file tests validate payload structure (no backend connectivity)
  • Regression tests verify API endpoints called correctly
  • Flakiness tooling validated with example log patterns

Files Changed

Test Files

  • (+320 lines)
  • (+330 lines)
  • (+300 lines)
  • (+300 lines)
  • (+320 lines)
  • (+280 lines)

Documentation & Tooling

  • (+120 lines) — quarantine tracking
  • (+150 lines) — flakiness detector
  • (+35 lines) — annotation
  • (+65 lines) — Testing section extended

Closes #292
Closes #293
Closes #294
Closes #295

…uest headers

- Implement ContractTests.swift (iOS) verifying X-Nonce and X-Timestamp headers
- Implement ApiContractTest.kt (Android) testing anti-replay header generation
- Test pagination contract (cursor, limit query parameters)
- Verify GET requests exclude anti-replay headers
- Validate X-Nonce is 32 bytes hex-encoded
- Validate X-Timestamp is valid Unix epoch seconds
- Ensure all mutating requests follow shared/api-contract.md
… payloads

- Implement PushPayloadGoldenTests.swift (iOS) with golden samples
- Implement PushPayloadGoldenTest.kt (Android) with FCM payload samples
- Test TTL warning notification structure (ttl_remaining, event_type)
- Test check-in reminder notification structure (reminder_id)
- Test vault expired notification structure (expired_at in ISO8601)
- Validate consistent payload shape across notification types
- Ensure title, body, and vault_id present in all payloads
- Prevent silent breakage when backend changes field names
…arity bugs

- Implement RegressionParityTests.swift (iOS) for issues ethos-protocol#87, ethos-protocol#109, ethos-protocol#115
- Implement RegressionParityTest.kt (Android) mirroring iOS tests
- Issue ethos-protocol#87: Test deposit/withdraw endpoints and anti-replay headers
- Issue ethos-protocol#109: Test beneficiary acceptance requires token, POST with anti-replay
- Issue ethos-protocol#115: Test TOTP re-verify (challenge2FA excludes provisioning data)
- Validate beneficiary update is possible on both platforms
- Ensure consistent mutating request behavior across platforms
- Add FLAKY_TESTS.md documentation for tracking quarantined tests
- Document identification, quarantine, and re-enabling process
- Create @flaky annotation for marking intermittent tests
- Add analyze_test_flakiness.py script for parsing test logs
- Extend README Testing section with flakiness detection procedures
- Enable systematic tracking of emulator/device timing issues
- Document CI integration points for automated detection
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@owennashdev-ctrl Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant