Add swift command for running accessibility tests

This commit is contained in:
Stefan Ceriu
2026-02-27 10:02:58 +02:00
committed by Stefan Ceriu
parent 2d60a2b755
commit 17189bf968
5 changed files with 44 additions and 31 deletions

View File

@@ -0,0 +1,40 @@
import ArgumentParser
import CommandLineTools
import Foundation
struct AccessibilityTests: AsyncParsableCommand {
static let configuration = CommandConfiguration(commandName: "accessibility-tests",
abstract: "Runs the accessibility test CI workflow.")
@Option(help: "Device name for tests.")
var device = "iPhone 17"
@Option(help: "iOS version for the simulator.")
var osVersion = "26.1"
func run() async throws {
var testsFailed = false
do {
logger.info("\n🧪 Running accessibility tests…\n")
try await RunTests.parse([
"--scheme", "AccessibilityTests",
"--device", device,
"--os-version", osVersion,
"--retries", "0"
]).run()
} catch {
testsFailed = true
logger.error("\n❌ Accessibility tests failed.\n")
}
// Zip results (best-effort, useful for CI artifact uploads)
await CI.zipResults(bundles: ["AccessibilityTests.xcresult"],
outputName: "AccessibilityTests.xcresult.zip")
if testsFailed {
throw ExitCode.failure
}
logger.info("\n✅ Accessibility tests passed.\n")
}
}

View File

@@ -5,6 +5,7 @@ import Subprocess
struct CI: ParsableCommand {
static let configuration = CommandConfiguration(abstract: "CI workflow commands that can be run both locally and in CI environments.",
subcommands: [
AccessibilityTests.self,
UnitTests.self,
RunTests.self,
ConfigureNightly.self

View File

@@ -33,7 +33,7 @@ struct UnitTests: AsyncParsableCommand {
// Run preview tests on a smaller device
do {
logger.info("\n🧪 Running preview tests…")
logger.info("\n🧪 Running preview tests…\n")
try await RunTests.parse([
"--scheme", "PreviewTests",
"--device", "iPhone SE (3rd generation)",