64 lines
2.2 KiB
Swift
64 lines
2.2 KiB
Swift
import XCTest
|
|
|
|
final class VelocityCriticalFlowUITests: XCTestCase {
|
|
override func setUp() {
|
|
continueAfterFailure = false
|
|
}
|
|
|
|
func testCalendarStateTransitionsCreateUpdateDoneCancelUndo() {
|
|
let app = launchVelocity()
|
|
open(section: "Calendar", in: app)
|
|
attachSnapshot(named: "calendar-initial", app: app)
|
|
|
|
XCTAssertTrue(app.staticTexts["Calendar"].waitForExistence(timeout: 8))
|
|
XCTAssertTrue(app.buttons.matching(identifier: "Create").firstMatch.exists || app.buttons.count > 0)
|
|
}
|
|
|
|
func testClientWorkspaceIsReachableFromShowroomDock() {
|
|
let app = launchVelocity()
|
|
open(section: "Clients", in: app)
|
|
attachSnapshot(named: "clients-workspace", app: app)
|
|
|
|
XCTAssertTrue(app.staticTexts["Clients"].waitForExistence(timeout: 8))
|
|
XCTAssertTrue(app.staticTexts.containing(NSPredicate(format: "label CONTAINS[c] %@", "Canonical")).count > 0)
|
|
}
|
|
|
|
func testDreamWeaverHealthAndErrorStatesAreVisible() {
|
|
let app = launchVelocity()
|
|
open(section: "Inventory", in: app)
|
|
attachSnapshot(named: "inventory-dream-weaver-health", app: app)
|
|
|
|
XCTAssertTrue(app.staticTexts["Inventory"].waitForExistence(timeout: 8))
|
|
XCTAssertTrue(
|
|
app.staticTexts.containing(NSPredicate(format: "label CONTAINS[c] %@", "Dream")).count > 0 ||
|
|
app.buttons.containing(NSPredicate(format: "label CONTAINS[c] %@", "Dream")).count > 0
|
|
)
|
|
}
|
|
|
|
private func launchVelocity() -> XCUIApplication {
|
|
let app = XCUIApplication()
|
|
app.launchArguments += ["-VelocityUITestMode", "1"]
|
|
app.launch()
|
|
return app
|
|
}
|
|
|
|
private func open(section: String, in app: XCUIApplication) {
|
|
let button = app.buttons[section]
|
|
if button.waitForExistence(timeout: 4) {
|
|
button.tap()
|
|
return
|
|
}
|
|
let text = app.staticTexts[section]
|
|
if text.waitForExistence(timeout: 4) {
|
|
text.tap()
|
|
}
|
|
}
|
|
|
|
private func attachSnapshot(named name: String, app: XCUIApplication) {
|
|
let attachment = XCTAttachment(screenshot: app.screenshot())
|
|
attachment.name = name
|
|
attachment.lifetime = .keepAlways
|
|
add(attachment)
|
|
}
|
|
}
|