The screens/ gitignore rule was matching Tests iOS/Screens/ on case-insensitive macOS. Anchored to /screens/ (repo root only) so the 7 UI test page object files are no longer ignored. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
75 lines
2.4 KiB
Swift
75 lines
2.4 KiB
Swift
//
|
|
// SettingsScreen.swift
|
|
// Tests iOS
|
|
//
|
|
// Screen object for the Settings tab (Customize + Settings sub-tabs).
|
|
//
|
|
|
|
import XCTest
|
|
|
|
struct SettingsScreen {
|
|
let app: XCUIApplication
|
|
|
|
// MARK: - Elements
|
|
|
|
var settingsHeader: XCUIElement { app.staticTexts["settings_header"] }
|
|
var customizeSegment: XCUIElement { app.buttons["Customize"] }
|
|
var settingsSegment: XCUIElement { app.buttons["Settings"] }
|
|
var upgradeBanner: XCUIElement { app.otherElements["upgrade_banner"] }
|
|
var subscribeButton: XCUIElement { app.buttons["subscribe_button"] }
|
|
var whyUpgradeButton: XCUIElement { app.buttons["why_upgrade_button"] }
|
|
var browseThemesButton: XCUIElement { app.buttons["browse_themes_button"] }
|
|
var clearDataButton: XCUIElement { app.buttons["settings_clear_data"].firstMatch }
|
|
var analyticsToggle: XCUIElement { app.descendants(matching: .any).matching(identifier: "settings_analytics_toggle").firstMatch }
|
|
var showOnboardingButton: XCUIElement { app.buttons["settings_show_onboarding"].firstMatch }
|
|
|
|
// MARK: - Actions
|
|
|
|
func tapCustomizeTab() {
|
|
customizeSegment.tapWhenReady()
|
|
}
|
|
|
|
func tapSettingsTab() {
|
|
settingsSegment.tapWhenReady()
|
|
}
|
|
|
|
func tapClearData() {
|
|
clearDataButton.tapWhenReady()
|
|
}
|
|
|
|
func tapAnalyticsToggle() {
|
|
// Scroll down to find the toggle if needed
|
|
let toggle = app.descendants(matching: .any).matching(identifier: "settings_analytics_toggle").firstMatch
|
|
if !toggle.isHittable {
|
|
app.swipeUp()
|
|
}
|
|
toggle.tapWhenReady()
|
|
}
|
|
|
|
// MARK: - Assertions
|
|
|
|
func assertVisible(file: StaticString = #file, line: UInt = #line) {
|
|
XCTAssertTrue(
|
|
settingsHeader.waitForExistence(timeout: 5),
|
|
"Settings header should be visible",
|
|
file: file, line: line
|
|
)
|
|
}
|
|
|
|
func assertUpgradeBannerVisible(file: StaticString = #file, line: UInt = #line) {
|
|
XCTAssertTrue(
|
|
upgradeBanner.waitForExistence(timeout: 5),
|
|
"Upgrade banner should be visible",
|
|
file: file, line: line
|
|
)
|
|
}
|
|
|
|
func assertUpgradeBannerHidden(file: StaticString = #file, line: UInt = #line) {
|
|
XCTAssertTrue(
|
|
upgradeBanner.waitForDisappearance(timeout: 5),
|
|
"Upgrade banner should be hidden (subscribed)",
|
|
file: file, line: line
|
|
)
|
|
}
|
|
}
|