feat: add unit tests for models and ListStore and UI test for adding a todo
This commit is contained in:
52
MindDumpUITests/MindDumpUITests.swift
Normal file
52
MindDumpUITests/MindDumpUITests.swift
Normal file
@@ -0,0 +1,52 @@
|
||||
import XCTest
|
||||
|
||||
final class MindDumpUITests: XCTestCase {
|
||||
|
||||
override func setUpWithError() throws {
|
||||
continueAfterFailure = false
|
||||
}
|
||||
|
||||
/// Tapping the MindDumpButton, entering a title and saving should show the entry in the list
|
||||
@MainActor
|
||||
func testQuickDump_createsEntry() throws {
|
||||
let app = XCUIApplication()
|
||||
app.launchArguments = ["UI_TESTING"]
|
||||
app.launch()
|
||||
|
||||
// Tap the MindDumpButton button
|
||||
app.buttons["🧠"].tap()
|
||||
|
||||
// Type a title in the editor sheet
|
||||
let titleField = app.textFields["Titel"]
|
||||
XCTAssertTrue(titleField.waitForExistence(timeout: 2))
|
||||
titleField.typeText("UI Test Eintrag")
|
||||
|
||||
// Add a note
|
||||
app.buttons["Notiz"].tap()
|
||||
let noteField = app.textFields["Notiz hinzufügen..."]
|
||||
XCTAssertTrue(noteField.waitForExistence(timeout: 2))
|
||||
noteField.tap()
|
||||
noteField.typeText("Wichtige Notiz")
|
||||
|
||||
// Add high priority — tap the add-field button, then the picker row, then the option
|
||||
app.buttons["Priorität"].tap()
|
||||
app.buttons["Priorität, 🟡 Mittel"].tap()
|
||||
app.buttons["🔴 Hoch"].tap()
|
||||
|
||||
// Tap "Fertig" to save
|
||||
app.buttons["Fertig"].tap()
|
||||
|
||||
// Navigate into Inbox to see the entry
|
||||
app.staticTexts["Inbox"].tap()
|
||||
|
||||
// Verify the entry appears in the list
|
||||
let entryExists = app.descendants(matching: .any)["UI Test Eintrag"].waitForExistence(timeout: 3)
|
||||
XCTAssertTrue(entryExists, "Entry title should be visible")
|
||||
|
||||
// Verify the note snippet is shown below the title
|
||||
XCTAssertTrue(app.descendants(matching: .any)["Wichtige Notiz"].exists, "Note should be visible")
|
||||
|
||||
// Verify the red priority dot is shown
|
||||
XCTAssertTrue(app.images["circle.fill"].exists, "Priority dot should be visible")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user