Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Normal/App/NormalApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ struct NormalApp: App {
context.insert(Key(name: "Test Key", type: .qr, rawValue: UITestSupport.stubScanValue))
}
if UITestSupport.seedGroupKey {
let group = AppGroup(name: "Test Group", selection: FamilyActivitySelection())
let group = AppGroup(
id: UITestSupport.seedGroupID,
name: "Test Group",
selection: FamilyActivitySelection()
)
context.insert(group)
context.insert(Key(name: "Group Key", type: .qr, rawValue: "GROUP-VALUE", groupID: group.id))
}
Expand Down
2 changes: 2 additions & 0 deletions Normal/App/UITestSupport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ enum UITestSupport {

static let seedGroupKey = arguments.contains("-uiTestSeedGroupKey")

static let seedGroupID = UUID(uuidString: "6E0A1C9B-2D4F-4B7A-9C3E-5F8D1A2B3C4D")!

static let skipBypassConfirm = arguments.contains("-uiTestSkipBypassConfirm")

static let unblockDurationSeconds: [Int]? = value(after: "-uiTestUnblockDurations")?
Expand Down
19 changes: 19 additions & 0 deletions NormalUITests/BlockingUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,25 @@ final class BlockingUITests: XCTestCase {
require(app.buttons["group.blockButton"], "Group should be unblocked again")
}

func testUnlockLinkDuringBypassConfirmationFallsBackToKeySelection() throws {
let app = launch(["-uiTestSeedGroupKey"])
let groupID = "6E0A1C9B-2D4F-4B7A-9C3E-5F8D1A2B3C4D"

app.open(try XCTUnwrap(URL(string: "normal://block?group=\(groupID)")))
let bypass = app.buttons["keySelect.blockWithoutKey"]
require(bypass, "Block link should offer bypass")
bypass.tap()
let confirm = app.buttons["keySelect.confirmBlockWithoutKey"]
require(confirm, "Bypass confirmation should appear")

app.open(try XCTUnwrap(URL(string: "normal://unlock?group=\(groupID)&duration=3600")))

XCTAssertTrue(confirm.waitForNonExistence(timeout: timeout), "Unlock link should dismiss the bypass confirmation")
require(app.buttons["keySelect.row.QR"], "Unlock link should ask for a key")
XCTAssertFalse(bypass.exists, "Unlock should not offer a keyless path")
XCTAssertTrue(app.buttons["group.blockButton"].exists, "Group state should be untouched")
}

func testSeededScheduleAppears() {
let app = launch(["-uiTestSeedSchedule"])

Expand Down
Loading