Bucksley / app · bucksley.ai / Apps / iPhoneUITests / BucksleyPhoneUITests.swift
| 1 | import XCTest |
| 2 | |
| 3 | /// Standard Settings on iPhone: the Support Bucksley rows are all free (feedback, share, free |
| 4 | /// technical support, more apps) and nothing in Settings asks for money. |
| 5 | @MainActor |
| 6 | final class BucksleyPhoneUITests: XCTestCase { |
| 7 | override func setUp() { |
| 8 | super.setUp() |
| 9 | continueAfterFailure = false |
| 10 | } |
| 11 | |
| 12 | func testSupportSectionIsFree() throws { |
| 13 | let app = makeApp(screen: "settings") |
| 14 | app.launch() |
| 15 | XCTAssertTrue(app.buttons["settings.theme.afterhours"].waitForExistence(timeout: 10)) |
| 16 | for _ in 0..<6 where !(app.buttons["settings.apps"].exists && app.buttons["settings.apps"].isHittable) { app.swipeUp() } |
| 17 | for id in ["settings.technicalSupport", "settings.review", "settings.share", "settings.apps"] { |
| 18 | XCTAssertTrue(app.buttons[id].exists, id) |
| 19 | } |
| 20 | XCTAssertFalse(app.buttons["settings.tip"].exists) |
| 21 | let money = NSPredicate(format: "label CONTAINS[c] 'tip' OR label CONTAINS '$' OR label CONTAINS[c] 'coffee' OR label CONTAINS[c] 'paid'") |
| 22 | XCTAssertEqual(app.staticTexts.containing(money).count, 0) |
| 23 | capture("Support Bucksley section", app) |
| 24 | } |
| 25 | |
| 26 | private func makeApp(screen: String) -> XCUIApplication { |
| 27 | let app = XCUIApplication() |
| 28 | app.launchEnvironment["BUCKSLEY_SCREEN"] = screen |
| 29 | app.launchEnvironment["BUCKSLEY_NO_ICLOUD"] = "1" |
| 30 | return app |
| 31 | } |
| 32 | |
| 33 | private func capture(_ title: String, _ app: XCUIApplication) { |
| 34 | let attachment = XCTAttachment(screenshot: app.screenshot()) |
| 35 | attachment.name = title |
| 36 | attachment.lifetime = .keepAlways |
| 37 | add(attachment) |
| 38 | } |
| 39 | } |