chore: refresh sample app with targeted scan, AutoScan, and HTML report examples#62
Draft
kyleleedq wants to merge 1 commit into
Draft
chore: refresh sample app with targeted scan, AutoScan, and HTML report examples#62kyleleedq wants to merge 1 commit into
kyleleedq wants to merge 1 commit into
Conversation
Restructures the UITests into two clearly separated, real-world example flows so readers arriving from docs.deque.com can find each pattern: - TargetedScan/ — on-demand scanning via startScanSession() -> run() -> postResult() and generateHtmlReportAndSummary() (HTML report + dashboard upload). Credentials in Login.swift. - AutoScan/ — zero-code path: a plain XCUITest that just drives the app. The framework auto-captures and scans each screen and writes an HTML report, driven entirely by axe_config.json (ships disabled; flip axeAutoScanMode to true to enable). - Shared/SampleAppNavigation.swift — tab-bar helpers to keep tests terse. Also: - Migrate off the deprecated startSession() to startScanSession() in both the targeted and regression suites. - Bump the axe-devtools-ios SPM dependency to the latest main (4.0.0 line) so the 3.3.0/3.4.0 AutoScan + HTML report APIs are available. - README: add a "Two ways to test" section linking both paths. Refs dequelabs/AttestIOS#2840
kyleleedq
commented
Jun 18, 2026
| /// AutoScan captures and scans each screen automatically as these gestures run. | ||
| func testUserJourney() throws { | ||
| for tab in XCUIApplication.sampleTabs { | ||
| app.goToTab(tab) |
Contributor
Author
There was a problem hiding this comment.
Going to look into building out some of the sample app's functionality in the meantime to see if we can get a more usable sample project
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the iOS sample app’s UI testing examples to reflect newer axe DevTools Mobile capabilities by splitting the previous single UI test suite into two clearer example flows: targeted scanning (explicit run(onElement:) + reporting) and AutoScan (configuration-driven, zero-code scanning + report output).
Changes:
- Added dedicated UITest examples for Targeted scanning and AutoScan, plus shared tab navigation helpers.
- Updated docs to explain the two approaches and where credentials/config live.
- Migrated usage to
startScanSession()and updated the SwiftPM dependency revision foraxe-devtools-ios.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| RegressionUITests/RegressionUITests.swift | Migrates session start to startScanSession() in regression suite. |
| README.md | Adds “Two ways to test” section and updates getting-started instructions. |
| axe-devtools-ios-sample-appUITests/TargetedScan/TargetedScanUITests.swift | New targeted-scanning example tests (explicit scans + HTML report + upload + gating). |
| axe-devtools-ios-sample-appUITests/Shared/SampleAppNavigation.swift | New shared UITest navigation helpers for tab switching. |
| axe-devtools-ios-sample-appUITests/SampleUITests.swift | Removes legacy sample UITest file (superseded by new flows). |
| axe-devtools-ios-sample-appUITests/axe_config.json | Adds AutoScan configuration file (ships with AutoScan disabled). |
| axe-devtools-ios-sample-appUITests/AutoScan/AutoScanUITests.swift | New AutoScan “zero-code” UITest journey example. |
| axe-devtools-ios-sample-app/Login.swift | Clarifies credential usage (targeted scanning vs AutoScan config). |
| axe-devtools-ios-sample-app.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved | Updates axe-devtools-ios dependency revision on main. |
| axe-devtools-ios-sample-app.xcodeproj/project.pbxproj | Wires new UITest files and axe_config.json into the Xcode project/targets. |
Comments suppressed due to low confidence (1)
README.md:48
- The updated "Get Started" steps now say AutoScan credentials live in
axe_config.json, but the Sauce Labs section below still only mentionsLogin.swift. To avoid confusion, align the Sauce Labs instructions with the new two-approach setup (or explicitly call out that Sauce Labs runs the targeted-scanning path).
1. Add your Deque API Key and your axe Developer Hub Project Id to `Login.swift` (for the targeted-scanning tests) and to `axe-devtools-ios-sample-appUITests/axe_config.json` (for the AutoScan tests).
2. Once you have a device or simulator ready to go, open either `TargetedScan/TargetedScanUITests.swift` or `AutoScan/AutoScanUITests.swift`, and tap on the diamond to run the suite. The simulator will launch, and the tests will run.
<img src="doc_img/UITests.png" alt="Shows the click area for running the UI test."/>
### For Automated Testing with Sauce Labs
_Note: This project requires a device on iOS 16.0 or later. Additionally, Virtual Devices running iOS 17.0 may experience hanging during testing. Use an iOS 16.2 Virtual Device to see a successful test run._
To run a test with this project, or to setup your own project, follow our online guide to get started with [XCUITesting on SauceLabs.](https://docs.deque.com/devtools-mobile/ios-example-sauce-labs-xcui)
Assuming you have already downloaded the sample project to your computer:
1. Add your Deque API Key and your axe Developer Hub Project Id to `Login.swift`.
2. Open a Terminal window, enter `cd `, then drag and drop the `axe-devtools-ios-sample-app` from Finder into the Terminal window. Hit return/enter.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+21
to
+24
| /// Taps the tab with the given title and waits briefly for it to settle. | ||
| func goToTab(_ title: String) { | ||
| sampleTabBar.buttons[title].tap() | ||
| } |
Comment on lines
+27
to
+32
| // Start a scan session against the axe Developer Hub. | ||
| // Add your API key and project ID to Login.swift first: | ||
| // • API key: https://axe.deque.com/settings | ||
| // • Project ID: https://axe.deque.com/axe-watcher/projects | ||
| axe = try AxeDevTools.startScanSession(apiKey: Login.APIKey, projectId: Login.projectId) | ||
|
|
Comment on lines
+58
to
+60
| /// Scans each tab and uploads the result to the dashboard, showing the common | ||
| /// reporting options: a custom scan name and tags. | ||
| func testScanAllTabsAndUploadToDashboard() throws { |
Comment on lines
+71
to
+76
| /// Demonstrates gating a build on accessibility: fail if any CRITICAL issues are found. | ||
| func testHomeScreenHasNoCriticalIssues() throws { | ||
| let axe = try XCTUnwrap(axe, "axe DevTools didn't start — did you add your API key to Login.swift?") | ||
|
|
||
| let result = try axe.run(onElement: app) | ||
| let criticalCount = result.failures.filter { $0.impact == .CRITICAL }.count |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The sample app only demonstrated the targeted-testing path with
axe.run(onElement:). AutoScan and HTML report generation were not represented at all, so a reader arriving fromdocs.deque.comsaw an incomplete picture of the SDK.Refs dequelabs/AttestIOS#2840.
What changed
Restructured the UITests into two clearly separated, real-world example flows:
TargetedScan/TargetedScanUITests.swift— the on-demand path. UsesstartScanSession()→run(onElement:), then demonstrates both reporting options:generateHtmlReportAndSummary()(one local HTML report across all tabs) andpostResult()(dashboard upload with scan name + tags). Also includes a critical-issue gate example. Credentials come fromLogin.swift.AutoScan/AutoScanUITests.swift— the zero-code path. A plain XCUITest with noaxeDevToolsXCUIimport and no scan/report calls — it just drives the app. The framework's bundle observer auto-starts AutoScan, captures/de-duplicates each unique screen, and writes an HTML report on bundle finish. Driven entirely byaxe_config.json.Shared/SampleAppNavigation.swift— smallXCUIApplicationtab-bar helpers to keep both files terse.Supporting changes:
startSession()tostartScanSession()in both the targeted and regression suites.axe-devtools-iosSPM dependency to the latestmain(4.0.0 line) so the new APIs are available.SampleUITests.swift(superseded by the two new files).Reviewer notes
"axeAutoScanMode": falseinaxe_config.json). This is intentional: it keeps the targeted-scan tests clean out of the box (the flag enables capture for the whole test bundle) and forces a new user to openaxe_config.jsonand add credentials before trying AutoScan.Login.swift(targeted) andaxe_config.json(AutoScan). Both ship with empty placeholders.