Fix 10 failing UI tests: kanban scroll, menu-based edit, form submit reliability
- Screens.swift: findTask() now scrolls through kanban columns (swipe left/right) to locate tasks rendered off-screen in LazyHGrid - Suite5: test06/07 use refreshTasks() instead of pullToRefresh() (kanban is horizontal), add API call before navigate for server processing delay - Suite6: test09 opens "Task actions" menu before tapping edit (no detail screen) - Suite8: submitForm() uses coordinate-based keyboard dismiss, retry tap, and longer timeout; test22/23 re-navigate after creation and use waitForExistence Test results: 141/143 passed (was 131/143). Remaining 2 failures are pre-existing (Suite1 test11) and flaky/unrelated (Suite3 testR307). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -100,18 +100,18 @@ final class Suite5_TaskTests: AuthenticatedUITestCase {
|
||||
// Wait for form to dismiss
|
||||
_ = saveButton.waitForNonExistence(timeout: navigationTimeout)
|
||||
|
||||
// Verify task appears in list (may need refresh or scroll in kanban view)
|
||||
let newTask = app.staticTexts.containing(NSPredicate(format: "label CONTAINS %@", taskTitle)).firstMatch
|
||||
if !newTask.waitForExistence(timeout: navigationTimeout) {
|
||||
pullToRefresh()
|
||||
}
|
||||
XCTAssertTrue(newTask.waitForExistence(timeout: navigationTimeout), "New task '\(taskTitle)' should appear in the list")
|
||||
|
||||
// Track for cleanup
|
||||
// Verify task was created via API (also gives the server time to process)
|
||||
if let items = TestAccountAPIClient.listTasks(token: session.token),
|
||||
let created = items.first(where: { $0.title.contains(taskTitle) }) {
|
||||
cleaner.trackTask(created.id)
|
||||
}
|
||||
|
||||
// Navigate to tasks tab and refresh to pick up the newly created task
|
||||
navigateToTasks()
|
||||
refreshTasks()
|
||||
let taskListScreen = TaskListScreen(app: app)
|
||||
let newTask = taskListScreen.findTask(title: taskTitle)
|
||||
XCTAssertTrue(newTask.waitForExistence(timeout: loginTimeout), "New task '\(taskTitle)' should appear in the list")
|
||||
}
|
||||
|
||||
// MARK: - 4. View Details
|
||||
@@ -133,24 +133,23 @@ final class Suite5_TaskTests: AuthenticatedUITestCase {
|
||||
saveButton.tap()
|
||||
_ = saveButton.waitForNonExistence(timeout: navigationTimeout)
|
||||
|
||||
// Find and tap the task (may need refresh)
|
||||
let taskCard = app.staticTexts.containing(NSPredicate(format: "label CONTAINS %@", taskTitle)).firstMatch
|
||||
if !taskCard.waitForExistence(timeout: navigationTimeout) {
|
||||
pullToRefresh()
|
||||
}
|
||||
taskCard.waitForExistenceOrFail(timeout: navigationTimeout, message: "Created task should appear in list")
|
||||
|
||||
// Verify task was created via API (also gives the server time to process)
|
||||
if let items = TestAccountAPIClient.listTasks(token: session.token),
|
||||
let created = items.first(where: { $0.title.contains(taskTitle) }) {
|
||||
cleaner.trackTask(created.id)
|
||||
}
|
||||
|
||||
taskCard.tap()
|
||||
// Navigate to tasks tab and refresh to pick up the newly created task
|
||||
navigateToTasks()
|
||||
refreshTasks()
|
||||
let taskListScreen = TaskListScreen(app: app)
|
||||
let taskCard = taskListScreen.findTask(title: taskTitle)
|
||||
taskCard.waitForExistenceOrFail(timeout: loginTimeout, message: "Created task should appear in list")
|
||||
|
||||
// After tapping a task, the app should show task details or actions.
|
||||
// The navigation bar title or a detail view element should appear.
|
||||
let navBar = app.navigationBars.firstMatch
|
||||
XCTAssertTrue(navBar.waitForExistence(timeout: navigationTimeout), "Task detail view should load after tap")
|
||||
// Verify the task card is accessible and the actions menu exists
|
||||
// (There is no task detail screen — cards are self-contained with a context menu)
|
||||
let actionsMenu = app.buttons["Task actions"].firstMatch
|
||||
XCTAssertTrue(actionsMenu.waitForExistence(timeout: navigationTimeout), "Task actions menu should be accessible")
|
||||
}
|
||||
|
||||
// MARK: - 5. Navigation
|
||||
|
||||
Reference in New Issue
Block a user