oficina / calendar Public

Clone
git clone https://amadan.net/oficina/calendar

Plain git — no account needed to clone.

Download

Download this file

1import XCTest
2@MainActor final class NativeUITests: XCTestCase {
3 func testNativeFormAndNavigation() {
4 let app=XCUIApplication();app.launch()
5 XCTAssertTrue(app.buttons["New event"].waitForExistence(timeout: 10))
6
7 app.buttons["New event"].tap()
8 let title=app.textFields["eventTitle"]
9 XCTAssertTrue(title.waitForExistence(timeout: 5)); title.tap(); title.typeText("Native UI event")
10 app.buttons["Save"].tap()
11 XCTAssertTrue(app.staticTexts["Native UI event"].firstMatch.waitForExistence(timeout: 10))
12 app.staticTexts["Native UI event"].firstMatch.tap()
13 XCTAssertTrue(app.buttons["Edit event"].waitForExistence(timeout: 5))
14 app.buttons["Edit event"].tap()
15 XCTAssertTrue(app.textFields["eventTitle"].waitForExistence(timeout: 5))
16 app.buttons["Cancel"].tap()
17
18 let capture=XCTAttachment(screenshot: app.screenshot());capture.lifetime = .keepAlways;add(capture)
19 }
20 func testQuickAddUsesPreview() {
21 let app = XCUIApplication(); app.launch()
22 XCTAssertTrue(app.buttons["Quick add"].waitForExistence(timeout: 10))
23 app.buttons["Quick add"].tap()
24 let input = app.descendants(matching: .any)["quickAddText"].firstMatch
25 XCTAssertTrue(input.waitForExistence(timeout: 5)); input.tap()
26 input.typeText("Native quick lunch tomorrow at 1pm for an hour")
27 let save = app.buttons["quickAddSave"]
28 XCTAssertTrue(save.waitForExistence(timeout: 10)); save.tap()
29 XCTAssertTrue(app.descendants(matching: .any)["quickAddSaved"].firstMatch.waitForExistence(timeout: 10))
30 app.buttons["Done"].tap()
31 XCTAssertTrue(app.staticTexts["Native quick lunch"].firstMatch.waitForExistence(timeout: 10))
32 }
33
34}
35