Files
honeyDueKMP/iosApp/CaseraUITests/Tests/AccessibilityTests.swift
treyt fc0e0688eb Add comprehensive iOS unit and UI test suites for greenfield test plan
- Create unit tests: DataLayerTests (27 tests for DATA-001–007), DataManagerExtendedTests
  (20 tests for TASK-005, TASK-012, TCOMP-003, THEME-001, QA-002), plus ValidationHelpers,
  TaskMetrics, StringExtensions, DoubleExtensions, DateUtils, DocumentHelpers, ErrorMessageParser
- Create UI tests: AuthenticationTests, PasswordResetTests, OnboardingTests, TaskIntegration,
  ContractorIntegration, ResidenceIntegration, DocumentIntegration, DataLayer, Stability
- Add UI test framework: AuthenticatedTestCase, ScreenObjects, TestFlows, TestAccountManager,
  TestAccountAPIClient, TestDataCleaner, TestDataSeeder
- Add accessibility identifiers to password reset views for UI test support
- Add greenfield test plan CSVs and update automated column for 27 test IDs
- All 297 unit tests pass across 60 suites

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 15:37:56 -06:00

84 lines
4.1 KiB
Swift

import XCTest
final class AccessibilityTests: BaseUITestCase {
func testA001_OnboardingPrimaryControlsAreReachable() {
let welcome = OnboardingWelcomeScreen(app: app)
welcome.waitForLoad()
app.buttons[UITestID.Onboarding.startFreshButton].waitUntilHittable(timeout: defaultTimeout)
app.buttons[UITestID.Onboarding.joinExistingButton].waitUntilHittable(timeout: defaultTimeout)
app.buttons[UITestID.Onboarding.loginButton].waitUntilHittable(timeout: defaultTimeout)
}
func testA002_LoginControlsRemainOperable() {
let login = TestFlows.navigateToLoginFromOnboarding(app: app)
app.textFields[UITestID.Auth.usernameField].waitUntilHittable(timeout: defaultTimeout)
app.secureTextFields[UITestID.Auth.passwordField].waitUntilHittable(timeout: defaultTimeout)
app.buttons[UITestID.Auth.loginButton].waitUntilHittable(timeout: defaultTimeout)
login.tapPasswordVisibilityToggle()
login.assertPasswordFieldVisible()
}
func testA003_CoreControlsExposeIdentifiers() {
let login = TestFlows.navigateToLoginFromOnboarding(app: app)
_ = login
XCTAssertTrue(app.textFields[UITestID.Auth.usernameField].exists)
XCTAssertTrue(app.secureTextFields[UITestID.Auth.passwordField].exists || app.textFields[UITestID.Auth.passwordField].exists)
XCTAssertTrue(app.buttons[UITestID.Auth.signUpButton].exists)
XCTAssertTrue(app.buttons[UITestID.Auth.forgotPasswordButton].exists)
}
// MARK: - Additional Accessibility Coverage
func testA004_ValuePropsScreenControlsAreReachable() {
let welcome = OnboardingWelcomeScreen(app: app)
welcome.waitForLoad()
welcome.tapStartFresh()
let valueProps = OnboardingValuePropsScreen(app: app)
valueProps.waitForLoad(timeout: defaultTimeout)
let continueButton = app.descendants(matching: .any).matching(identifier: UITestID.Onboarding.valuePropsNextButton).firstMatch
continueButton.waitUntilHittable(timeout: defaultTimeout)
let backButton = app.descendants(matching: .any).matching(identifier: UITestID.Onboarding.backButton).firstMatch
XCTAssertTrue(backButton.waitForExistence(timeout: defaultTimeout), "Back button should exist on value props screen")
}
func testA005_NameResidenceScreenControlsAreReachable() {
let welcome = OnboardingWelcomeScreen(app: app)
welcome.waitForLoad()
welcome.tapStartFresh()
let valueProps = OnboardingValuePropsScreen(app: app)
valueProps.waitForLoad()
valueProps.tapContinue()
let nameResidence = OnboardingNameResidenceScreen(app: app)
nameResidence.waitForLoad(timeout: defaultTimeout)
let nameField = app.textFields[UITestID.Onboarding.residenceNameField]
nameField.waitUntilHittable(timeout: defaultTimeout)
let continueButton = app.descendants(matching: .any).matching(identifier: UITestID.Onboarding.nameResidenceContinueButton).firstMatch
XCTAssertTrue(continueButton.waitForExistence(timeout: defaultTimeout), "Continue button should exist on name residence screen")
let backButton = app.descendants(matching: .any).matching(identifier: UITestID.Onboarding.backButton).firstMatch
XCTAssertTrue(backButton.waitForExistence(timeout: defaultTimeout), "Back button should exist on name residence screen")
}
func testA006_CreateAccountScreenControlsAreReachable() {
let createAccount = TestFlows.navigateStartFreshToCreateAccount(app: app, residenceName: "A11Y Test")
createAccount.waitForLoad(timeout: defaultTimeout)
let createAccountTitle = app.descendants(matching: .any).matching(identifier: UITestID.Onboarding.createAccountTitle).firstMatch
XCTAssertTrue(createAccountTitle.exists, "Create account title should be accessible")
let backButton = app.descendants(matching: .any).matching(identifier: UITestID.Onboarding.backButton).firstMatch
XCTAssertTrue(backButton.waitForExistence(timeout: defaultTimeout), "Back button should exist on create account screen")
}
}