diff --git a/maestro-cli/src/main/java/maestro/cli/api/ApiClient.kt b/maestro-cli/src/main/java/maestro/cli/api/ApiClient.kt index 16ed950c30..116e1d0f9f 100644 --- a/maestro-cli/src/main/java/maestro/cli/api/ApiClient.kt +++ b/maestro-cli/src/main/java/maestro/cli/api/ApiClient.kt @@ -10,6 +10,7 @@ import com.github.michaelbull.result.map import maestro.cli.CliError import maestro.cli.analytics.Analytics import maestro.cli.analytics.AnalyticsReport +import maestro.cli.model.FlowStatus import maestro.cli.runner.resultview.AnsiResultView import maestro.cli.util.CiUtils import maestro.cli.util.EnvUtils @@ -518,7 +519,7 @@ data class UploadStatus( data class FlowResult( val name: String, - val status: Status, + val status: FlowStatus, val errors: List, val cancellationReason: CancellationReason? = null ) diff --git a/maestro-cli/src/main/java/maestro/cli/cloud/CloudInteractor.kt b/maestro-cli/src/main/java/maestro/cli/cloud/CloudInteractor.kt index 30e13287b8..f0e3c691f4 100644 --- a/maestro-cli/src/main/java/maestro/cli/cloud/CloudInteractor.kt +++ b/maestro-cli/src/main/java/maestro/cli/cloud/CloudInteractor.kt @@ -310,8 +310,8 @@ class CloudInteractor( val runningFlow = runningFlows.flows.find { it.name == uploadFlowResult.name } ?: continue runningFlow.status = uploadFlowResult.status when (runningFlow.status) { - UploadStatus.Status.PENDING -> { /* do nothing */ } - UploadStatus.Status.RUNNING -> { + FlowStatus.PENDING -> { /* do nothing */ } + FlowStatus.RUNNING -> { if (runningFlow.startTime == null) { runningFlow.startTime = System.currentTimeMillis() } @@ -392,7 +392,7 @@ class CloudInteractor( val isCancelled = upload.status == UploadStatus.Status.CANCELED val isFailure = upload.status == UploadStatus.Status.ERROR val containsFailure = - upload.flows.find { it.status == UploadStatus.Status.ERROR } != null // status can be cancelled but also contain flow with failure + upload.flows.find { it.status == FlowStatus.ERROR } != null // status can be cancelled but also contain flow with failure val failed = isFailure || containsFailure || isCancelled && failOnCancellation @@ -448,7 +448,7 @@ class CloudInteractor( TestExecutionSummary.FlowResult( name = uploadFlowResult.name, fileName = null, - status = FlowStatus.from(uploadFlowResult.status), + status = uploadFlowResult.status, failure = if (failure != null) TestExecutionSummary.Failure(failure) else null, duration = runningFlows.flows.find { it.name == uploadFlowResult.name }?.duration ) diff --git a/maestro-cli/src/main/java/maestro/cli/model/FlowStatus.kt b/maestro-cli/src/main/java/maestro/cli/model/FlowStatus.kt index a4e0b3d706..64516d4fbd 100644 --- a/maestro-cli/src/main/java/maestro/cli/model/FlowStatus.kt +++ b/maestro-cli/src/main/java/maestro/cli/model/FlowStatus.kt @@ -8,6 +8,7 @@ enum class FlowStatus { SUCCESS, ERROR, CANCELED, + STOPPED, WARNING; companion object { diff --git a/maestro-cli/src/main/java/maestro/cli/model/RunningFlow.kt b/maestro-cli/src/main/java/maestro/cli/model/RunningFlow.kt index 36d43bf031..8f280b691c 100644 --- a/maestro-cli/src/main/java/maestro/cli/model/RunningFlow.kt +++ b/maestro-cli/src/main/java/maestro/cli/model/RunningFlow.kt @@ -10,7 +10,7 @@ data class RunningFlows( data class RunningFlow( val name: String, - var status: UploadStatus.Status? = null, + var status: FlowStatus? = null, var startTime: Long? = null, var duration: Duration? = null, var reported: Boolean = false diff --git a/maestro-cli/src/main/java/maestro/cli/view/TestSuiteStatusView.kt b/maestro-cli/src/main/java/maestro/cli/view/TestSuiteStatusView.kt index 364927e329..81511a6523 100644 --- a/maestro-cli/src/main/java/maestro/cli/view/TestSuiteStatusView.kt +++ b/maestro-cli/src/main/java/maestro/cli/view/TestSuiteStatusView.kt @@ -88,6 +88,7 @@ object TestSuiteStatusView { FlowStatus.SUCCESS, FlowStatus.WARNING -> Ansi.Color.GREEN FlowStatus.ERROR -> Ansi.Color.RED + FlowStatus.STOPPED -> Ansi.Color.RED else -> Ansi.Color.DEFAULT } val title = when (status) { @@ -96,6 +97,7 @@ object TestSuiteStatusView { FlowStatus.ERROR -> "Failed" FlowStatus.PENDING -> "Pending" FlowStatus.RUNNING -> "Running" + FlowStatus.STOPPED -> "Stopped" FlowStatus.CANCELED -> when (cancellationReason) { UploadStatus.CancellationReason.TIMEOUT -> "Timeout" UploadStatus.CancellationReason.OVERLAPPING_BENCHMARK -> "Skipped" @@ -174,7 +176,7 @@ object TestSuiteStatusView { duration: Duration? = null ) = FlowResult( name = name, - status = FlowStatus.from(status, ), + status = status, error = errors.firstOrNull(), cancellationReason = cancellationReason, duration = duration