mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-22 04:40:44 +02:00
feat(ios-qa): adaptive XCUITest runner that reaches nested controls and verifies taps
JSON-driven XCUITest runner plus SwiftUI/UIKit fixture apps that drive a real app by bundle id. The runner resolves the actual switch inside a SwiftUI Toggle wrapper, and when a center tap misses the full-width row it retries on the control's trailing edge via an element-anchored normalized offset (adaptive, not a raw screen coordinate), then verifies the switch value actually changed. A tap that silently does nothing is now reported as an interaction failure, not a false product defect. Validated on the simulator and on a physical iPhone. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
466b1ec744
commit
c2ac1f32c0
Vendored
+79
@@ -0,0 +1,79 @@
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct AdaptiveSwiftUIFixtureApp: App {
|
||||
var body: some Scene { WindowGroup { GalleryView() } }
|
||||
}
|
||||
|
||||
private struct GalleryView: View {
|
||||
@State private var count = 0
|
||||
@State private var query = ""
|
||||
@State private var showingSheet = false
|
||||
@State private var showingAlert = false
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
List {
|
||||
Section("Actions") {
|
||||
Button("Increment") { count += 1 }
|
||||
.accessibilityIdentifier("swiftui.increment")
|
||||
Text("Count: \(count)")
|
||||
.accessibilityIdentifier("swiftui.count")
|
||||
Button("Unavailable") {}
|
||||
.disabled(true)
|
||||
.accessibilityIdentifier("swiftui.disabled")
|
||||
Button("Show sheet") { showingSheet = true }
|
||||
.accessibilityIdentifier("swiftui.sheet.open")
|
||||
Button("Show alert") { showingAlert = true }
|
||||
.accessibilityIdentifier("swiftui.alert.open")
|
||||
}
|
||||
|
||||
Section("Input") {
|
||||
TextField("Search terms", text: $query)
|
||||
.textInputAutocapitalization(.never)
|
||||
.accessibilityIdentifier("swiftui.search")
|
||||
Text("Echo: \(query)")
|
||||
.accessibilityIdentifier("swiftui.echo")
|
||||
}
|
||||
|
||||
Section("Nested horizontal scroll") {
|
||||
ScrollView(.horizontal) {
|
||||
HStack {
|
||||
ForEach(0..<12) { index in
|
||||
Button("Card \(index)") {}
|
||||
.buttonStyle(.bordered)
|
||||
.accessibilityIdentifier("swiftui.card.\(index)")
|
||||
}
|
||||
}
|
||||
}
|
||||
.accessibilityIdentifier("swiftui.horizontal-scroll")
|
||||
}
|
||||
|
||||
Section("Long vertical list") {
|
||||
ForEach(0..<35) { index in
|
||||
NavigationLink("Row \(index)") {
|
||||
Text("Detail \(index)")
|
||||
.accessibilityIdentifier("swiftui.detail.\(index)")
|
||||
}
|
||||
.accessibilityIdentifier("swiftui.row.\(index)")
|
||||
}
|
||||
}
|
||||
}
|
||||
.accessibilityIdentifier("swiftui.list")
|
||||
.navigationTitle("SwiftUI Gallery")
|
||||
.sheet(isPresented: $showingSheet) {
|
||||
NavigationStack {
|
||||
Text("Sheet content").accessibilityIdentifier("swiftui.sheet.content")
|
||||
.toolbar {
|
||||
Button("Done") { showingSheet = false }
|
||||
.accessibilityIdentifier("swiftui.sheet.done")
|
||||
}
|
||||
}
|
||||
}
|
||||
.alert("Confirm action", isPresented: $showingAlert) {
|
||||
Button("Cancel", role: .cancel) {}
|
||||
Button("Confirm") { count += 10 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>SwiftUI QA Gallery</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>UILaunchScreen</key>
|
||||
<dict/>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
Reference in New Issue
Block a user