Files
honeyDueKMP/iosApp/CaseraUITests/Fixtures/TestFixtures.swift
Trey t 7444f73b46 Close all 25 codex audit findings across KMP, iOS, and Android
Remediate all P0-S priority findings from cross-platform architecture audit:
- Harden token storage with EncryptedSharedPreferences (Android) and Keychain (iOS)
- Add SSL pinning and certificate validation to API clients
- Fix subscription cache race conditions and add thread-safe access
- Add input validation for document uploads and file type restrictions
- Refactor DocumentApi to use proper multipart upload flow
- Add rate limiting awareness and retry logic to API layer
- Harden subscription tier enforcement in SubscriptionHelper
- Add biometric prompt for sensitive actions (Login, Onboarding)
- Fix notification permission handling and device registration
- Add UI test infrastructure (page objects, fixtures, smoke tests)
- Add CI workflow for mobile builds

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 13:15:34 -06:00

121 lines
3.2 KiB
Swift

import Foundation
/// Reusable test data builders for UI tests.
///
/// Each fixture generates unique names using random numbers or UUIDs
/// to ensure test isolation and prevent cross-test interference.
enum TestFixtures {
// MARK: - Users
struct TestUser {
let firstName: String
let lastName: String
let email: String
let password: String
/// Standard test user with unique email.
static let standard = TestUser(
firstName: "Test",
lastName: "User",
email: "uitest_\(UUID().uuidString.prefix(8))@test.com",
password: "TestPassword123!"
)
/// Secondary test user for multi-user scenarios.
static let secondary = TestUser(
firstName: "Second",
lastName: "Tester",
email: "uitest2_\(UUID().uuidString.prefix(8))@test.com",
password: "TestPassword456!"
)
/// Pre-existing test user with known credentials (must exist on backend).
static let existing = TestUser(
firstName: "Test",
lastName: "User",
email: "testuser",
password: "TestPass123!"
)
}
// MARK: - Residences
struct TestResidence {
let name: String
let address: String
let type: String
static let house = TestResidence(
name: "Test House \(Int.random(in: 1000...9999))",
address: "123 Test St",
type: "House"
)
static let apartment = TestResidence(
name: "Test Apt \(Int.random(in: 1000...9999))",
address: "456 Mock Ave",
type: "Apartment"
)
}
// MARK: - Tasks
struct TestTask {
let title: String
let description: String
let priority: String
let category: String
static let basic = TestTask(
title: "Test Task \(Int.random(in: 1000...9999))",
description: "A test task",
priority: "Medium",
category: "Cleaning"
)
static let urgent = TestTask(
title: "Urgent Task \(Int.random(in: 1000...9999))",
description: "An urgent task",
priority: "High",
category: "Repair"
)
}
// MARK: - Documents
struct TestDocument {
let title: String
let description: String
let type: String
static let basic = TestDocument(
title: "Test Doc \(Int.random(in: 1000...9999))",
description: "A test document",
type: "Manual"
)
static let warranty = TestDocument(
title: "Test Warranty \(Int.random(in: 1000...9999))",
description: "A test warranty",
type: "Warranty"
)
}
// MARK: - Contractors
struct TestContractor {
let name: String
let phone: String
let email: String
let specialty: String
static let basic = TestContractor(
name: "Test Contractor \(Int.random(in: 1000...9999))",
phone: "555-0100",
email: "contractor@test.com",
specialty: "Plumber"
)
}
}