Added comprehensive documentation for the KMM project structure, build commands, and UI testing setup/troubleshooting. Documentation added: - CLAUDE.md: Complete KMM project guide for Claude Code with architecture, build commands, common tasks, and development patterns - iosApp/UI_TESTS_*.md: UI testing strategy, implementation guides, summaries - iosApp/XCUITEST_*.md: XCUITest implementation and debugging guides - iosApp/TEST_FAILURES_ANALYSIS.md: Analysis of common test failures - iosApp/ACCESSIBILITY_IDENTIFIERS_FIX.md: Guide for fixing accessibility issues - iosApp/FIX_TEST_TARGET*.md: Guides for fixing test target configuration - iosApp/fix_test_target.sh: Script to automate test target setup The CLAUDE.md serves as the primary documentation for working with this repository, providing quick access to build commands, architecture overview, and common development tasks for both iOS and Android platforms. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
74 lines
2.2 KiB
Markdown
74 lines
2.2 KiB
Markdown
# MyCrib iOS UI Test Strategy
|
|
|
|
## Current Status: REBUILDING FROM SCRATCH
|
|
|
|
The previous comprehensive tests (50+ tests) were written without proper verification and are failing. We're now taking a methodical approach.
|
|
|
|
## Phase 1: Foundation Test (IN PROGRESS)
|
|
|
|
### SimpleLoginTest.swift
|
|
- ✅ Created with logout-first logic
|
|
- 🔄 Testing in progress
|
|
- Contains 2 basic tests:
|
|
1. `testAppLaunchesAndShowsLoginScreen()` - Verifies app launches and shows login UI
|
|
2. `testCanTypeInLoginFields()` - Verifies we can interact with username/password fields
|
|
|
|
**Key Feature**: `ensureLoggedOut()` helper automatically logs out before each test
|
|
|
|
## Phase 2: Build Working Tests Incrementally
|
|
|
|
Once SimpleLoginTest works, we'll build:
|
|
|
|
### Authentication Tests (Priority 1)
|
|
- Login with valid credentials
|
|
- Login with invalid credentials
|
|
- Logout flow
|
|
- Registration flow
|
|
- Password reset flow
|
|
|
|
### Residence Tests (Priority 2)
|
|
- View residences list
|
|
- Create residence
|
|
- Edit residence
|
|
- Delete residence
|
|
|
|
### Task Tests (Priority 3)
|
|
- View tasks
|
|
- Create task
|
|
- Mark task in progress
|
|
- Complete task
|
|
|
|
## Test Principles
|
|
|
|
1. **Always logout first** - Each test starts from login screen
|
|
2. **Use flexible selectors** - NSPredicate with CONTAINS instead of exact matches
|
|
3. **Wait for elements** - Use `waitForExistence(timeout:)` instead of `sleep()`
|
|
4. **Test one thing** - Each test focuses on a single user flow
|
|
5. **Clean up** - Tests should be independent and repeatable
|
|
|
|
## How to Run Tests
|
|
|
|
### In Xcode (Recommended)
|
|
1. Open `iosApp.xcodeproj`
|
|
2. Select MyCribUITests scheme
|
|
3. Press Cmd+U or click diamond icon next to test
|
|
|
|
### Command Line
|
|
```bash
|
|
xcodebuild test -project iosApp.xcodeproj -scheme MyCribUITests \
|
|
-destination 'platform=iOS Simulator,name=iPhone 17'
|
|
```
|
|
|
|
## Known Issues
|
|
|
|
- Previous comprehensive tests (Comprehensive*Tests.swift) are NOT working
|
|
- AccessibilityIdentifiers may not all be properly set in views
|
|
- Need to verify actual UI structure before writing complex tests
|
|
|
|
## Next Steps
|
|
|
|
1. ✅ Get SimpleLoginTest passing
|
|
2. Add more login/auth tests based on what works
|
|
3. Gradually add residence and task tests
|
|
4. Delete old failing comprehensive tests once new ones work
|