@Nullable
@Override
protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment environment) throws ExecutionException {
FileDocumentManager.getInstance().saveAllDocuments();
ExecutionResult executionResult = state.execute(environment.getExecutor(), this);
if (executionResult == null) {
return null;
}
KarmaConsoleView consoleView = KarmaConsoleView.get(executionResult);
if (consoleView == null) {
LOG.error("Can't get KarmaConsoleView from executionResult!");
return null;
}
final RunContentDescriptor descriptor = new RunContentBuilder(executionResult, environment).showRunContent(environment.getContentToReuse());
KarmaServer server = consoleView.getKarmaExecutionSession().getKarmaServer();
if (!server.areBrowsersReady()) {
server.onBrowsersReady(new Runnable() {
@Override
public void run() {
ExecutionUtil.restartIfActive(descriptor);
}
});
}
else {
RerunTestsNotification.showRerunNotification(environment.getContentToReuse(), executionResult.getExecutionConsole());
}
RerunTestsAction.register(environment);
return descriptor;
}