Files
honeyDueKMP/composeApp/src/androidInstrumentedTest/kotlin/com/tt/honeyDue/fixtures/TestUser.kt
Trey T 2d80ade6bc Test infra: shared accessibility IDs + PageObjects + AAA_SeedTests
Ports iOS HoneyDueUITests AccessibilityIdentifiers + PageObjects pattern
to Android Compose UI Test. Kotlin AccessibilityIds object mirrors Swift
verbatim so scripts/verify_test_tag_parity.sh can gate on divergence.

AAA_SeedTests bracketed first alphanumerically; SuiteZZ cleanup to follow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 14:19:37 -05:00

49 lines
1.5 KiB
Kotlin

package com.tt.honeyDue.fixtures
import kotlin.random.Random
/**
* Test user fixture mirroring `TestFixtures.TestUser` in Swift.
*
* `seededTestUser()` yields the known-good backend account that
* `AAA_SeedTests` ensures exists before the parallel suites run.
*/
data class TestUser(
val username: String,
val email: String,
val password: String,
val firstName: String = "Test",
val lastName: String = "User",
) {
companion object {
/** Pre-existing user seeded against the dev backend. */
fun seededTestUser(): TestUser = TestUser(
username = "testuser",
email = "testuser@honeydue.com",
password = "TestPass123!",
)
/** Admin account used by admin-gated flows. */
fun seededAdminUser(): TestUser = TestUser(
username = "admin",
email = "admin@honeydue.com",
password = "Test1234",
)
/**
* Unique, ephemeral user used for registration flows that cannot
* re-use an existing account. Cleaned up by `SuiteZZ_CleanupTests`.
*/
fun ephemeralUser(suffix: String = randomSuffix()): TestUser = TestUser(
username = "uitest_$suffix",
email = "uitest_$suffix@test.com",
password = "TestPassword123!",
firstName = "Test",
lastName = "User",
)
private fun randomSuffix(): String =
Random.nextInt(100_000, 999_999).toString()
}
}