oficina / equipo Public

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

Plain git — no account needed to clone.

Download

Download this file

1import XCTest
2
3final class NeedsYouUITests: XCTestCase {
4 @MainActor func testTodayShowsRunningAndFinishedWithoutAnInboxBadge() {
5 let app = launch("today")
6 XCTAssertTrue(app.staticTexts["Running now"].waitForExistence(timeout: 15))
7 XCTAssertTrue(app.staticTexts["Keep the task list up to date"].exists)
8 for _ in 0..<3 {
9 if app.staticTexts["Explain why the upload stopped"].isHittable { break }
10 app.swipeUp()
11 }
12 XCTAssertTrue(app.staticTexts["Finished today"].isHittable)
13 XCTAssertTrue(app.staticTexts["Explain why the upload stopped"].isHittable)
14 XCTAssertTrue(app.staticTexts["Updating the list after a task finishes"].exists)
15 let tab = app.tabBars.buttons.matching(NSPredicate(format: "label BEGINSWITH %@", "Needs you")).firstMatch
16 XCTAssertFalse((tab.value as? String ?? "").contains("2"))
17 XCTAssertTrue(app.buttons["today-undo-finished"].waitForExistence(timeout: 10))
18 XCTAssertTrue(app.staticTexts["Merged into main at 00:20"].exists)
19 capture("iphone-today")
20 app.buttons["today-undo-finished"].tap()
21 XCTAssertTrue(app.staticTexts["Undo this merge?"].waitForExistence(timeout: 5))
22 XCTAssertTrue(app.staticTexts["Equipo will start a task to revert this merge. From now on, it will ask before every merge in this project."].exists)
23 }
24 @MainActor func testEmptyUsesReviewedWords() {
25 let app = launch("empty")
26 XCTAssertTrue(app.staticTexts["Nothing needs you right now."].waitForExistence(timeout: 15))
27 XCTAssertFalse(app.staticTexts["Running now"].exists)
28 XCTAssertFalse(app.staticTexts["Finished today"].exists)
29 capture("iphone-empty")
30 }
31 @MainActor func testRowsShowThreeActionsAndMergeConfirms() {
32 let app = launch("list")
33 XCTAssertTrue(app.buttons["needs-action-retry"].waitForExistence(timeout: 15))
34 XCTAssertEqual(app.buttons["needs-action-retry"].label, "Try again")
35 XCTAssertEqual(app.buttons["needs-action-merge"].label, "Merge")
36 XCTAssertTrue(app.buttons["Yes, name the team"].waitForExistence(timeout: 15))
37 XCTAssertTrue(app.buttons["Keep it short"].exists)
38 XCTAssertTrue(app.buttons["needs-question-header-question"].exists)
39 XCTAssertFalse(app.staticTexts["NEEDS YOU"].exists)
40 capture("iphone-needs-you")
41 app.buttons["needs-action-merge"].tap()
42 XCTAssertTrue(app.buttons["task-confirm"].waitForExistence(timeout: 5))
43 XCTAssertTrue(app.staticTexts["Keep the sign-in button visible"].exists)
44 capture("iphone-needs-merge-confirmation")
45 }
46 @MainActor func testDecisionRowsKeepSetAsideAndUndo() {
47 let app = launch("list")
48 XCTAssertTrue(app.buttons["needs-action-merge"].waitForExistence(timeout: 15))
49 XCTAssertGreaterThanOrEqual(app.buttons.matching(identifier: "Set aside").count, 2)
50 app.terminate()
51 let aside = launch("aside")
52 XCTAssertTrue(aside.buttons["Undo"].waitForExistence(timeout: 15))
53 XCTAssertFalse(aside.buttons["needs-action-merge"].exists)
54 capture("iphone-needs-aside")
55 }
56 @MainActor func testTodayHidesUndoWithoutTheServerOffer() {
57 let app = launch("today-no-undo")
58 XCTAssertTrue(app.staticTexts["Finished today"].waitForExistence(timeout: 15))
59 XCTAssertFalse(app.buttons["today-undo-finished"].exists)
60 }
61 @MainActor private func launch(_ fixture: String) -> XCUIApplication {
62 let app = XCUIApplication()
63 app.launchEnvironment["EQUIPO_NEEDS_FIXTURE"] = fixture
64 app.launch(); return app
65 }
66 @MainActor private func capture(_ name: String) {
67 let attachment = XCTAttachment(screenshot: XCUIScreen.main.screenshot())
68 attachment.name = name; attachment.lifetime = .keepAlways; add(attachment)
69 }
70}
71