mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Add swift command for running accessibility tests
This commit is contained in:
committed by
Stefan Ceriu
parent
d3846f1888
commit
ef4a78ce53
@@ -20,29 +20,17 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: nschloe/action-cached-lfs-checkout@f46300cd8952454b9f0a21a3d133d4bd5684cfc2 #v1.2.3
|
- uses: nschloe/action-cached-lfs-checkout@f46300cd8952454b9f0a21a3d133d4bd5684cfc2 #v1.2.3
|
||||||
|
|
||||||
- uses: actions/cache@v5
|
|
||||||
with:
|
|
||||||
path: vendor/bundle
|
|
||||||
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-gems-
|
|
||||||
|
|
||||||
- name: Setup environment
|
- name: Setup environment
|
||||||
run: source ci_scripts/ci_common.sh && setup_github_actions_environment
|
run: source ci_scripts/ci_common.sh && setup_github_actions_environment
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: bundle exec fastlane accessibility_tests
|
run: swift run tools ci accessibility-tests
|
||||||
|
|
||||||
- name: Zip results # for faster upload
|
|
||||||
if: failure()
|
|
||||||
working-directory: fastlane/test_output
|
|
||||||
run: zip -r AccessibilityTests.xcresult.zip AccessibilityTests.xcresult
|
|
||||||
|
|
||||||
- name: Archive artifacts
|
- name: Archive artifacts
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
if: failure()
|
if: failure()
|
||||||
with:
|
with:
|
||||||
name: Results
|
name: Results
|
||||||
path: fastlane/test_output/AccessibilityTests.xcresult.zip
|
path: test_output/AccessibilityTests.xcresult.zip
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
if-no-files-found: ignore
|
if-no-files-found: ignore
|
||||||
|
|||||||
@@ -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")
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import Subprocess
|
|||||||
struct CI: ParsableCommand {
|
struct CI: ParsableCommand {
|
||||||
static let configuration = CommandConfiguration(abstract: "CI workflow commands that can be run both locally and in CI environments.",
|
static let configuration = CommandConfiguration(abstract: "CI workflow commands that can be run both locally and in CI environments.",
|
||||||
subcommands: [
|
subcommands: [
|
||||||
|
AccessibilityTests.self,
|
||||||
UnitTests.self,
|
UnitTests.self,
|
||||||
RunTests.self,
|
RunTests.self,
|
||||||
ConfigureNightly.self
|
ConfigureNightly.self
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ struct UnitTests: AsyncParsableCommand {
|
|||||||
|
|
||||||
// Run preview tests on a smaller device
|
// Run preview tests on a smaller device
|
||||||
do {
|
do {
|
||||||
logger.info("\n🧪 Running preview tests…")
|
logger.info("\n🧪 Running preview tests…\n")
|
||||||
try await RunTests.parse([
|
try await RunTests.parse([
|
||||||
"--scheme", "PreviewTests",
|
"--scheme", "PreviewTests",
|
||||||
"--device", "iPhone SE (3rd generation)",
|
"--device", "iPhone SE (3rd generation)",
|
||||||
|
|||||||
@@ -88,22 +88,6 @@ lane :ui_tests do |options|
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
lane :accessibility_tests do |options|
|
|
||||||
reset_simulator = ENV.key?('CI')
|
|
||||||
|
|
||||||
run_tests(
|
|
||||||
scheme: "AccessibilityTests",
|
|
||||||
device: "iPhone 17 (#{simulator_version})",
|
|
||||||
ensure_devices_found: true,
|
|
||||||
prelaunch_simulator: false,
|
|
||||||
result_bundle: true,
|
|
||||||
number_of_retries: 0,
|
|
||||||
reset_simulator: reset_simulator,
|
|
||||||
xcodebuild_formatter: "xcbeautify --quiet --is-ci --renderer github-actions"
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
lane :integration_tests do
|
lane :integration_tests do
|
||||||
clear_derived_data()
|
clear_derived_data()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user