From 9403b30c1d355f2d2da46481384d332e4cb673ad Mon Sep 17 00:00:00 2001 From: Nitya Baddam Date: Tue, 4 Aug 2026 09:59:40 -0700 Subject: [PATCH 1/3] Updating UITests for updates to SupportsDynamicType and updating language in comments to reflect results posting to DevHub now --- RegressionUITests/RegressionUITests.swift | 32 ++++++++++++------- .../TargetedScan/TargetedScanUITests.swift | 18 ++++++++--- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/RegressionUITests/RegressionUITests.swift b/RegressionUITests/RegressionUITests.swift index 3137d45..9c67790 100644 --- a/RegressionUITests/RegressionUITests.swift +++ b/RegressionUITests/RegressionUITests.swift @@ -17,23 +17,23 @@ class RegressionUITests: XCTestCase { axe = try? AxeDevTools.startScanSession(apiKey: Login.APIKey, projectId: Login.projectId) app.launch() - sleep(2) // allow app to fully load, Github actions needed a moment. + sleep(2) // allow app to fully load } - // Iterates through each tab of the sample application and runs an accessibility scan on the screen, then posts it to the dashboard. Contains a few different options for implementing -- feel free to play around with it! + // Iterates through each tab of the sample application and runs an accessibility scan on the screen, then saves it (or posts it to DevHub). Contains a few different options for implementing -- feel free to play around with it! func testHappyPathAccessibility() throws { - // Run a scan on the first page and post the result to the dashboard. + // Run a scan on the first page. try scanForAccessibility(withScanName: "Home") - //navigate to a tab, run a scan, then post to the dashboard let tabBar = XCUIApplication().tabBars["Tab Bar"] + + // Navigate to a tab, run a scan. tabBar.buttons["Catalog"].tap() try scanForAccessibility(withScanName: "Catalog") - // FOR DEMO: Fail the test if critical accessibility errors are found on the first page. + // FOR DEMO: Fail the test if critical accessibility errors are found on the Catalog page. assertNoCriticalResults() - //navigate to a tab by its title tabBar.buttons["Cart"].tap() try scanForAccessibility(withScanName: "Cart") @@ -41,16 +41,17 @@ class RegressionUITests: XCTestCase { try scanForAccessibility(withScanName: "Profile") } - // A helper method for keeping things cleaner when pushing to the dashboard, or saving a result locally. + // A helper method for keeping things cleaner when saving a result locally, or posting to DevHub. func scanForAccessibility(withScanName name: String = "unnamed scan") throws { guard let result = try axe?.run(onElement: app) else { XCTFail("\n\n🦮 axe DevTools didn't run - Did you add your API key in Login.swift?\n\n") return } lastResult = result - // Post the report to the dashboard - + + // Uncomment the line below to post the report to DevHub // try axe?.postResult(result, withScanName: name) + _ = try axe?.saveResult(result, toPath: "RegressionScans", withFileName: name, withScanName: name) } @@ -59,7 +60,16 @@ class RegressionUITests: XCTestCase { XCTFail("\n\n🦮 axe DevTools didn't run - Did you add your API key in Login.swift?\n\n") return } - let critical = result.failures.filter { $0.impact == .CRITICAL }.count - XCTAssertTrue( critical == 0, "Critical Accessibility Results were found." ) + // KNOWN ISSUE: this app uses fixed font sizes throughout, so every screen + // fails SupportsDynamicType. We allow it here so the check still catches + // anything new -- in your own app you'd fix the fonts instead of allowing it. + let knownIssues = [AxeRuleId.SupportsDynamicType.toString()] + + let critical = result.failures.filter { $0.impact == .CRITICAL } + let unexpected = critical.filter { !knownIssues.contains($0.ruleId) } + + print("🦮 \(critical.count) critical issue(s) found, \(critical.count - unexpected.count) known.") + XCTAssertTrue(unexpected.isEmpty, + "Unexpected critical results: \(unexpected.map(\.ruleId).joined(separator: ", "))") } } diff --git a/axe-devtools-ios-sample-appUITests/TargetedScan/TargetedScanUITests.swift b/axe-devtools-ios-sample-appUITests/TargetedScan/TargetedScanUITests.swift index 60c85d4..0b6203f 100644 --- a/axe-devtools-ios-sample-appUITests/TargetedScan/TargetedScanUITests.swift +++ b/axe-devtools-ios-sample-appUITests/TargetedScan/TargetedScanUITests.swift @@ -57,7 +57,7 @@ final class TargetedScanUITests: XCTestCase { print("šŸ“„ HTML report: \(report.htmlReportPath)") } - /// Scans a couple of screens and uploads each result to the dashboard, showing the + /// Scans a couple of screens and uploads each result to DevHub, showing the /// common reporting options: a custom scan name and tags. func testScanAndUploadToDashboard() throws { let axe = try XCTUnwrap(axe, "axe DevTools didn't start — did you add your API key to Login.swift?") @@ -66,7 +66,7 @@ final class TargetedScanUITests: XCTestCase { try axe.postResult(try axe.run(onElement: app), withScanName: "Home Tab") app.goToTab("Catalog") - // Tags make a scan easy to find and share on the dashboard. + // Tags make a scan easy to find and share on DevHub. try axe.postResult(try axe.run(onElement: app), withTags: ["smoke", "catalog"], withScanName: "Catalog Tab") } @@ -76,7 +76,17 @@ final class TargetedScanUITests: XCTestCase { app.goToTab("Home") let result = try axe.run(onElement: app) - let criticalCount = result.failures.filter { $0.impact == .CRITICAL }.count - XCTAssertEqual(criticalCount, 0, "Found \(criticalCount) critical accessibility issue(s) on the Home screen.") + + // KNOWN ISSUE: this app uses fixed font sizes throughout, so every screen + // fails SupportsDynamicType. We allow it here so the check still catches + // anything new — in your own app you'd fix the fonts instead of allowing it. + let knownIssues = [AxeRuleId.SupportsDynamicType.toString()] + + let critical = result.failures.filter { $0.impact == .CRITICAL } + let unexpected = critical.filter { !knownIssues.contains($0.ruleId) } + + print("🦮 \(critical.count) critical issue(s) found, \(critical.count - unexpected.count) known.") + XCTAssertTrue(unexpected.isEmpty, + "Unexpected critical issues on the Home screen: \(unexpected.map(\.ruleId).joined(separator: ", "))") } } From a44ec3764a5345e2627000d29d740c75b607199d Mon Sep 17 00:00:00 2001 From: Nitya Baddam <56103565+nbaddam@users.noreply.github.com> Date: Wed, 5 Aug 2026 10:10:00 -0700 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- RegressionUITests/RegressionUITests.swift | 2 +- .../TargetedScan/TargetedScanUITests.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/RegressionUITests/RegressionUITests.swift b/RegressionUITests/RegressionUITests.swift index 9c67790..7b01781 100644 --- a/RegressionUITests/RegressionUITests.swift +++ b/RegressionUITests/RegressionUITests.swift @@ -25,7 +25,7 @@ class RegressionUITests: XCTestCase { // Run a scan on the first page. try scanForAccessibility(withScanName: "Home") - let tabBar = XCUIApplication().tabBars["Tab Bar"] + let tabBar = app.tabBars["Tab Bar"] // Navigate to a tab, run a scan. tabBar.buttons["Catalog"].tap() diff --git a/axe-devtools-ios-sample-appUITests/TargetedScan/TargetedScanUITests.swift b/axe-devtools-ios-sample-appUITests/TargetedScan/TargetedScanUITests.swift index 0b6203f..dadb40c 100644 --- a/axe-devtools-ios-sample-appUITests/TargetedScan/TargetedScanUITests.swift +++ b/axe-devtools-ios-sample-appUITests/TargetedScan/TargetedScanUITests.swift @@ -59,7 +59,7 @@ final class TargetedScanUITests: XCTestCase { /// Scans a couple of screens and uploads each result to DevHub, showing the /// common reporting options: a custom scan name and tags. - func testScanAndUploadToDashboard() throws { + func testScanAndUploadToDevHub() throws { let axe = try XCTUnwrap(axe, "axe DevTools didn't start — did you add your API key to Login.swift?") app.goToTab("Home") From 41bcf295e3d68bd9169b9d77dc1343ce45a83cee Mon Sep 17 00:00:00 2001 From: Nitya Baddam Date: Wed, 5 Aug 2026 14:37:07 -0700 Subject: [PATCH 3/3] chore: bump axe-devtools-ios to 4.1.0 --- axe-devtools-ios-sample-app.xcodeproj/project.pbxproj | 2 +- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/axe-devtools-ios-sample-app.xcodeproj/project.pbxproj b/axe-devtools-ios-sample-app.xcodeproj/project.pbxproj index 811c7ed..9c2bccc 100644 --- a/axe-devtools-ios-sample-app.xcodeproj/project.pbxproj +++ b/axe-devtools-ios-sample-app.xcodeproj/project.pbxproj @@ -1179,7 +1179,7 @@ repositoryURL = "https://github.com/dequelabs/axe-devtools-ios"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 4.0.1; + minimumVersion = 4.1.0; }; }; /* End XCRemoteSwiftPackageReference section */ diff --git a/axe-devtools-ios-sample-app.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/axe-devtools-ios-sample-app.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 8a37139..f838403 100644 --- a/axe-devtools-ios-sample-app.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/axe-devtools-ios-sample-app.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,8 +6,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/dequelabs/axe-devtools-ios", "state" : { - "revision" : "c5eb6a87fdb0991364fc7d64025128ba807cc608", - "version" : "4.0.1" + "revision" : "324a1c763f2c02d482a00f7f3c3c1d5e10c6fc54", + "version" : "4.1.0" } } ],