Skip to content

Commit

Permalink
Merge pull request #2551 from leancodepl/add-os-version-to-destination
Browse files Browse the repository at this point in the history
Add os version to destination in xcodebuild test-without-building
  • Loading branch information
pdenert authored Mar 4, 2025
2 parents 5c272a9 + 8097c0c commit 8e93ded
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/patrol_cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased

- Add `--ios` flag to `patrol test` that specifies the iOS version to use. (#2540)

## 3.5.1

- Gracefully handle when analytics fail to send. (#2460)
Expand Down
1 change: 1 addition & 0 deletions packages/patrol_cli/lib/src/commands/build_ios.dart
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class BuildIOSCommand extends PatrolCommand {
scheme: flutterOpts.buildMode.createScheme(flavor),
configuration: flutterOpts.buildMode.createConfiguration(flavor),
simulator: boolArg('simulator'),
osVersion: stringArg('ios') ?? 'latest',
appServerPort: super.appServerPort,
testServerPort: super.testServerPort,
clearPermissions: boolArg('clear-permissions'),
Expand Down
1 change: 1 addition & 0 deletions packages/patrol_cli/lib/src/commands/develop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ class DevelopCommand extends PatrolCommand {
scheme: buildMode.createScheme(iosFlavor),
configuration: buildMode.createConfiguration(iosFlavor),
simulator: !device.real,
osVersion: stringArg('ios') ?? 'latest',
appServerPort: super.appServerPort,
testServerPort: super.testServerPort,
);
Expand Down
1 change: 1 addition & 0 deletions packages/patrol_cli/lib/src/commands/test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ See https://github.com/leancodepl/patrol/issues/1316 to learn more.
scheme: buildMode.createScheme(iosFlavor),
configuration: buildMode.createConfiguration(iosFlavor),
simulator: !device.real,
osVersion: stringArg('ios') ?? 'latest',
appServerPort: super.appServerPort,
testServerPort: super.testServerPort,
clearPermissions: boolArg('clear-permissions'),
Expand Down
4 changes: 3 additions & 1 deletion packages/patrol_cli/lib/src/crossplatform/app_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ class IOSAppOptions {
required this.scheme,
required this.configuration,
required this.simulator,
required this.osVersion,
required this.appServerPort,
required this.testServerPort,
this.clearPermissions = false,
Expand All @@ -199,6 +200,7 @@ class IOSAppOptions {
final String? bundleId;
final String scheme;
final String configuration;
final String osVersion;
final bool simulator;
final int appServerPort;
final int testServerPort;
Expand Down Expand Up @@ -274,7 +276,7 @@ class IOSAppOptions {
...['-only-testing', 'RunnerUITests/RunnerUITests'],
...[
'-destination',
'platform=${device.real ? 'iOS' : 'iOS Simulator'},name=${device.name}',
'platform=${device.real ? 'iOS' : 'iOS Simulator'},name=${device.name},OS=$osVersion',
],
...['-destination-timeout', '1'],
...['-resultBundlePath', resultBundlePath],
Expand Down
5 changes: 5 additions & 0 deletions packages/patrol_cli/lib/src/runner/patrol_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ abstract class PatrolCommand extends Command<int> {
help:
'Clear permissions available through XCUIProtectedResource API before running each test.',
negatable: false,
)
..addOption(
'ios',
help: 'Pass iOS version. If empty, `latest` will be used.',
valueHelp: '17.5',
);
}

Expand Down
7 changes: 5 additions & 2 deletions packages/patrol_cli/test/crossplatform/app_options_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ void main() {
scheme: 'Runner',
configuration: 'Debug',
simulator: true,
osVersion: 'latest',
testServerPort: 8081,
appServerPort: 8082,
);
Expand Down Expand Up @@ -256,7 +257,7 @@ void main() {
...['xcodebuild', 'test-without-building'],
...['-xctestrun', xcTestRunPath],
...['-only-testing', 'RunnerUITests/RunnerUITests'],
...['-destination', 'platform=iOS,name=iPhone 13'],
...['-destination', 'platform=iOS,name=iPhone 13,OS=latest'],
...['-destination-timeout', '1'],
...['-resultBundlePath', ''],
]),
Expand All @@ -282,6 +283,7 @@ void main() {
scheme: 'Runner',
configuration: 'Debug',
simulator: true,
osVersion: '17.5',
testServerPort: 8081,
appServerPort: 8082,
);
Expand Down Expand Up @@ -337,7 +339,7 @@ void main() {
...['xcodebuild', 'test-without-building'],
...['-xctestrun', xcTestRunPath],
...['-only-testing', 'RunnerUITests/RunnerUITests'],
...['-destination', 'platform=iOS,name=iPhone 13'],
...['-destination', 'platform=iOS,name=iPhone 13,OS=17.5'],
...['-destination-timeout', '1'],
...['-resultBundlePath', ''],
]),
Expand Down Expand Up @@ -367,6 +369,7 @@ void main() {
scheme: 'prod',
configuration: 'Release-prod',
simulator: false,
osVersion: '18.0',
testServerPort: 8081,
appServerPort: 8082,
);
Expand Down

0 comments on commit 8e93ded

Please sign in to comment.