Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional field to commands #1946

Merged
merged 9 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -229,6 +229,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
Loading