From 975788bdb688c39048011eecc013becdadfe128d Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Fri, 23 Aug 2024 13:24:28 +0100 Subject: [PATCH] remove all initFlow-related code --- .../cli/runner/MaestroCommandRunner.kt | 17 +---- .../java/maestro/cli/runner/TestRunner.kt | 15 ++--- .../cli/runner/resultview/AnsiResultView.kt | 7 --- .../runner/resultview/PlainTextResultView.kt | 8 --- .../maestro/cli/runner/resultview/UiState.kt | 1 - .../java/maestro/cli/view/ErrorViewUtils.kt | 4 +- .../java/maestro/orchestra/MaestroConfig.kt | 16 ----- .../main/java/maestro/orchestra/Orchestra.kt | 61 +++--------------- .../orchestra/error/InvalidInitFlowFile.kt | 9 --- .../orchestra/yaml/YamlCommandReader.kt | 5 +- .../java/maestro/orchestra/yaml/YamlConfig.kt | 63 ------------------- .../orchestra/yaml/YamlInitFlowUnion.kt | 59 ----------------- .../orchestra/yaml/YamlCommandReaderTest.kt | 42 ------------- .../005_config_noAppId.yaml | 2 +- .../YamlCommandReaderTest/007_initFlow.yaml | 6 -- .../011_initFlow_file.yaml | 4 -- .../012_initFlow_emptyString.yaml | 4 -- .../013_initFlow_invalidFile.yaml | 4 -- .../014_initFlow_recursive.yaml | 4 -- .../015_onlyCommands.yaml | 4 +- .../kotlin/maestro/test/IntegrationTest.kt | 51 --------------- .../src/test/resources/023_init_flow.yaml | 6 -- .../resources/024_init_flow_init_state.yaml | 6 -- 23 files changed, 21 insertions(+), 377 deletions(-) delete mode 100644 maestro-orchestra/src/main/java/maestro/orchestra/error/InvalidInitFlowFile.kt delete mode 100644 maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlInitFlowUnion.kt delete mode 100644 maestro-orchestra/src/test/resources/YamlCommandReaderTest/007_initFlow.yaml delete mode 100644 maestro-orchestra/src/test/resources/YamlCommandReaderTest/011_initFlow_file.yaml delete mode 100644 maestro-orchestra/src/test/resources/YamlCommandReaderTest/012_initFlow_emptyString.yaml delete mode 100644 maestro-orchestra/src/test/resources/YamlCommandReaderTest/013_initFlow_invalidFile.yaml delete mode 100644 maestro-orchestra/src/test/resources/YamlCommandReaderTest/014_initFlow_recursive.yaml delete mode 100644 maestro-test/src/test/resources/023_init_flow.yaml delete mode 100644 maestro-test/src/test/resources/024_init_flow_init_state.yaml diff --git a/maestro-cli/src/main/java/maestro/cli/runner/MaestroCommandRunner.kt b/maestro-cli/src/main/java/maestro/cli/runner/MaestroCommandRunner.kt index 89d08fc654..5422410de8 100644 --- a/maestro-cli/src/main/java/maestro/cli/runner/MaestroCommandRunner.kt +++ b/maestro-cli/src/main/java/maestro/cli/runner/MaestroCommandRunner.kt @@ -31,7 +31,6 @@ import maestro.orchestra.ApplyConfigurationCommand import maestro.orchestra.CompositeCommand import maestro.orchestra.MaestroCommand import maestro.orchestra.Orchestra -import maestro.orchestra.OrchestraAppState import maestro.orchestra.yaml.YamlCommandReader import maestro.utils.Insight import org.slf4j.LoggerFactory @@ -48,9 +47,8 @@ object MaestroCommandRunner { view: ResultView, commands: List, debug: FlowDebugMetadata - ): Result { + ): Boolean { val config = YamlCommandReader.getConfig(commands) - val initFlow = config?.initFlow val onFlowComplete = config?.onFlowComplete val onFlowStart = config?.onFlowStart @@ -90,11 +88,6 @@ object MaestroCommandRunner { view.setState( UiState.Running( device = device, - initCommands = toCommandStates( - initFlow?.commands ?: emptyList(), - commandStatuses, - commandMetadata - ), onFlowStartCommands = toCommandStates( onFlowStart?.commands ?: emptyList(), commandStatuses, @@ -181,8 +174,7 @@ object MaestroCommandRunner { ) val flowSuccess = orchestra.runFlow(commands) - - return Result(flowSuccess = flowSuccess, cachedAppState = null) + return flowSuccess } private fun toCommandStates( @@ -214,9 +206,4 @@ object MaestroCommandRunner { ) } } - - data class Result( - val flowSuccess: Boolean, - val cachedAppState: OrchestraAppState? - ) } diff --git a/maestro-cli/src/main/java/maestro/cli/runner/TestRunner.kt b/maestro-cli/src/main/java/maestro/cli/runner/TestRunner.kt index 6fc3293206..81344c05b3 100644 --- a/maestro-cli/src/main/java/maestro/cli/runner/TestRunner.kt +++ b/maestro-cli/src/main/java/maestro/cli/runner/TestRunner.kt @@ -16,7 +16,6 @@ import maestro.cli.runner.resultview.UiState import maestro.cli.util.PrintUtils import maestro.cli.view.ErrorViewUtils import maestro.orchestra.MaestroCommand -import maestro.orchestra.MaestroInitFlow import maestro.orchestra.util.Env.withEnv import maestro.orchestra.yaml.YamlCommandReader import org.slf4j.LoggerFactory @@ -55,7 +54,7 @@ object TestRunner { TestDebugReporter.saveFlow(flowFile.name, debug, debugOutputPath) if (debug.exception != null) PrintUtils.err("${debug.exception?.message}") - return if (result.get()?.flowSuccess == true) 0 else 1 + return if (result.get() == true) 0 else 1 } fun runContinuous( @@ -69,7 +68,6 @@ object TestRunner { val fileWatcher = FileWatcher() var previousCommands: List? = null - var previousInitFlow: MaestroInitFlow? = null var ongoingTest: Thread? = null do { @@ -79,15 +77,14 @@ object TestRunner { join() } - val commands = YamlCommandReader.readCommands(flowFile.toPath()) + val commands = YamlCommandReader + .readCommands(flowFile.toPath()) .withEnv(env) - val initFlow = getInitFlow(commands) // Restart the flow if anything has changed - if (commands != previousCommands || initFlow != previousInitFlow) { + if (commands != previousCommands) { ongoingTest = thread { previousCommands = commands - previousInitFlow = initFlow runCatching(resultView, maestro) { MaestroCommandRunner.runCommands( @@ -115,10 +112,6 @@ object TestRunner { } while (true) } - private fun getInitFlow(commands: List): MaestroInitFlow? { - return YamlCommandReader.getConfig(commands)?.initFlow - } - private fun runCatching( view: ResultView, maestro: Maestro, diff --git a/maestro-cli/src/main/java/maestro/cli/runner/resultview/AnsiResultView.kt b/maestro-cli/src/main/java/maestro/cli/runner/resultview/AnsiResultView.kt index 2254fdd1ac..ede4120c1a 100644 --- a/maestro-cli/src/main/java/maestro/cli/runner/resultview/AnsiResultView.kt +++ b/maestro-cli/src/main/java/maestro/cli/runner/resultview/AnsiResultView.kt @@ -23,7 +23,6 @@ import io.ktor.util.encodeBase64 import maestro.cli.runner.CommandState import maestro.cli.runner.CommandStatus import maestro.utils.Insight -import maestro.utils.Insights import maestro.utils.chunkStringByWordCount import org.fusesource.jansi.Ansi @@ -66,12 +65,6 @@ class AnsiResultView( render("Running on ${state.device.description}\n") } render("\n") - if (state.initCommands.isNotEmpty()) { - render(" ║\n") - render(" ║ > Init Flow\n") - render(" ║\n") - renderCommands(state.initCommands) - } if (state.onFlowStartCommands.isNotEmpty()) { render(" ║\n") render(" ║ > On Flow Start\n") diff --git a/maestro-cli/src/main/java/maestro/cli/runner/resultview/PlainTextResultView.kt b/maestro-cli/src/main/java/maestro/cli/runner/resultview/PlainTextResultView.kt index 3149291091..8ba8ff7c1d 100644 --- a/maestro-cli/src/main/java/maestro/cli/runner/resultview/PlainTextResultView.kt +++ b/maestro-cli/src/main/java/maestro/cli/runner/resultview/PlainTextResultView.kt @@ -47,14 +47,6 @@ class PlainTextResultView: ResultView { } } - if (state.initCommands.isNotEmpty()) { - if (shouldPrintStep()) { - println(" > Init Flow") - } - - renderCommandsPlainText(state.initCommands) - } - if (state.onFlowStartCommands.isNotEmpty()) { if (shouldPrintStep()) { println(" > On Flow Start") diff --git a/maestro-cli/src/main/java/maestro/cli/runner/resultview/UiState.kt b/maestro-cli/src/main/java/maestro/cli/runner/resultview/UiState.kt index bc1b63a65c..134dcc979a 100644 --- a/maestro-cli/src/main/java/maestro/cli/runner/resultview/UiState.kt +++ b/maestro-cli/src/main/java/maestro/cli/runner/resultview/UiState.kt @@ -9,7 +9,6 @@ sealed class UiState { data class Running( val device: Device? = null, - @Deprecated("Obsolete API. See #1921") val initCommands: List = emptyList(), val onFlowStartCommands: List = emptyList(), val onFlowCompleteCommands: List = emptyList(), val commands: List, diff --git a/maestro-cli/src/main/java/maestro/cli/view/ErrorViewUtils.kt b/maestro-cli/src/main/java/maestro/cli/view/ErrorViewUtils.kt index 56fb6bb24f..1dba489acb 100644 --- a/maestro-cli/src/main/java/maestro/cli/view/ErrorViewUtils.kt +++ b/maestro-cli/src/main/java/maestro/cli/view/ErrorViewUtils.kt @@ -2,7 +2,6 @@ package maestro.cli.view import maestro.MaestroException import maestro.orchestra.error.InvalidFlowFile -import maestro.orchestra.error.InvalidInitFlowFile import maestro.orchestra.error.NoInputException import maestro.orchestra.error.UnicodeNotSupportedError import maestro.orchestra.error.ValidationError @@ -14,7 +13,6 @@ object ErrorViewUtils { return when (e) { is ValidationError -> e.message is NoInputException -> "No commands found in Flow file" - is InvalidInitFlowFile -> "initFlow file is invalid: ${e.initFlowPath}" is InvalidFlowFile -> "Flow file is invalid: ${e.flowPath}" is UnicodeNotSupportedError -> "Unicode character input is not supported: ${e.text}. Please use ASCII characters. Follow the issue: https://github.com/mobile-dev-inc/maestro/issues/146" is InterruptedException -> "Interrupted" @@ -24,4 +22,4 @@ object ErrorViewUtils { } } -} \ No newline at end of file +} diff --git a/maestro-orchestra-models/src/main/java/maestro/orchestra/MaestroConfig.kt b/maestro-orchestra-models/src/main/java/maestro/orchestra/MaestroConfig.kt index 47a50f6645..8a9325011a 100644 --- a/maestro-orchestra-models/src/main/java/maestro/orchestra/MaestroConfig.kt +++ b/maestro-orchestra-models/src/main/java/maestro/orchestra/MaestroConfig.kt @@ -9,7 +9,6 @@ data class MaestroConfig( val appId: String? = null, val name: String? = null, val tags: List? = emptyList(), - @Deprecated("Obsolete API. See #1921") val initFlow: MaestroInitFlow? = null, val ext: Map = emptyMap(), val onFlowStart: MaestroOnFlowStart? = null, val onFlowComplete: MaestroOnFlowComplete? = null, @@ -19,7 +18,6 @@ data class MaestroConfig( return copy( appId = appId?.evaluateScripts(jsEngine), name = name?.evaluateScripts(jsEngine), - initFlow = initFlow?.evaluateScripts(jsEngine), onFlowComplete = onFlowComplete?.evaluateScripts(jsEngine), onFlowStart = onFlowStart?.evaluateScripts(jsEngine), ) @@ -27,20 +25,6 @@ data class MaestroConfig( } -@Deprecated("Obsolete API. See issue #1921") -data class MaestroInitFlow( - val appId: String, - val commands: List, -) { - - fun evaluateScripts(jsEngine: JsEngine): MaestroInitFlow { - return copy( - appId = appId.evaluateScripts(jsEngine), - ) - } - -} - data class MaestroOnFlowComplete(val commands: List) { fun evaluateScripts(jsEngine: JsEngine): MaestroOnFlowComplete { return this diff --git a/maestro-orchestra/src/main/java/maestro/orchestra/Orchestra.kt b/maestro-orchestra/src/main/java/maestro/orchestra/Orchestra.kt index e2c9186edb..5a4ca9d8a2 100644 --- a/maestro-orchestra/src/main/java/maestro/orchestra/Orchestra.kt +++ b/maestro-orchestra/src/main/java/maestro/orchestra/Orchestra.kt @@ -19,8 +19,15 @@ package maestro.orchestra -import maestro.* +import maestro.DeviceInfo +import maestro.ElementFilter +import maestro.Filters import maestro.Filters.asFilter +import maestro.FindElementResult +import maestro.Maestro +import maestro.MaestroException +import maestro.ScreenRecording +import maestro.ViewHierarchy import maestro.js.GraalJsEngine import maestro.js.JsEngine import maestro.js.RhinoJsEngine @@ -30,6 +37,7 @@ import maestro.orchestra.filter.TraitFilters import maestro.orchestra.geo.Traveller import maestro.orchestra.util.Env.evaluateScripts import maestro.orchestra.yaml.YamlCommandReader +import maestro.toSwipeDirection import maestro.utils.Insight import maestro.utils.Insights import maestro.utils.MaestroTimer @@ -39,7 +47,6 @@ import okio.buffer import okio.sink import java.io.File import java.lang.Long.max -import java.nio.file.Files class Orchestra( private val maestro: Maestro, @@ -68,28 +75,13 @@ class Orchestra( private val rawCommandToMetadata = mutableMapOf() - /** - * If initState is provided, initialize app disk state with the provided OrchestraAppState and skip - * any initFlow execution. Otherwise, initialize app state with initFlow if defined. - */ - fun runFlow( - commands: List, - initState: OrchestraAppState? = null, - ): Boolean { + fun runFlow(commands: List): Boolean { timeMsOfLastInteraction = System.currentTimeMillis() val config = YamlCommandReader.getConfig(commands) initJsEngine(config) - val state = initState ?: config?.initFlow?.let { - runInitFlow(it) ?: return false - } - - if (state != null) { - maestro.clearAppState(state.appId) - } - onFlowStart(commands) executeDefineVariablesCommands(commands, config) @@ -134,33 +126,6 @@ class Orchestra( } } - /** - * Run the initFlow and return the resulting app OrchestraAppState which can be used to initialize - * app disk state when past into Orchestra.runFlow. - */ - @Deprecated("Obsolete API. See issue #1921") - fun runInitFlow( - initFlow: MaestroInitFlow, - ): OrchestraAppState? { - val success = runFlow( - initFlow.commands, - ) - if (!success) return null - - maestro.stopApp(initFlow.appId) - - val stateFile = if (stateDir == null) { - Files.createTempFile(null, ".state") - } else { - Files.createTempFile(stateDir.toPath(), null, ".state") - } - - return OrchestraAppState( - appId = initFlow.appId, - file = stateFile.toFile(), - ) - } - fun executeCommands( commands: List, config: MaestroConfig? = null, @@ -1153,9 +1118,3 @@ class Orchestra( private const val MAX_ERASE_CHARACTERS = 50 } } - -@Deprecated("Obsolete API. See issue #1921") -data class OrchestraAppState( - val appId: String, - val file: File, -) diff --git a/maestro-orchestra/src/main/java/maestro/orchestra/error/InvalidInitFlowFile.kt b/maestro-orchestra/src/main/java/maestro/orchestra/error/InvalidInitFlowFile.kt deleted file mode 100644 index c3139e3a76..0000000000 --- a/maestro-orchestra/src/main/java/maestro/orchestra/error/InvalidInitFlowFile.kt +++ /dev/null @@ -1,9 +0,0 @@ -package maestro.orchestra.error - -import java.nio.file.Path - -@Deprecated("Obsolete API. See #1921") -class InvalidInitFlowFile( - override val message: String, - val initFlowPath: Path -) : RuntimeException() diff --git a/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlCommandReader.kt b/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlCommandReader.kt index ca180c3abf..5005c49b0a 100644 --- a/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlCommandReader.kt +++ b/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlCommandReader.kt @@ -69,10 +69,9 @@ object YamlCommandReader { // Files to watch for changes. Includes any referenced files. fun getWatchFiles(flowPath: Path): List = mapParsingErrors(flowPath) { - val (config, commands) = readConfigAndCommands(flowPath) - val configWatchFiles = config.getWatchFiles(flowPath) + val (_, commands) = readConfigAndCommands(flowPath) val commandWatchFiles = commands.flatMap { it.getWatchFiles(flowPath) } - (listOf(flowPath) + configWatchFiles + commandWatchFiles) + (listOf(flowPath) + commandWatchFiles) .filter { it.absolute().parent?.isDirectory() ?: false } } diff --git a/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlConfig.kt b/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlConfig.kt index cba523325d..0606dda042 100644 --- a/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlConfig.kt +++ b/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlConfig.kt @@ -1,22 +1,16 @@ package maestro.orchestra.yaml import com.fasterxml.jackson.annotation.JsonAnySetter -import maestro.MaestroException import maestro.orchestra.ApplyConfigurationCommand -import maestro.orchestra.error.InvalidInitFlowFile import maestro.orchestra.MaestroCommand import maestro.orchestra.MaestroConfig -import maestro.orchestra.MaestroInitFlow import maestro.orchestra.MaestroOnFlowComplete import maestro.orchestra.MaestroOnFlowStart import java.nio.file.Path -import kotlin.io.path.exists -import kotlin.io.path.isDirectory data class YamlConfig( val name: String?, val appId: String, - @Deprecated("Obsolete API. See #1921") val initFlow: YamlInitFlowUnion?, val tags: List? = emptyList(), val env: Map = emptyMap(), val onFlowStart: YamlOnFlowStart?, @@ -31,16 +25,10 @@ data class YamlConfig( } fun toCommand(flowPath: Path): MaestroCommand { - if (initFlow != null) { - throw MaestroException.DeprecatedCommand("initFlow command used at: $flowPath is deprecated, please use " + - "onFlowStart/onFlowComplete hooks instead. Have a look at the documentation here: " + - "https://maestro.mobile.dev/advanced/onflowstart-onflowcomplete-hooks") - } val config = MaestroConfig( appId = appId, name = name, tags = tags, - initFlow = initFlow(flowPath), ext = ext.toMap(), onFlowStart = onFlowStart(flowPath), onFlowComplete = onFlowComplete(flowPath) @@ -48,28 +36,6 @@ data class YamlConfig( return MaestroCommand(ApplyConfigurationCommand(config)) } - fun getWatchFiles(flowPath: Path): List { - if (initFlow == null) return emptyList() - return when (initFlow) { - is StringInitFlow -> listOf(getInitFlowPath(flowPath, initFlow.path)) - else -> emptyList() - } - } - - private fun initFlow(flowPath: Path): MaestroInitFlow? { - if (initFlow == null) return null - - val initCommands = when (initFlow) { - is StringInitFlow -> stringInitCommands(initFlow, flowPath) - is YamlInitFlow -> initFlow.commands.flatMap { it.toCommands(flowPath, appId) } - } - - return MaestroInitFlow( - appId = appId, - commands = initCommands, - ) - } - private fun onFlowComplete(flowPath: Path): MaestroOnFlowComplete? { if (onFlowComplete == null) return null @@ -81,33 +47,4 @@ data class YamlConfig( return MaestroOnFlowStart(onFlowStart.commands.flatMap { it.toCommands(flowPath, appId) }) } - - companion object { - - @Deprecated("Obsolete API. See #1921") - private fun stringInitCommands(initFlow: StringInitFlow, flowPath: Path): List { - val initFlowPath = getInitFlowPath(flowPath, initFlow.path) - return YamlCommandReader.readCommands(initFlowPath) - } - - @Deprecated("Obsolete API. See #1921") - private fun getInitFlowPath(flowPath: Path, initFlowPathString: String): Path { - val initFlowPath = flowPath.fileSystem.getPath(initFlowPathString) - val resolvedInitFlowPath = if (initFlowPath.isAbsolute) { - initFlowPath - } else { - flowPath.resolveSibling(initFlowPath).toAbsolutePath() - } - if (resolvedInitFlowPath.equals(flowPath.toAbsolutePath())) { - throw InvalidInitFlowFile("initFlow file can't be the same as the Flow file: ${resolvedInitFlowPath.toUri()}", resolvedInitFlowPath) - } - if (!resolvedInitFlowPath.exists()) { - throw InvalidInitFlowFile("initFlow file does not exist: ${resolvedInitFlowPath.toUri()}", resolvedInitFlowPath) - } - if (resolvedInitFlowPath.isDirectory()) { - throw InvalidInitFlowFile("initFlow file can't be a directory: ${resolvedInitFlowPath.toUri()}", resolvedInitFlowPath) - } - return resolvedInitFlowPath - } - } } diff --git a/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlInitFlowUnion.kt b/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlInitFlowUnion.kt deleted file mode 100644 index 751d71b458..0000000000 --- a/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlInitFlowUnion.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * - * Copyright (c) 2022 mobile.dev inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package maestro.orchestra.yaml - -import com.fasterxml.jackson.core.JsonParser -import com.fasterxml.jackson.core.TreeNode -import com.fasterxml.jackson.core.type.TypeReference -import com.fasterxml.jackson.databind.DeserializationContext -import com.fasterxml.jackson.databind.JsonDeserializer -import com.fasterxml.jackson.databind.ObjectMapper -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.node.TextNode - -@Deprecated("Obsolete API. See #1921") -@JsonDeserialize(using = YamlInitFlowDeserializer::class) -sealed interface YamlInitFlowUnion - -@Deprecated("Obsolete API. See #1921") -class StringInitFlow( - val path: String -) : YamlInitFlowUnion - -@Deprecated("Obsolete API. See #1921") -class YamlInitFlow( - val commands: List -) : YamlInitFlowUnion - -@Deprecated("Obsolete API. See #1921") -class YamlInitFlowDeserializer : JsonDeserializer() { - - override fun deserialize(parser: JsonParser, ctx: DeserializationContext): YamlInitFlowUnion { - val mapper = parser.codec as ObjectMapper - val root: TreeNode = mapper.readTree(parser) - - return if (root is TextNode) { - StringInitFlow(root.textValue()) - } else { - val commands = mapper.convertValue(root, object : TypeReference>() {}) - YamlInitFlow(commands) - } - } -} diff --git a/maestro-orchestra/src/test/java/maestro/orchestra/yaml/YamlCommandReaderTest.kt b/maestro-orchestra/src/test/java/maestro/orchestra/yaml/YamlCommandReaderTest.kt index 97ed195da7..61f0174887 100644 --- a/maestro-orchestra/src/test/java/maestro/orchestra/yaml/YamlCommandReaderTest.kt +++ b/maestro-orchestra/src/test/java/maestro/orchestra/yaml/YamlCommandReaderTest.kt @@ -118,13 +118,6 @@ internal class YamlCommandReaderTest { assertThat(e.message).contains("Flow files must contain a config section and a commands section") } - @Test - fun initFlow( - @YamlFile("007_initFlow.yaml") e: SyntaxError, - ) { - assertThat(e.message).containsMatch("initFlow command used at.*is deprecated") - } - @Test fun config_unknownKeys( @YamlFile("008_config_unknownKeys.yaml") commands: List, @@ -160,41 +153,6 @@ internal class YamlCommandReaderTest { assertThat(e.message).contains("Invalid command: \"invalid\"") } - @Test - fun initFlow_file( - @YamlFile("011_initFlow_file.yaml") e: SyntaxError, - ) { - assertThat(e.message).containsMatch("initFlow command used at.*is deprecated") - } - - @Test - fun initFlow_emptyString( - @YamlFile("012_initFlow_emptyString.yaml") commands: List, - ) { - assertThat(commands).containsExactly( - ApplyConfigurationCommand(MaestroConfig( - appId = "com.example.app", - )), - LaunchAppCommand( - appId = "com.example.app", - ), - ) - } - - @Test - fun initFlow_invalidFile( - @YamlFile("013_initFlow_invalidFile.yaml") e: SyntaxError, - ) { - assertThat(e.message).containsMatch("initFlow command used at.*is deprecated") - } - - @Test - fun initFlow_recursive( - @YamlFile("014_initFlow_recursive.yaml") e: SyntaxError, - ) { - assertThat(e.message).containsMatch("initFlow command used at.*is deprecated") - } - @Test fun onlyCommands( @YamlFile("015_onlyCommands.yaml") e: SyntaxError, diff --git a/maestro-orchestra/src/test/resources/YamlCommandReaderTest/005_config_noAppId.yaml b/maestro-orchestra/src/test/resources/YamlCommandReaderTest/005_config_noAppId.yaml index 9c689ef5f0..dc278a4cd3 100644 --- a/maestro-orchestra/src/test/resources/YamlCommandReaderTest/005_config_noAppId.yaml +++ b/maestro-orchestra/src/test/resources/YamlCommandReaderTest/005_config_noAppId.yaml @@ -1,3 +1,3 @@ -initFlow: [] +name: Example app --- - launchApp diff --git a/maestro-orchestra/src/test/resources/YamlCommandReaderTest/007_initFlow.yaml b/maestro-orchestra/src/test/resources/YamlCommandReaderTest/007_initFlow.yaml deleted file mode 100644 index 2cf1f2097b..0000000000 --- a/maestro-orchestra/src/test/resources/YamlCommandReaderTest/007_initFlow.yaml +++ /dev/null @@ -1,6 +0,0 @@ -appId: com.example.app -initFlow: - - launchApp: - clearState: true ---- -- launchApp diff --git a/maestro-orchestra/src/test/resources/YamlCommandReaderTest/011_initFlow_file.yaml b/maestro-orchestra/src/test/resources/YamlCommandReaderTest/011_initFlow_file.yaml deleted file mode 100644 index 1343d67e85..0000000000 --- a/maestro-orchestra/src/test/resources/YamlCommandReaderTest/011_initFlow_file.yaml +++ /dev/null @@ -1,4 +0,0 @@ -appId: com.example.app -initFlow: 002_launchApp.yaml ---- -- launchApp diff --git a/maestro-orchestra/src/test/resources/YamlCommandReaderTest/012_initFlow_emptyString.yaml b/maestro-orchestra/src/test/resources/YamlCommandReaderTest/012_initFlow_emptyString.yaml deleted file mode 100644 index 8303be7df0..0000000000 --- a/maestro-orchestra/src/test/resources/YamlCommandReaderTest/012_initFlow_emptyString.yaml +++ /dev/null @@ -1,4 +0,0 @@ -appId: com.example.app -initFlow: ---- -- launchApp diff --git a/maestro-orchestra/src/test/resources/YamlCommandReaderTest/013_initFlow_invalidFile.yaml b/maestro-orchestra/src/test/resources/YamlCommandReaderTest/013_initFlow_invalidFile.yaml deleted file mode 100644 index 01273aab68..0000000000 --- a/maestro-orchestra/src/test/resources/YamlCommandReaderTest/013_initFlow_invalidFile.yaml +++ /dev/null @@ -1,4 +0,0 @@ -appId: com.example.app -initFlow: invalidFile.yaml ---- -- launchApp diff --git a/maestro-orchestra/src/test/resources/YamlCommandReaderTest/014_initFlow_recursive.yaml b/maestro-orchestra/src/test/resources/YamlCommandReaderTest/014_initFlow_recursive.yaml deleted file mode 100644 index 8280d6585d..0000000000 --- a/maestro-orchestra/src/test/resources/YamlCommandReaderTest/014_initFlow_recursive.yaml +++ /dev/null @@ -1,4 +0,0 @@ -appId: com.example.app -initFlow: 014_initFlow_recursive.yaml ---- -- launchApp diff --git a/maestro-orchestra/src/test/resources/YamlCommandReaderTest/015_onlyCommands.yaml b/maestro-orchestra/src/test/resources/YamlCommandReaderTest/015_onlyCommands.yaml index 7efe6a34d8..a1ec8ce58b 100644 --- a/maestro-orchestra/src/test/resources/YamlCommandReaderTest/015_onlyCommands.yaml +++ b/maestro-orchestra/src/test/resources/YamlCommandReaderTest/015_onlyCommands.yaml @@ -1,4 +1,2 @@ -- config: - initFlow: - - launchApp: com.example +- nonExistentCommand - launchApp: com.example diff --git a/maestro-test/src/test/kotlin/maestro/test/IntegrationTest.kt b/maestro-test/src/test/kotlin/maestro/test/IntegrationTest.kt index 9a1de41789..139ba74767 100644 --- a/maestro-test/src/test/kotlin/maestro/test/IntegrationTest.kt +++ b/maestro-test/src/test/kotlin/maestro/test/IntegrationTest.kt @@ -603,57 +603,6 @@ class IntegrationTest { } } - @Test - fun `Case 023 - runFlow with initFlow`() { - assertThrows { - val commands = readCommands("024_init_flow_init_state") - val initFlow = YamlCommandReader.getConfig(commands)!!.initFlow!! - - val driver = driver { - element { - text = "Hello" - bounds = Bounds(0, 0, 100, 100) - } - } - driver.addInstalledApp("com.example.app") - - val otherDriver = driver { - element { - text = "Hello" - bounds = Bounds(0, 0, 100, 100) - } - } - otherDriver.addInstalledApp("com.example.app") - val state = Maestro(driver).use { - orchestra(it).runInitFlow(initFlow) - }!! - Maestro(otherDriver).use { - orchestra(it).runFlow(commands, state) - } - } - } - - @Test - fun `Case 024 - runFlow with initState`() { - assertThrows { - // Given - val commands = readCommands("023_init_flow") - - val driver = driver { - element { - text = "Hello" - bounds = Bounds(0, 0, 100, 100) - } - } - driver.addInstalledApp("com.example.app") - - // When - Maestro(driver).use { - orchestra(it).runFlow(commands) - } - } - } - @Test fun `Case 025 - Tap on element relative position using shortcut`() { // Given diff --git a/maestro-test/src/test/resources/023_init_flow.yaml b/maestro-test/src/test/resources/023_init_flow.yaml deleted file mode 100644 index a9525cfaaf..0000000000 --- a/maestro-test/src/test/resources/023_init_flow.yaml +++ /dev/null @@ -1,6 +0,0 @@ -appId: com.example.app -initFlow: - - launchApp: - clearState: true ---- -- tapOn: hello diff --git a/maestro-test/src/test/resources/024_init_flow_init_state.yaml b/maestro-test/src/test/resources/024_init_flow_init_state.yaml deleted file mode 100644 index a9525cfaaf..0000000000 --- a/maestro-test/src/test/resources/024_init_flow_init_state.yaml +++ /dev/null @@ -1,6 +0,0 @@ -appId: com.example.app -initFlow: - - launchApp: - clearState: true ---- -- tapOn: hello