Skip to content

Commit

Permalink
Add "optional" field to commands (#1946)
Browse files Browse the repository at this point in the history
Co-authored-by: Bartek Pacia <[email protected]>
  • Loading branch information
tokou and bartekpacia authored Sep 3, 2024
1 parent 2b73223 commit 030455f
Show file tree
Hide file tree
Showing 38 changed files with 326 additions and 138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ object TestDebugReporter {
val status = when (it.status) {
CommandStatus.COMPLETED -> ""
CommandStatus.FAILED -> ""
CommandStatus.WARNED -> "⚠️"
else -> ""
}
val filename = "screenshot-$status-${it.timestamp}-(${flowName}).png"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ enum class CommandStatus {
RUNNING,
COMPLETED,
FAILED,
WARNED,
SKIPPED,
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,17 @@ object MaestroCommandRunner {
}
refreshUi()
},
onCommandWarned = { _, command ->
logger.info("${command.description()} WARNED")
commandStatuses[command] = CommandStatus.WARNED
debugOutput.commands[command]?.apply {
status = CommandStatus.WARNED
}

takeDebugScreenshot(CommandStatus.WARNED)

refreshUi()
},
onCommandReset = { command ->
logger.info("${command.description()} PENDING")
commandStatuses[command] = CommandStatus.PENDING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ class TestSuiteInteractor(
it.status = CommandStatus.SKIPPED
}
},
onCommandWarned = { _, command ->
logger.info("${command.description()} WARNED")
debugOutput.commands[command]?.apply {
status = CommandStatus.WARNED
}
},
onCommandReset = { command ->
logger.info("${command.description()} PENDING")
debugOutput.commands[command]?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ class AnsiResultView(

if (commandState.status == CommandStatus.SKIPPED) {
render(" (skipped)")
} else if (commandState.status == CommandStatus.WARNED) {
render(" (warned)")
} else if (commandState.numberOfRuns != null) {
val timesWord = if (commandState.numberOfRuns == 1) "time" else "times"
render(" (completed ${commandState.numberOfRuns} $timesWord)")
Expand Down Expand Up @@ -204,6 +206,7 @@ class AnsiResultView(
CommandStatus.FAILED -> ""
CommandStatus.RUNNING -> ""
CommandStatus.PENDING -> "\uD83D\uDD32 " // 🔲
CommandStatus.WARNED -> "⚠️"
CommandStatus.SKIPPED -> "⚪️"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class PlainTextResultView: ResultView {
}
}

CommandStatus.COMPLETED, CommandStatus.FAILED, CommandStatus.SKIPPED -> {
CommandStatus.COMPLETED, CommandStatus.FAILED, CommandStatus.SKIPPED, CommandStatus.WARNED -> {
registerStep()
if (shouldPrintStep()) {
println(" " + status(command.status))
Expand Down Expand Up @@ -148,6 +148,7 @@ class PlainTextResultView: ResultView {
CommandStatus.RUNNING -> "RUNNING"
CommandStatus.PENDING -> "PENDING"
CommandStatus.SKIPPED -> "SKIPPED"
CommandStatus.WARNED -> "WARNED"
}
}
}
Loading

0 comments on commit 030455f

Please sign in to comment.