Total rebrand across KMM project: - Kotlin package: com.example.casera -> com.tt.honeyDue (dirs + declarations) - Gradle: rootProject.name, namespace, applicationId - Android: manifest, strings.xml (all languages), widget resources - iOS: pbxproj bundle IDs, Info.plist, entitlements, xcconfig - iOS directories: Casera/ -> HoneyDue/, CaseraTests/ -> HoneyDueTests/, etc. - Swift source: all class/struct/enum renames - Deep links: casera:// -> honeydue://, .casera -> .honeydue - App icons replaced with honeyDue honeycomb icon - Domains: casera.treytartt.com -> honeyDue.treytartt.com - Bundle IDs: com.tt.casera -> com.tt.honeyDue - Database table names preserved Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
112 lines
3.4 KiB
Swift
112 lines
3.4 KiB
Swift
import XCTest
|
|
|
|
/// Critical path tests for authentication flows.
|
|
///
|
|
/// Validates login, logout, registration entry, and password reset entry.
|
|
/// Zero sleep() calls — all waits are condition-based.
|
|
final class AuthCriticalPathTests: XCTestCase {
|
|
var app: XCUIApplication!
|
|
|
|
override func setUp() {
|
|
super.setUp()
|
|
continueAfterFailure = false
|
|
app = TestLaunchConfig.launchApp()
|
|
}
|
|
|
|
override func tearDown() {
|
|
app = nil
|
|
super.tearDown()
|
|
}
|
|
|
|
// MARK: - Login
|
|
|
|
func testLoginWithValidCredentials() {
|
|
let login = LoginScreen(app: app)
|
|
guard login.emailField.waitForExistence(timeout: 15) else {
|
|
// Already logged in — verify main screen
|
|
let main = MainTabScreen(app: app)
|
|
XCTAssertTrue(main.isDisplayed, "Main screen should be visible when already logged in")
|
|
return
|
|
}
|
|
|
|
let user = TestFixtures.TestUser.existing
|
|
login.login(email: user.email, password: user.password)
|
|
|
|
let main = MainTabScreen(app: app)
|
|
XCTAssertTrue(
|
|
main.residencesTab.waitForExistence(timeout: 15),
|
|
"Should navigate to main screen after successful login"
|
|
)
|
|
}
|
|
|
|
func testLoginWithInvalidCredentials() {
|
|
let login = LoginScreen(app: app)
|
|
guard login.emailField.waitForExistence(timeout: 15) else {
|
|
return // Already logged in, skip
|
|
}
|
|
|
|
login.login(email: "invaliduser", password: "wrongpassword")
|
|
|
|
// Should stay on login screen — email field should still exist
|
|
XCTAssertTrue(
|
|
login.emailField.waitForExistence(timeout: 10),
|
|
"Should remain on login screen after invalid credentials"
|
|
)
|
|
|
|
// Tab bar should NOT appear
|
|
let tabBar = app.tabBars.firstMatch
|
|
XCTAssertFalse(tabBar.exists, "Tab bar should not appear after failed login")
|
|
}
|
|
|
|
// MARK: - Logout
|
|
|
|
func testLogoutFlow() {
|
|
let login = LoginScreen(app: app)
|
|
if login.emailField.waitForExistence(timeout: 15) {
|
|
let user = TestFixtures.TestUser.existing
|
|
login.login(email: user.email, password: user.password)
|
|
}
|
|
|
|
let main = MainTabScreen(app: app)
|
|
guard main.residencesTab.waitForExistence(timeout: 15) else {
|
|
XCTFail("Main screen did not appear")
|
|
return
|
|
}
|
|
|
|
main.logout()
|
|
|
|
// Should be back on login screen
|
|
let loginAfterLogout = LoginScreen(app: app)
|
|
XCTAssertTrue(
|
|
loginAfterLogout.emailField.waitForExistence(timeout: 15),
|
|
"Should return to login screen after logout"
|
|
)
|
|
}
|
|
|
|
// MARK: - Registration Entry
|
|
|
|
func testSignUpButtonNavigatesToRegistration() {
|
|
let login = LoginScreen(app: app)
|
|
guard login.emailField.waitForExistence(timeout: 15) else {
|
|
return // Already logged in, skip
|
|
}
|
|
|
|
let register = login.tapSignUp()
|
|
XCTAssertTrue(register.isDisplayed, "Registration screen should appear after tapping Sign Up")
|
|
}
|
|
|
|
// MARK: - Forgot Password Entry
|
|
|
|
func testForgotPasswordButtonExists() {
|
|
let login = LoginScreen(app: app)
|
|
guard login.emailField.waitForExistence(timeout: 15) else {
|
|
return // Already logged in, skip
|
|
}
|
|
|
|
XCTAssertTrue(
|
|
login.forgotPasswordButton.waitForExistence(timeout: 5),
|
|
"Forgot password button should exist on login screen"
|
|
)
|
|
}
|
|
}
|