Skip to content

chore: refresh sample app with targeted scan, AutoScan, and HTML report examples#62

Draft
kyleleedq wants to merge 1 commit into
mainfrom
claude/amazing-heyrovsky-9b4fb7
Draft

chore: refresh sample app with targeted scan, AutoScan, and HTML report examples#62
kyleleedq wants to merge 1 commit into
mainfrom
claude/amazing-heyrovsky-9b4fb7

Conversation

@kyleleedq

@kyleleedq kyleleedq commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

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 from docs.deque.com saw 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. Uses startScanSession()run(onElement:), then demonstrates both reporting options: generateHtmlReportAndSummary() (one local HTML report across all tabs) and postResult() (dashboard upload with scan name + tags). Also includes a critical-issue gate example. Credentials come from Login.swift.
  • AutoScan/AutoScanUITests.swift — the zero-code path. A plain XCUITest with no axeDevToolsXCUI import 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 by axe_config.json.
  • Shared/SampleAppNavigation.swift — small XCUIApplication tab-bar helpers to keep both files terse.

Supporting changes:

  • Migrated off the deprecated startSession() to startScanSession() in both the targeted and regression suites.
  • Bumped the axe-devtools-ios SPM dependency to the latest main (4.0.0 line) so the new APIs are available.
  • Added a "Two ways to test" section near the top of the README linking both paths.
  • Removed the old SampleUITests.swift (superseded by the two new files).

Reviewer notes

  • AutoScan ships disabled ("axeAutoScanMode": false in axe_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 open axe_config.json and add credentials before trying AutoScan.
  • Both example paths require credentials to run end-to-end: Login.swift (targeted) and axe_config.json (AutoScan). Both ship with empty placeholders.

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
Copilot AI review requested due to automatic review settings June 18, 2026 21:22
/// AutoScan captures and scans each screen automatically as these gestures run.
func testUserJourney() throws {
for tab in XCUIApplication.sampleTabs {
app.goToTab(tab)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 for axe-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 mentions Login.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
@kyleleedq kyleleedq marked this pull request as draft June 18, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants