diff --git a/release_notes.md b/release_notes.md index 172977063e..d2832ae85e 100644 --- a/release_notes.md +++ b/release_notes.md @@ -8,7 +8,7 @@ - [#904](https://github.com/Flank/flank/pull/904) Added option to print provided software. ([piotradamczyk5](https://github.com/piotradamczyk5)) - [#906](https://github.com/Flank/flank/pull/906) Added option to print network profiles. ([adamfilipow92](https://github.com/adamfilipow92)) - [#908](https://github.com/Flank/flank/pull/908) Added option to print iOS available locales to test against. ([piotradamczyk5](https://github.com/piotradamczyk5)) -- +- [#906](https://github.com/Flank/flank/pull/909) Added option to print iOS and Android screen orientations. ([adamfilipow92](https://github.com/adamfilipow92)) - ## v20.07.0 diff --git a/test_runner/docs/ascii/flank.jar_-android-orientations-list.adoc b/test_runner/docs/ascii/flank.jar_-android-orientations-list.adoc new file mode 100644 index 0000000000..fb62c5899f --- /dev/null +++ b/test_runner/docs/ascii/flank.jar_-android-orientations-list.adoc @@ -0,0 +1,37 @@ +// tag::picocli-generated-full-manpage[] + +// tag::picocli-generated-man-section-name[] +== Name + +flank.jar +-android-orientations-list - List of device orientations available to test against + +// end::picocli-generated-man-section-name[] + +// tag::picocli-generated-man-section-synopsis[] +== Synopsis + +*flank.jar + android orientations list* [*-h*] [*-c*=__] + +// end::picocli-generated-man-section-synopsis[] + +// tag::picocli-generated-man-section-description[] +== Description + +Print current list of Android orientations available to test against + +// end::picocli-generated-man-section-description[] + +// tag::picocli-generated-man-section-options[] +== Options + +*-c*, *--config*=__:: + YAML config file path + +*-h*, *--help*:: + Prints this help message + +// end::picocli-generated-man-section-options[] + +// end::picocli-generated-full-manpage[] \ No newline at end of file diff --git a/test_runner/docs/ascii/flank.jar_-android-orientations.adoc b/test_runner/docs/ascii/flank.jar_-android-orientations.adoc new file mode 100644 index 0000000000..582f589903 --- /dev/null +++ b/test_runner/docs/ascii/flank.jar_-android-orientations.adoc @@ -0,0 +1,34 @@ +// tag::picocli-generated-full-manpage[] + +// tag::picocli-generated-man-section-name[] +== Name + +flank.jar +-android-orientations - Information about available orientations + +// end::picocli-generated-man-section-name[] + +// tag::picocli-generated-man-section-synopsis[] +== Synopsis + +*flank.jar + android orientations* [COMMAND] + +// end::picocli-generated-man-section-synopsis[] + +// tag::picocli-generated-man-section-description[] +== Description + +Prints list of available orientations + +// end::picocli-generated-man-section-description[] + +// tag::picocli-generated-man-section-commands[] +== Commands + +*list*:: + List of device orientations available to test against + +// end::picocli-generated-man-section-commands[] + +// end::picocli-generated-full-manpage[] \ No newline at end of file diff --git a/test_runner/docs/ascii/flank.jar_-android.adoc b/test_runner/docs/ascii/flank.jar_-android.adoc index 0087dcc265..bb3b9fe3bf 100644 --- a/test_runner/docs/ascii/flank.jar_-android.adoc +++ b/test_runner/docs/ascii/flank.jar_-android.adoc @@ -41,6 +41,9 @@ flank.jar *test-environment*:: Print available devices, OS versions, provided software list and network configuration to test against +*orientations*:: + Information about available orientations + // end::picocli-generated-man-section-commands[] // end::picocli-generated-full-manpage[] \ No newline at end of file diff --git a/test_runner/docs/ascii/flank.jar_-firebase-test-android-orientations-list.adoc b/test_runner/docs/ascii/flank.jar_-firebase-test-android-orientations-list.adoc new file mode 100644 index 0000000000..7d37f6f81b --- /dev/null +++ b/test_runner/docs/ascii/flank.jar_-firebase-test-android-orientations-list.adoc @@ -0,0 +1,37 @@ +// tag::picocli-generated-full-manpage[] + +// tag::picocli-generated-man-section-name[] +== Name + +flank.jar +-firebase-test-android-orientations-list - List of device orientations available to test against + +// end::picocli-generated-man-section-name[] + +// tag::picocli-generated-man-section-synopsis[] +== Synopsis + +*flank.jar + firebase test android orientations list* [*-h*] [*-c*=__] + +// end::picocli-generated-man-section-synopsis[] + +// tag::picocli-generated-man-section-description[] +== Description + +Print current list of Android orientations available to test against + +// end::picocli-generated-man-section-description[] + +// tag::picocli-generated-man-section-options[] +== Options + +*-c*, *--config*=__:: + YAML config file path + +*-h*, *--help*:: + Prints this help message + +// end::picocli-generated-man-section-options[] + +// end::picocli-generated-full-manpage[] \ No newline at end of file diff --git a/test_runner/docs/ascii/flank.jar_-firebase-test-android-orientations.adoc b/test_runner/docs/ascii/flank.jar_-firebase-test-android-orientations.adoc new file mode 100644 index 0000000000..5072a97167 --- /dev/null +++ b/test_runner/docs/ascii/flank.jar_-firebase-test-android-orientations.adoc @@ -0,0 +1,34 @@ +// tag::picocli-generated-full-manpage[] + +// tag::picocli-generated-man-section-name[] +== Name + +flank.jar +-firebase-test-android-orientations - Information about available orientations + +// end::picocli-generated-man-section-name[] + +// tag::picocli-generated-man-section-synopsis[] +== Synopsis + +*flank.jar + firebase test android orientations* [COMMAND] + +// end::picocli-generated-man-section-synopsis[] + +// tag::picocli-generated-man-section-description[] +== Description + +Prints list of available orientations + +// end::picocli-generated-man-section-description[] + +// tag::picocli-generated-man-section-commands[] +== Commands + +*list*:: + List of device orientations available to test against + +// end::picocli-generated-man-section-commands[] + +// end::picocli-generated-full-manpage[] \ No newline at end of file diff --git a/test_runner/docs/ascii/flank.jar_-firebase-test-android.adoc b/test_runner/docs/ascii/flank.jar_-firebase-test-android.adoc index 19b5eb7916..61f40b50c0 100644 --- a/test_runner/docs/ascii/flank.jar_-firebase-test-android.adoc +++ b/test_runner/docs/ascii/flank.jar_-firebase-test-android.adoc @@ -41,6 +41,9 @@ flank.jar *test-environment*:: Print available devices, OS versions, provided software list and network configuration to test against +*orientations*:: + Information about available orientations + // end::picocli-generated-man-section-commands[] // end::picocli-generated-full-manpage[] \ No newline at end of file diff --git a/test_runner/docs/ascii/flank.jar_-firebase-test-ios-locales-list.adoc b/test_runner/docs/ascii/flank.jar_-firebase-test-ios-locales-list.adoc new file mode 100644 index 0000000000..5aed203b0a --- /dev/null +++ b/test_runner/docs/ascii/flank.jar_-firebase-test-ios-locales-list.adoc @@ -0,0 +1,37 @@ +// tag::picocli-generated-full-manpage[] + +// tag::picocli-generated-man-section-name[] +== Name + +flank.jar +-firebase-test-ios-locales-list - Print current list of locales available to test against + +// end::picocli-generated-man-section-name[] + +// tag::picocli-generated-man-section-synopsis[] +== Synopsis + +*flank.jar + firebase test ios locales list* [*-h*] [*-c*=__] + +// end::picocli-generated-man-section-synopsis[] + +// tag::picocli-generated-man-section-description[] +== Description + +Print current list of iOS locales available to test against + +// end::picocli-generated-man-section-description[] + +// tag::picocli-generated-man-section-options[] +== Options + +*-c*, *--config*=__:: + YAML config file path + +*-h*, *--help*:: + Prints this help message + +// end::picocli-generated-man-section-options[] + +// end::picocli-generated-full-manpage[] \ No newline at end of file diff --git a/test_runner/docs/ascii/flank.jar_-firebase-test-ios-locales.adoc b/test_runner/docs/ascii/flank.jar_-firebase-test-ios-locales.adoc new file mode 100644 index 0000000000..0b1d8bb6c7 --- /dev/null +++ b/test_runner/docs/ascii/flank.jar_-firebase-test-ios-locales.adoc @@ -0,0 +1,34 @@ +// tag::picocli-generated-full-manpage[] + +// tag::picocli-generated-man-section-name[] +== Name + +flank.jar +-firebase-test-ios-locales - Information about available locales on device + +// end::picocli-generated-man-section-name[] + +// tag::picocli-generated-man-section-synopsis[] +== Synopsis + +*flank.jar + firebase test ios locales* [COMMAND] + +// end::picocli-generated-man-section-synopsis[] + +// tag::picocli-generated-man-section-description[] +== Description + +Information about available locales on device. For example prints list of available locales to test against + +// end::picocli-generated-man-section-description[] + +// tag::picocli-generated-man-section-commands[] +== Commands + +*list*:: + Print current list of locales available to test against + +// end::picocli-generated-man-section-commands[] + +// end::picocli-generated-full-manpage[] \ No newline at end of file diff --git a/test_runner/docs/ascii/flank.jar_-firebase-test-ios-orientations-list.adoc b/test_runner/docs/ascii/flank.jar_-firebase-test-ios-orientations-list.adoc new file mode 100644 index 0000000000..5431547a2d --- /dev/null +++ b/test_runner/docs/ascii/flank.jar_-firebase-test-ios-orientations-list.adoc @@ -0,0 +1,37 @@ +// tag::picocli-generated-full-manpage[] + +// tag::picocli-generated-man-section-name[] +== Name + +flank.jar +-firebase-test-ios-orientations-list - List of device orientations available to test against + +// end::picocli-generated-man-section-name[] + +// tag::picocli-generated-man-section-synopsis[] +== Synopsis + +*flank.jar + firebase test ios orientations list* [*-h*] [*-c*=__] + +// end::picocli-generated-man-section-synopsis[] + +// tag::picocli-generated-man-section-description[] +== Description + +Print current list of iOS orientations available to test against + +// end::picocli-generated-man-section-description[] + +// tag::picocli-generated-man-section-options[] +== Options + +*-c*, *--config*=__:: + YAML config file path + +*-h*, *--help*:: + Prints this help message + +// end::picocli-generated-man-section-options[] + +// end::picocli-generated-full-manpage[] \ No newline at end of file diff --git a/test_runner/docs/ascii/flank.jar_-firebase-test-ios-orientations.adoc b/test_runner/docs/ascii/flank.jar_-firebase-test-ios-orientations.adoc new file mode 100644 index 0000000000..1fd632df15 --- /dev/null +++ b/test_runner/docs/ascii/flank.jar_-firebase-test-ios-orientations.adoc @@ -0,0 +1,34 @@ +// tag::picocli-generated-full-manpage[] + +// tag::picocli-generated-man-section-name[] +== Name + +flank.jar +-firebase-test-ios-orientations - Information about available orientation versions + +// end::picocli-generated-man-section-name[] + +// tag::picocli-generated-man-section-synopsis[] +== Synopsis + +*flank.jar + firebase test ios orientations* [COMMAND] + +// end::picocli-generated-man-section-synopsis[] + +// tag::picocli-generated-man-section-description[] +== Description + +Prints list of available orientations + +// end::picocli-generated-man-section-description[] + +// tag::picocli-generated-man-section-commands[] +== Commands + +*list*:: + List of device orientations available to test against + +// end::picocli-generated-man-section-commands[] + +// end::picocli-generated-full-manpage[] \ No newline at end of file diff --git a/test_runner/docs/ascii/flank.jar_-firebase-test-ios.adoc b/test_runner/docs/ascii/flank.jar_-firebase-test-ios.adoc index 8833be8b45..602f007d7d 100644 --- a/test_runner/docs/ascii/flank.jar_-firebase-test-ios.adoc +++ b/test_runner/docs/ascii/flank.jar_-firebase-test-ios.adoc @@ -44,6 +44,9 @@ flank.jar *test-environment*:: Print available devices, OS versions, locales, provided software list and network configuration to test against +*orientations*:: + Information about available orientation versions + // end::picocli-generated-man-section-commands[] // end::picocli-generated-full-manpage[] \ No newline at end of file diff --git a/test_runner/docs/ascii/flank.jar_-ios-locales-list.adoc b/test_runner/docs/ascii/flank.jar_-ios-locales-list.adoc new file mode 100644 index 0000000000..6e7c73fc6c --- /dev/null +++ b/test_runner/docs/ascii/flank.jar_-ios-locales-list.adoc @@ -0,0 +1,37 @@ +// tag::picocli-generated-full-manpage[] + +// tag::picocli-generated-man-section-name[] +== Name + +flank.jar +-ios-locales-list - Print current list of locales available to test against + +// end::picocli-generated-man-section-name[] + +// tag::picocli-generated-man-section-synopsis[] +== Synopsis + +*flank.jar + ios locales list* [*-h*] [*-c*=__] + +// end::picocli-generated-man-section-synopsis[] + +// tag::picocli-generated-man-section-description[] +== Description + +Print current list of iOS locales available to test against + +// end::picocli-generated-man-section-description[] + +// tag::picocli-generated-man-section-options[] +== Options + +*-c*, *--config*=__:: + YAML config file path + +*-h*, *--help*:: + Prints this help message + +// end::picocli-generated-man-section-options[] + +// end::picocli-generated-full-manpage[] \ No newline at end of file diff --git a/test_runner/docs/ascii/flank.jar_-ios-locales.adoc b/test_runner/docs/ascii/flank.jar_-ios-locales.adoc new file mode 100644 index 0000000000..84936cf202 --- /dev/null +++ b/test_runner/docs/ascii/flank.jar_-ios-locales.adoc @@ -0,0 +1,34 @@ +// tag::picocli-generated-full-manpage[] + +// tag::picocli-generated-man-section-name[] +== Name + +flank.jar +-ios-locales - Information about available locales on device + +// end::picocli-generated-man-section-name[] + +// tag::picocli-generated-man-section-synopsis[] +== Synopsis + +*flank.jar + ios locales* [COMMAND] + +// end::picocli-generated-man-section-synopsis[] + +// tag::picocli-generated-man-section-description[] +== Description + +Information about available locales on device. For example prints list of available locales to test against + +// end::picocli-generated-man-section-description[] + +// tag::picocli-generated-man-section-commands[] +== Commands + +*list*:: + Print current list of locales available to test against + +// end::picocli-generated-man-section-commands[] + +// end::picocli-generated-full-manpage[] \ No newline at end of file diff --git a/test_runner/docs/ascii/flank.jar_-ios-orientations-list.adoc b/test_runner/docs/ascii/flank.jar_-ios-orientations-list.adoc new file mode 100644 index 0000000000..4a7ec4779f --- /dev/null +++ b/test_runner/docs/ascii/flank.jar_-ios-orientations-list.adoc @@ -0,0 +1,37 @@ +// tag::picocli-generated-full-manpage[] + +// tag::picocli-generated-man-section-name[] +== Name + +flank.jar +-ios-orientations-list - List of device orientations available to test against + +// end::picocli-generated-man-section-name[] + +// tag::picocli-generated-man-section-synopsis[] +== Synopsis + +*flank.jar + ios orientations list* [*-h*] [*-c*=__] + +// end::picocli-generated-man-section-synopsis[] + +// tag::picocli-generated-man-section-description[] +== Description + +Print current list of iOS orientations available to test against + +// end::picocli-generated-man-section-description[] + +// tag::picocli-generated-man-section-options[] +== Options + +*-c*, *--config*=__:: + YAML config file path + +*-h*, *--help*:: + Prints this help message + +// end::picocli-generated-man-section-options[] + +// end::picocli-generated-full-manpage[] \ No newline at end of file diff --git a/test_runner/docs/ascii/flank.jar_-ios-orientations.adoc b/test_runner/docs/ascii/flank.jar_-ios-orientations.adoc new file mode 100644 index 0000000000..790686e3e5 --- /dev/null +++ b/test_runner/docs/ascii/flank.jar_-ios-orientations.adoc @@ -0,0 +1,34 @@ +// tag::picocli-generated-full-manpage[] + +// tag::picocli-generated-man-section-name[] +== Name + +flank.jar +-ios-orientations - Information about available orientation versions + +// end::picocli-generated-man-section-name[] + +// tag::picocli-generated-man-section-synopsis[] +== Synopsis + +*flank.jar + ios orientations* [COMMAND] + +// end::picocli-generated-man-section-synopsis[] + +// tag::picocli-generated-man-section-description[] +== Description + +Prints list of available orientations + +// end::picocli-generated-man-section-description[] + +// tag::picocli-generated-man-section-commands[] +== Commands + +*list*:: + List of device orientations available to test against + +// end::picocli-generated-man-section-commands[] + +// end::picocli-generated-full-manpage[] \ No newline at end of file diff --git a/test_runner/docs/ascii/flank.jar_-ios.adoc b/test_runner/docs/ascii/flank.jar_-ios.adoc index a380767e9a..cd4a00372f 100644 --- a/test_runner/docs/ascii/flank.jar_-ios.adoc +++ b/test_runner/docs/ascii/flank.jar_-ios.adoc @@ -44,6 +44,9 @@ flank.jar *test-environment*:: Print available devices, OS versions, locales, provided software list and network configuration to test against +*orientations*:: + Information about available orientation versions + // end::picocli-generated-man-section-commands[] // end::picocli-generated-full-manpage[] \ No newline at end of file diff --git a/test_runner/src/main/kotlin/ftl/android/AndroidCatalog.kt b/test_runner/src/main/kotlin/ftl/android/AndroidCatalog.kt index 84e4001f32..2fbdac0730 100644 --- a/test_runner/src/main/kotlin/ftl/android/AndroidCatalog.kt +++ b/test_runner/src/main/kotlin/ftl/android/AndroidCatalog.kt @@ -2,7 +2,8 @@ package ftl.android import com.google.api.services.testing.model.AndroidDevice import com.google.api.services.testing.model.AndroidDeviceCatalog -import ftl.environment.asPrintableTable +import ftl.environment.android.asPrintableTable +import ftl.environment.common.asPrintableTable import ftl.gc.GcTesting import ftl.http.executeWithRetry @@ -27,6 +28,8 @@ object AndroidCatalog { fun supportedVersionsAsTable(projectId: String) = deviceCatalog(projectId).versions.asPrintableTable() + fun supportedOrientationsAsTable(projectId: String) = deviceCatalog(projectId).runtimeConfiguration.orientations.asPrintableTable() + fun androidModelIds(projectId: String) = modelMap.getOrPut(projectId) { deviceCatalog(projectId).models.map { it.id } } diff --git a/test_runner/src/main/kotlin/ftl/cli/firebase/test/AndroidCommand.kt b/test_runner/src/main/kotlin/ftl/cli/firebase/test/AndroidCommand.kt index 8013b03e5e..6bb5f4b8e7 100644 --- a/test_runner/src/main/kotlin/ftl/cli/firebase/test/AndroidCommand.kt +++ b/test_runner/src/main/kotlin/ftl/cli/firebase/test/AndroidCommand.kt @@ -4,6 +4,7 @@ import ftl.cli.firebase.test.android.AndroidDoctorCommand import ftl.cli.firebase.test.android.AndroidRunCommand import ftl.cli.firebase.test.android.AndroidTestEnvironmentCommand import ftl.cli.firebase.test.android.models.AndroidModelsCommand +import ftl.cli.firebase.test.android.orientations.AndroidOrientationsCommand import ftl.cli.firebase.test.android.versions.AndroidVersionsCommand import picocli.CommandLine import picocli.CommandLine.Command @@ -16,7 +17,8 @@ import picocli.CommandLine.Command AndroidDoctorCommand::class, AndroidModelsCommand::class, AndroidVersionsCommand::class, - AndroidTestEnvironmentCommand::class + AndroidTestEnvironmentCommand::class, + AndroidOrientationsCommand::class ], usageHelpAutoWidth = true ) diff --git a/test_runner/src/main/kotlin/ftl/cli/firebase/test/IosCommand.kt b/test_runner/src/main/kotlin/ftl/cli/firebase/test/IosCommand.kt index 9115d01878..77d3833993 100644 --- a/test_runner/src/main/kotlin/ftl/cli/firebase/test/IosCommand.kt +++ b/test_runner/src/main/kotlin/ftl/cli/firebase/test/IosCommand.kt @@ -5,6 +5,7 @@ import ftl.cli.firebase.test.ios.IosRunCommand import ftl.cli.firebase.test.ios.IosTestEnvironmentCommand import ftl.cli.firebase.test.ios.configuration.IosLocalesCommand import ftl.cli.firebase.test.ios.models.IosModelsCommand +import ftl.cli.firebase.test.ios.orientations.IosOrientationsCommand import ftl.cli.firebase.test.ios.versions.IosVersionsCommand import picocli.CommandLine import picocli.CommandLine.Command @@ -18,7 +19,8 @@ import picocli.CommandLine.Command IosModelsCommand::class, IosVersionsCommand::class, IosLocalesCommand::class, - IosTestEnvironmentCommand::class + IosTestEnvironmentCommand::class, + IosOrientationsCommand::class ], usageHelpAutoWidth = true ) diff --git a/test_runner/src/main/kotlin/ftl/cli/firebase/test/android/AndroidTestEnvironmentCommand.kt b/test_runner/src/main/kotlin/ftl/cli/firebase/test/android/AndroidTestEnvironmentCommand.kt index 09e08199e1..c509abf407 100644 --- a/test_runner/src/main/kotlin/ftl/cli/firebase/test/android/AndroidTestEnvironmentCommand.kt +++ b/test_runner/src/main/kotlin/ftl/cli/firebase/test/android/AndroidTestEnvironmentCommand.kt @@ -1,6 +1,7 @@ package ftl.cli.firebase.test.android import ftl.android.AndroidCatalog.devicesCatalogAsTable +import ftl.android.AndroidCatalog.supportedOrientationsAsTable import ftl.android.AndroidCatalog.supportedVersionsAsTable import ftl.args.AndroidArgs import ftl.config.FtlConstants @@ -22,10 +23,12 @@ import java.nio.file.Paths ) class AndroidTestEnvironmentCommand : Runnable { override fun run() { - println(devicesCatalogAsTable(AndroidArgs.load(Paths.get(configPath)).project)) - println(supportedVersionsAsTable(AndroidArgs.load(Paths.get(configPath)).project)) + val projectId = AndroidArgs.load(Paths.get(configPath)).project + println(devicesCatalogAsTable(projectId)) + println(supportedVersionsAsTable(projectId)) println(providedSoftwareAsTable()) println(networkConfigurationAsTable()) + println(supportedOrientationsAsTable(projectId)) } @CommandLine.Option(names = ["-c", "--config"], description = ["YAML config file path"]) diff --git a/test_runner/src/main/kotlin/ftl/cli/firebase/test/android/orientations/AndroidOrientationsCommand.kt b/test_runner/src/main/kotlin/ftl/cli/firebase/test/android/orientations/AndroidOrientationsCommand.kt new file mode 100644 index 0000000000..481eebe8bc --- /dev/null +++ b/test_runner/src/main/kotlin/ftl/cli/firebase/test/android/orientations/AndroidOrientationsCommand.kt @@ -0,0 +1,21 @@ +package ftl.cli.firebase.test.android.orientations + +import picocli.CommandLine + +@CommandLine.Command( + name = "screen-orientations", + headerHeading = "", + synopsisHeading = "%n", + descriptionHeading = "%n@|bold,underline Description:|@%n%n", + parameterListHeading = "%n@|bold,underline Parameters:|@%n", + optionListHeading = "%n@|bold,underline Options:|@%n", + header = ["Information about available orientations"], + description = ["Prints list of available orientations"], + subcommands = [AndroidOrientationsListCommand::class], + usageHelpAutoWidth = true +) +class AndroidOrientationsCommand : Runnable { + override fun run() { + CommandLine.usage(AndroidOrientationsCommand(), System.out) + } +} diff --git a/test_runner/src/main/kotlin/ftl/cli/firebase/test/android/orientations/AndroidOrientationsListCommand.kt b/test_runner/src/main/kotlin/ftl/cli/firebase/test/android/orientations/AndroidOrientationsListCommand.kt new file mode 100644 index 0000000000..4ba80d982b --- /dev/null +++ b/test_runner/src/main/kotlin/ftl/cli/firebase/test/android/orientations/AndroidOrientationsListCommand.kt @@ -0,0 +1,30 @@ +package ftl.cli.firebase.test.android.orientations + +import ftl.android.AndroidCatalog +import ftl.args.AndroidArgs +import ftl.config.FtlConstants +import picocli.CommandLine +import java.nio.file.Paths + +@CommandLine.Command( + name = "list", + headerHeading = "", + synopsisHeading = "%n", + descriptionHeading = "%n@|bold,underline Description:|@%n%n", + parameterListHeading = "%n@|bold,underline Parameters:|@%n", + optionListHeading = "%n@|bold,underline Options:|@%n", + header = ["List of device orientations available to test against"], + description = ["Print current list of Android orientations available to test against"], + usageHelpAutoWidth = true +) +class AndroidOrientationsListCommand : Runnable { + override fun run() { + println(AndroidCatalog.supportedOrientationsAsTable(AndroidArgs.load(Paths.get(configPath)).project)) + } + + @CommandLine.Option(names = ["-c", "--config"], description = ["YAML config file path"]) + var configPath: String = FtlConstants.defaultAndroidConfig + + @CommandLine.Option(names = ["-h", "--help"], usageHelp = true, description = ["Prints this help message"]) + var usageHelpRequested: Boolean = false +} diff --git a/test_runner/src/main/kotlin/ftl/cli/firebase/test/ios/IosTestEnvironmentCommand.kt b/test_runner/src/main/kotlin/ftl/cli/firebase/test/ios/IosTestEnvironmentCommand.kt index 6d927b1bef..9bb0191774 100644 --- a/test_runner/src/main/kotlin/ftl/cli/firebase/test/ios/IosTestEnvironmentCommand.kt +++ b/test_runner/src/main/kotlin/ftl/cli/firebase/test/ios/IosTestEnvironmentCommand.kt @@ -7,6 +7,7 @@ import ftl.environment.networkConfigurationAsTable import ftl.ios.IosCatalog.devicesCatalogAsTable import ftl.ios.IosCatalog.localesAsTable import ftl.ios.IosCatalog.softwareVersionsAsTable +import ftl.ios.IosCatalog.supportedOrientationsAsTable import picocli.CommandLine import java.nio.file.Paths @@ -29,6 +30,7 @@ class IosTestEnvironmentCommand : Runnable { println(localesAsTable(projectId)) println(providedSoftwareAsTable()) println(networkConfigurationAsTable()) + println(supportedOrientationsAsTable(projectId)) } @CommandLine.Option(names = ["-c", "--config"], description = ["YAML config file path"]) diff --git a/test_runner/src/main/kotlin/ftl/cli/firebase/test/ios/orientations/IosOrientationsCommand.kt b/test_runner/src/main/kotlin/ftl/cli/firebase/test/ios/orientations/IosOrientationsCommand.kt new file mode 100644 index 0000000000..9e17f4972b --- /dev/null +++ b/test_runner/src/main/kotlin/ftl/cli/firebase/test/ios/orientations/IosOrientationsCommand.kt @@ -0,0 +1,21 @@ +package ftl.cli.firebase.test.ios.orientations + +import picocli.CommandLine + +@CommandLine.Command( + name = "screen-orientations", + headerHeading = "", + synopsisHeading = "%n", + descriptionHeading = "%n@|bold,underline Description:|@%n%n", + parameterListHeading = "%n@|bold,underline Parameters:|@%n", + optionListHeading = "%n@|bold,underline Options:|@%n", + header = ["Information about available orientation versions"], + description = ["Prints list of available orientations"], + subcommands = [IosOrientationsListCommand::class], + usageHelpAutoWidth = true +) +class IosOrientationsCommand : Runnable { + override fun run() { + CommandLine.usage(IosOrientationsCommand(), System.out) + } +} diff --git a/test_runner/src/main/kotlin/ftl/cli/firebase/test/ios/orientations/IosOrientationsListCommand.kt b/test_runner/src/main/kotlin/ftl/cli/firebase/test/ios/orientations/IosOrientationsListCommand.kt new file mode 100644 index 0000000000..43660cf1b6 --- /dev/null +++ b/test_runner/src/main/kotlin/ftl/cli/firebase/test/ios/orientations/IosOrientationsListCommand.kt @@ -0,0 +1,30 @@ +package ftl.cli.firebase.test.ios.orientations + +import ftl.args.IosArgs +import ftl.config.FtlConstants +import ftl.ios.IosCatalog +import picocli.CommandLine +import java.nio.file.Paths + +@CommandLine.Command( + name = "list", + headerHeading = "", + synopsisHeading = "%n", + descriptionHeading = "%n@|bold,underline Description:|@%n%n", + parameterListHeading = "%n@|bold,underline Parameters:|@%n", + optionListHeading = "%n@|bold,underline Options:|@%n", + header = ["List of device orientations available to test against"], + description = ["Print current list of iOS orientations available to test against"], + usageHelpAutoWidth = true +) +class IosOrientationsListCommand : Runnable { + override fun run() { + println(IosCatalog.supportedOrientationsAsTable(IosArgs.load(Paths.get(configPath)).project)) + } + + @CommandLine.Option(names = ["-c", "--config"], description = ["YAML config file path"]) + var configPath: String = FtlConstants.defaultIosConfig + + @CommandLine.Option(names = ["-h", "--help"], usageHelp = true, description = ["Prints this help message"]) + var usageHelpRequested: Boolean = false +} diff --git a/test_runner/src/main/kotlin/ftl/environment/NetworkConfigurationCatalog.kt b/test_runner/src/main/kotlin/ftl/environment/NetworkConfigurationCatalog.kt index dd35bd4aad..ecb92b3982 100644 --- a/test_runner/src/main/kotlin/ftl/environment/NetworkConfigurationCatalog.kt +++ b/test_runner/src/main/kotlin/ftl/environment/NetworkConfigurationCatalog.kt @@ -1,5 +1,6 @@ package ftl.environment +import ftl.environment.common.asPrintableTable import ftl.gc.GcTesting import ftl.http.executeWithRetry diff --git a/test_runner/src/main/kotlin/ftl/environment/ProvidedSoftwareCatalog.kt b/test_runner/src/main/kotlin/ftl/environment/ProvidedSoftwareCatalog.kt index f05f4092af..14f8c7e31f 100644 --- a/test_runner/src/main/kotlin/ftl/environment/ProvidedSoftwareCatalog.kt +++ b/test_runner/src/main/kotlin/ftl/environment/ProvidedSoftwareCatalog.kt @@ -1,5 +1,6 @@ package ftl.environment +import ftl.environment.common.asTable import ftl.gc.GcTesting import ftl.http.executeWithRetry diff --git a/test_runner/src/main/kotlin/ftl/environment/ListAndroidDevices.kt b/test_runner/src/main/kotlin/ftl/environment/android/ListAndroidDevices.kt similarity index 77% rename from test_runner/src/main/kotlin/ftl/environment/ListAndroidDevices.kt rename to test_runner/src/main/kotlin/ftl/environment/android/ListAndroidDevices.kt index ed87732d15..ea1ec14d5c 100644 --- a/test_runner/src/main/kotlin/ftl/environment/ListAndroidDevices.kt +++ b/test_runner/src/main/kotlin/ftl/environment/android/ListAndroidDevices.kt @@ -1,6 +1,19 @@ -package ftl.environment +package ftl.environment.android import com.google.api.services.testing.model.AndroidModel +import ftl.environment.FORM +import ftl.environment.MAKE +import ftl.environment.MODEL_ID +import ftl.environment.MODEL_NAME +import ftl.environment.OS_VERSION_IDS +import ftl.environment.PHYSICAL_DEVICE +import ftl.environment.RESOLUTION +import ftl.environment.TAGS +import ftl.environment.TestEnvironmentInfo +import ftl.environment.createTableColumnFor +import ftl.environment.getOrCreateList +import ftl.environment.orUnknown +import ftl.environment.tagToSystemOutColorMapper import ftl.util.SystemOutColor import ftl.util.applyColorsUsing import ftl.util.buildTable diff --git a/test_runner/src/main/kotlin/ftl/environment/ListAndroidSofwareVersions.kt b/test_runner/src/main/kotlin/ftl/environment/android/ListAndroidSofwareVersions.kt similarity index 84% rename from test_runner/src/main/kotlin/ftl/environment/ListAndroidSofwareVersions.kt rename to test_runner/src/main/kotlin/ftl/environment/android/ListAndroidSofwareVersions.kt index 4e0e85313f..4eb79a69ec 100644 --- a/test_runner/src/main/kotlin/ftl/environment/ListAndroidSofwareVersions.kt +++ b/test_runner/src/main/kotlin/ftl/environment/android/ListAndroidSofwareVersions.kt @@ -1,7 +1,14 @@ -package ftl.environment +package ftl.environment.android import com.google.api.services.testing.model.AndroidVersion import com.google.api.services.testing.model.Date +import ftl.environment.OS_VERSION_ID +import ftl.environment.TAGS +import ftl.environment.TestEnvironmentInfo +import ftl.environment.createTableColumnFor +import ftl.environment.getOrCreateList +import ftl.environment.orUnknown +import ftl.environment.tagToSystemOutColorMapper import ftl.reports.api.twoDigitString import ftl.util.applyColorsUsing import ftl.util.buildTable diff --git a/test_runner/src/main/kotlin/ftl/environment/ListNetworkConfiguration.kt b/test_runner/src/main/kotlin/ftl/environment/common/ListNetworkConfiguration.kt similarity index 93% rename from test_runner/src/main/kotlin/ftl/environment/ListNetworkConfiguration.kt rename to test_runner/src/main/kotlin/ftl/environment/common/ListNetworkConfiguration.kt index 13d15b3a90..e7e6a22675 100644 --- a/test_runner/src/main/kotlin/ftl/environment/ListNetworkConfiguration.kt +++ b/test_runner/src/main/kotlin/ftl/environment/common/ListNetworkConfiguration.kt @@ -1,6 +1,9 @@ -package ftl.environment +package ftl.environment.common import com.google.api.services.testing.model.NetworkConfiguration +import ftl.environment.TestEnvironmentInfo +import ftl.environment.createTableColumnFor +import ftl.environment.getOrCreateList import ftl.util.TableStyle import ftl.util.buildTable diff --git a/test_runner/src/main/kotlin/ftl/environment/common/ListOrientations.kt b/test_runner/src/main/kotlin/ftl/environment/common/ListOrientations.kt new file mode 100644 index 0000000000..07f04edbcf --- /dev/null +++ b/test_runner/src/main/kotlin/ftl/environment/common/ListOrientations.kt @@ -0,0 +1,30 @@ +package ftl.environment.common + +import com.google.api.services.testing.model.Orientation +import ftl.environment.TestEnvironmentInfo +import ftl.environment.createTableColumnFor +import ftl.environment.getOrCreateList +import ftl.environment.tagToSystemOutColorMapper +import ftl.util.applyColorsUsing +import ftl.util.buildTable + +fun List.asPrintableTable() = createOrientationsDetails().createOrientationsTable() + +private fun List.createOrientationsDetails() = fold(mutableMapOf>()) { orientationInfo, orientation -> + orientationInfo.apply { + getOrCreateList(ORIENTATION_ID).add(orientation.id.orEmpty()) + getOrCreateList(NAME).add(orientation.name.orEmpty()) + getOrCreateList(TAG).add(orientation.tags?.joinToString(TAG_SEPARATOR).orEmpty()) + } +} + +private fun TestEnvironmentInfo.createOrientationsTable() = buildTable( + createTableColumnFor(ORIENTATION_ID), + createTableColumnFor(NAME), + createTableColumnFor(TAG).applyColorsUsing(tagToSystemOutColorMapper) +) + +private const val ORIENTATION_ID = "ORIENTATION_ID" +private const val NAME = "NAME" +private const val TAG = "TAG" +private const val TAG_SEPARATOR = "," diff --git a/test_runner/src/main/kotlin/ftl/environment/ListProvidedSoftware.kt b/test_runner/src/main/kotlin/ftl/environment/common/ListProvidedSoftware.kt similarity index 91% rename from test_runner/src/main/kotlin/ftl/environment/ListProvidedSoftware.kt rename to test_runner/src/main/kotlin/ftl/environment/common/ListProvidedSoftware.kt index d9b4b275b3..36d335e072 100644 --- a/test_runner/src/main/kotlin/ftl/environment/ListProvidedSoftware.kt +++ b/test_runner/src/main/kotlin/ftl/environment/common/ListProvidedSoftware.kt @@ -1,4 +1,4 @@ -package ftl.environment +package ftl.environment.common import com.google.api.services.testing.model.ProvidedSoftwareCatalog import ftl.util.TableColumn diff --git a/test_runner/src/main/kotlin/ftl/environment/ListIOsDevices.kt b/test_runner/src/main/kotlin/ftl/environment/ios/ListIOsDevices.kt similarity index 74% rename from test_runner/src/main/kotlin/ftl/environment/ListIOsDevices.kt rename to test_runner/src/main/kotlin/ftl/environment/ios/ListIOsDevices.kt index a295070d00..9dce7227e3 100644 --- a/test_runner/src/main/kotlin/ftl/environment/ListIOsDevices.kt +++ b/test_runner/src/main/kotlin/ftl/environment/ios/ListIOsDevices.kt @@ -1,6 +1,16 @@ -package ftl.environment +package ftl.environment.ios import com.google.api.services.testing.model.IosModel +import ftl.environment.MODEL_ID +import ftl.environment.MODEL_NAME +import ftl.environment.OS_VERSION_IDS +import ftl.environment.RESOLUTION +import ftl.environment.TAGS +import ftl.environment.TestEnvironmentInfo +import ftl.environment.createTableColumnFor +import ftl.environment.getOrCreateList +import ftl.environment.orUnknown +import ftl.environment.tagToSystemOutColorMapper import ftl.util.applyColorsUsing import ftl.util.buildTable diff --git a/test_runner/src/main/kotlin/ftl/environment/ListIOsSofwareVersions.kt b/test_runner/src/main/kotlin/ftl/environment/ios/ListIOsSofwareVersions.kt similarity index 82% rename from test_runner/src/main/kotlin/ftl/environment/ListIOsSofwareVersions.kt rename to test_runner/src/main/kotlin/ftl/environment/ios/ListIOsSofwareVersions.kt index 4338988e75..17afa27ffb 100644 --- a/test_runner/src/main/kotlin/ftl/environment/ListIOsSofwareVersions.kt +++ b/test_runner/src/main/kotlin/ftl/environment/ios/ListIOsSofwareVersions.kt @@ -1,6 +1,13 @@ -package ftl.environment +package ftl.environment.ios import com.google.api.services.testing.model.IosVersion +import ftl.environment.OS_VERSION_ID +import ftl.environment.TAGS +import ftl.environment.TestEnvironmentInfo +import ftl.environment.createTableColumnFor +import ftl.environment.getOrCreateList +import ftl.environment.orUnknown +import ftl.environment.tagToSystemOutColorMapper import ftl.util.applyColorsUsing import ftl.util.buildTable diff --git a/test_runner/src/main/kotlin/ftl/ios/IosCatalog.kt b/test_runner/src/main/kotlin/ftl/ios/IosCatalog.kt index 2f3a056f95..bba3ec0114 100644 --- a/test_runner/src/main/kotlin/ftl/ios/IosCatalog.kt +++ b/test_runner/src/main/kotlin/ftl/ios/IosCatalog.kt @@ -1,7 +1,10 @@ package ftl.ios import com.google.api.services.testing.model.IosDeviceCatalog +import ftl.environment.android.asPrintableTable import ftl.environment.asPrintableTable +import ftl.environment.common.asPrintableTable +import ftl.environment.ios.asPrintableTable import ftl.gc.GcTesting import ftl.http.executeWithRetry @@ -20,6 +23,8 @@ object IosCatalog { fun localesAsTable(projectId: String) = iosDeviceCatalog(projectId).runtimeConfiguration.locales.asPrintableTable() + fun supportedOrientationsAsTable(projectId: String) = iosDeviceCatalog(projectId).runtimeConfiguration.orientations.asPrintableTable() + fun supportedXcode(version: String, projectId: String) = xcodeVersions(projectId).contains(version) private fun xcodeVersions(projectId: String) = diff --git a/test_runner/src/test/kotlin/Debug.kt b/test_runner/src/test/kotlin/Debug.kt index ae4e131f46..6a871280e6 100644 --- a/test_runner/src/test/kotlin/Debug.kt +++ b/test_runner/src/test/kotlin/Debug.kt @@ -17,7 +17,7 @@ fun main() { withGlobalExceptionHandling { CommandLine(Main()).execute( // "--debug", - "firebase", "test", "android", + "firebase", "test", "ios", "test-environment", // "--dry", // "--dump-shards", diff --git a/test_runner/src/test/kotlin/ftl/cli/firebase/test/android/orientations/AndroidOrientationCommandListTest.kt b/test_runner/src/test/kotlin/ftl/cli/firebase/test/android/orientations/AndroidOrientationCommandListTest.kt new file mode 100644 index 0000000000..335e0e9f93 --- /dev/null +++ b/test_runner/src/test/kotlin/ftl/cli/firebase/test/android/orientations/AndroidOrientationCommandListTest.kt @@ -0,0 +1,27 @@ +package ftl.cli.firebase.test.android.orientations + +import ftl.android.AndroidCatalog +import ftl.cli.firebase.test.android.versions.AndroidVersionsListCommand +import io.mockk.mockkObject +import io.mockk.verify +import org.junit.Assert.assertEquals +import org.junit.Test +import picocli.CommandLine + +class AndroidOrientationCommandListTest { + @Test + fun `should execute AndroidCatalog supportedOrientationsAsTable when run AndroidOrientationsListCommand`() { + mockkObject(AndroidCatalog) { + CommandLine(AndroidOrientationsListCommand()).execute() + verify { AndroidCatalog.supportedOrientationsAsTable(any()) } + } + } + + @Test + fun `AndroidOrientationCommandListTest should parse config`() { + val cmd = AndroidVersionsListCommand() + CommandLine(cmd).parseArgs("--config=a") + + assertEquals(cmd.configPath, "a") + } +} diff --git a/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/orientations/IosOrientationCommandListTest.kt b/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/orientations/IosOrientationCommandListTest.kt new file mode 100644 index 0000000000..3be6aaec9b --- /dev/null +++ b/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/orientations/IosOrientationCommandListTest.kt @@ -0,0 +1,26 @@ +package ftl.cli.firebase.test.ios.orientations + +import ftl.ios.IosCatalog +import io.mockk.mockkObject +import io.mockk.verify +import org.junit.Assert.assertEquals +import org.junit.Test +import picocli.CommandLine + +class IosOrientationCommandListTest { + @Test + fun `should execute IosCatalog supportedOrientationsAsTable when run IosOrientationsListCommand`() { + mockkObject(IosCatalog) { + CommandLine(IosOrientationsListCommand()).execute() + verify { IosCatalog.supportedOrientationsAsTable(any()) } + } + } + + @Test + fun `IosOrientationsListCommand should parse config`() { + val cmd = IosOrientationsListCommand() + CommandLine(cmd).parseArgs("--config=a") + + assertEquals(cmd.configPath, "a") + } +} diff --git a/test_runner/src/test/kotlin/ftl/cli/firebase/test/networkprofiles/NetworkProfilesListCommandTest.kt b/test_runner/src/test/kotlin/ftl/cli/firebase/test/networkprofiles/NetworkProfilesListCommandTest.kt index 9096805044..3324d9eec0 100644 --- a/test_runner/src/test/kotlin/ftl/cli/firebase/test/networkprofiles/NetworkProfilesListCommandTest.kt +++ b/test_runner/src/test/kotlin/ftl/cli/firebase/test/networkprofiles/NetworkProfilesListCommandTest.kt @@ -19,7 +19,7 @@ class NetworkProfilesListCommandTest { mockkStatic( "ftl.http.ExecuteWithRetryKt", "ftl.run.common.PrettyPrintKt", - "ftl.environment.ListNetworkConfigurationKt" + "ftl.environment.common.ListNetworkConfigurationKt" ) }