Skip to content

Commit 4a19322

Browse files
feat: introduce platform configs
1 parent f1a60cd commit 4a19322

File tree

3 files changed

+38
-39
lines changed

3 files changed

+38
-39
lines changed

maestro-orchestra-models/src/main/java/maestro/orchestra/WorkspaceConfig.kt

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ data class WorkspaceConfig(
99
val excludeTags: StringList? = null,
1010
val local: Local? = null,
1111
val executionOrder: ExecutionOrder? = null,
12-
val iosIncludeNonModalElements: Boolean? = null,
1312
@Deprecated("not supported on maestro cloud") val baselineBranch: String? = null,
1413
val notifications: MaestroNotificationConfiguration? = null,
1514
@Deprecated("not supported now by default on cloud") val disableRetries: Boolean = false,
16-
val deviceConfig: DeviceConfig? = null
15+
val platform: PlatformConfiguration? = null,
1716
) {
1817

1918
data class MaestroNotificationConfiguration(
@@ -34,24 +33,18 @@ data class WorkspaceConfig(
3433
)
3534
}
3635

37-
data class DeviceConfig(
38-
val android: List<TopLevelDeviceConfig>? = null,
39-
val iOS: List<TopLevelDeviceConfig>? = null
36+
data class PlatformConfiguration(
37+
val android: AndroidConfiguration? = null,
38+
val ios: IOSConfiguration? = null
4039
) {
41-
sealed class TopLevelDeviceConfig {
42-
object DisableAnimations : TopLevelDeviceConfig()
40+
data class AndroidConfiguration(
41+
val disableAnimations: Boolean = false,
42+
)
4343

44-
companion object {
45-
@JsonCreator
46-
@JvmStatic
47-
fun fromValue(value: String): TopLevelDeviceConfig {
48-
return when (value) {
49-
"disableAnimations" -> DisableAnimations
50-
else -> throw IllegalArgumentException("Invalid deviceConfig: $value")
51-
}
52-
}
53-
}
54-
}
44+
data class IOSConfiguration(
45+
val disableAnimations: Boolean = false,
46+
val snapshotKeyHonorModalViews: Boolean? = null,
47+
)
5548
}
5649

5750
@JsonAnySetter

maestro-orchestra/src/test/java/maestro/orchestra/workspace/WorkspaceExecutionPlannerTest.kt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package maestro.orchestra.workspace
22

33
import com.google.common.truth.Truth.assertThat
4+
import maestro.orchestra.WorkspaceConfig
5+
import maestro.orchestra.WorkspaceConfig.*
46
import org.junit.jupiter.api.Test
57
import java.nio.file.Path
68
import java.nio.file.Paths
@@ -339,28 +341,23 @@ internal class WorkspaceExecutionPlannerTest {
339341
}
340342

341343
@Test
342-
internal fun `016 - Upload Config gets correct values`() {
343-
// When
344-
val planWithoutConfig = WorkspaceExecutionPlanner.plan(
345-
input = paths("/workspaces/000_individual_file"),
346-
includeTags = listOf(),
347-
excludeTags = listOf(),
348-
config = null
349-
)
350-
351-
val planWithIncludeNonModalElements = WorkspaceExecutionPlanner.plan(
352-
input = paths("/workspaces/013_execution_order"),
353-
includeTags = listOf(),
354-
excludeTags = listOf(),
344+
internal fun `017 - Upload configs on local and cloud both are supported`() {
345+
// when
346+
val plan = WorkspaceExecutionPlanner.plan(
347+
input = paths("/workspaces/015_workspace_cloud_configs"),
348+
includeTags = listOf("included"),
349+
excludeTags = listOf("notIncluded"),
355350
config = null
356351
)
357352

358-
assertThat(planWithoutConfig.workspaceConfig.iosIncludeNonModalElements).isNull()
359-
assertThat(planWithIncludeNonModalElements.workspaceConfig.iosIncludeNonModalElements).isTrue()
353+
assertThat(plan.workspaceConfig.notifications?.email?.recipients).containsExactly("[email protected]")
354+
assertThat(plan.workspaceConfig.notifications?.slack?.channels).containsExactly("e2e-testing")
355+
assertThat(plan.workspaceConfig.executionOrder?.flowsOrder).containsExactly("flowA", "flowB")
356+
assertThat(plan.workspaceConfig.disableRetries).isTrue()
360357
}
361358

362359
@Test
363-
internal fun `017 - Upload configs on local and cloud both are supported`() {
360+
internal fun `017 - Upload platform configs on are supported`() {
364361
// when
365362
val plan = WorkspaceExecutionPlanner.plan(
366363
input = paths("/workspaces/015_workspace_cloud_configs"),
@@ -369,10 +366,13 @@ internal class WorkspaceExecutionPlannerTest {
369366
config = null
370367
)
371368

372-
assertThat(plan.workspaceConfig.notifications?.email?.recipients).containsExactly("[email protected]")
373-
assertThat(plan.workspaceConfig.notifications?.slack?.channels).containsExactly("e2e-testing")
374-
assertThat(plan.workspaceConfig.executionOrder?.flowsOrder).containsExactly("flowA", "flowB")
375-
assertThat(plan.workspaceConfig.disableRetries).isTrue()
369+
val platformConfiguration = plan.workspaceConfig.platform
370+
assertThat(platformConfiguration).isEqualTo(
371+
PlatformConfiguration(
372+
android = PlatformConfiguration.AndroidConfiguration(disableAnimations = true),
373+
ios = PlatformConfiguration.IOSConfiguration(disableAnimations = true, snapshotKeyHonorModalViews = false)
374+
)
375+
)
376376
}
377377

378378
private fun path(path: String): Path? {

maestro-orchestra/src/test/resources/workspaces/015_workspace_cloud_configs/config.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,10 @@ disableRetries: true
1212
executionOrder:
1313
flowsOrder:
1414
- flowA
15-
- flowB
15+
- flowB
16+
platform:
17+
ios:
18+
disableAnimations: true
19+
snapshotKeyHonorModalViews: false
20+
android:
21+
disableAnimations: true

0 commit comments

Comments
 (0)