Commit 00756ed5 authored by Romain Bioteau's avatar Romain Bioteau

* Catch the WidgetNotFoundException in the conditions for the active (#1470)

editor title, to avoid failure if no editor is opened when the condition
is evaluated
parent fb439c13
......@@ -185,7 +185,13 @@ public class ProjectExplorerBot extends BotBase {
public void waitUntilActiveEditorTitleIs(String title, Optional<String> extension) {
String expectedTitle = extension.isPresent() ? title + extension.get() : title;
ICondition condition = new ConditionBuilder()
.withTest(() -> Objects.equals(bot.activeEditor().getTitle(), expectedTitle))
.withTest(() -> {
try {
return Objects.equals(bot.activeEditor().getTitle(), expectedTitle);
} catch (WidgetNotFoundException e) {
return false;
}
})
.withFailureMessage(() -> String.format("The active editor title should be %s instead of %s", expectedTitle,
bot.activeEditor().getTitle()))
.create();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment