feat: adult content filter toggle + native New Rule navigation
- Add Block Adult Content toggle to all three rule editors, persisted as BlockingRule.blockAdultContent (inline default for clean migration of existing stores) and surfaced in the detail sheet as an 'Adult websites: Blocked/Allowed' row - Engage Screen Time's adult-website filter (webContent.blockedByFilter = .auto()) alongside the rule's shield and clear it when the shield clears - Replace the New Rule sheet's view-swap with a NavigationStack push (navigationDestination(item:)); the editor uses native chrome there (system back button, inline title, toolbar rename), enabling the push animation and edge-swipe back - Tests: 93 passing (+2 unit: draft round-trip and enforcer forwarding; +3 UI: toggle-to-detail flow, default-allowed row, swipe-back as a behavioral proof of native navigation) - Spec updated accordingly (editor sections, behavior, data model, navigation note)
This commit is contained in:
@@ -85,6 +85,41 @@ final class RuleCreationUITests: XCTestCase {
|
||||
app.buttons["ruleCard-Time Keeper"].waitToAppear()
|
||||
}
|
||||
|
||||
func testAdultContentToggleFlowsToDetail() throws {
|
||||
let app = XCUIApplication.launchSevered()
|
||||
app.buttons["newRuleButton"].waitToAppear().tap()
|
||||
app.buttons["ruleKind-schedule"].waitToAppear().tap()
|
||||
|
||||
app.switches["adultContentToggle"].waitToAppear().tap()
|
||||
app.buttons["holdToCommitButton"].waitToAppear().press(forDuration: 2.0)
|
||||
|
||||
app.buttons["ruleCard-In the Zone"].waitToAppear().tap()
|
||||
let row = app.element("detailRow-Adult websites").waitToAppear()
|
||||
XCTAssertTrue(row.label.contains("Blocked"), "Got: \(row.label)")
|
||||
}
|
||||
|
||||
func testAdultContentDefaultsToAllowed() throws {
|
||||
let app = XCUIApplication.launchSevered(seedScenario: "standard")
|
||||
app.buttons["ruleCard-Work Time"].waitToAppear().tap()
|
||||
let row = app.element("detailRow-Adult websites").waitToAppear()
|
||||
XCTAssertTrue(row.label.contains("Allowed"), "Got: \(row.label)")
|
||||
}
|
||||
|
||||
func testEditorSupportsNativeSwipeBack() throws {
|
||||
let app = XCUIApplication.launchSevered()
|
||||
app.buttons["newRuleButton"].waitToAppear().tap()
|
||||
app.buttons["ruleKind-schedule"].waitToAppear().tap()
|
||||
app.staticTexts["ruleEditorTitle"].waitToAppear()
|
||||
|
||||
// Native push navigation supports the edge-swipe back gesture.
|
||||
let edge = app.coordinate(withNormalizedOffset: CGVector(dx: 0.02, dy: 0.5))
|
||||
let middle = app.coordinate(withNormalizedOffset: CGVector(dx: 0.9, dy: 0.5))
|
||||
edge.press(forDuration: 0.05, thenDragTo: middle)
|
||||
|
||||
app.buttons["ruleKind-schedule"].waitToAppear()
|
||||
XCTAssertTrue(app.staticTexts["New Rule"].exists)
|
||||
}
|
||||
|
||||
func testNewRuleSheetShowsTypesAndPresets() throws {
|
||||
let app = XCUIApplication.launchSevered()
|
||||
app.buttons["newRuleButton"].waitToAppear().tap()
|
||||
|
||||
Reference in New Issue
Block a user