use of com.intellij.execution.testframework.sm.runner.ui.TestTreeRenderer in project intellij-community by JetBrains.
the class GradleTestsExecutionConsoleManager method attachExecutionConsole.
@NotNull
@Override
public GradleTestsExecutionConsole attachExecutionConsole(@NotNull final ExternalSystemTask task, @NotNull final Project project, @NotNull final ExternalSystemRunConfiguration configuration, @NotNull final Executor executor, @NotNull final ExecutionEnvironment env, @NotNull final ProcessHandler processHandler) throws ExecutionException {
final GradleConsoleProperties consoleProperties = new GradleConsoleProperties(configuration, executor);
String testFrameworkName = configuration.getSettings().getExternalSystemId().getReadableName();
String splitterPropertyName = SMTestRunnerConnectionUtil.getSplitterPropertyName(testFrameworkName);
final GradleTestsExecutionConsole consoleView = new GradleTestsExecutionConsole(consoleProperties, splitterPropertyName);
consoleView.initTaskExecutionView(project, processHandler, task.getId());
SMTestRunnerConnectionUtil.initConsoleView(consoleView, testFrameworkName);
consoleView.attachToProcess(processHandler);
final TestTreeView testTreeView = consoleView.getResultsViewer().getTreeView();
if (testTreeView != null) {
TestTreeRenderer originalRenderer = ObjectUtils.tryCast(testTreeView.getCellRenderer(), TestTreeRenderer.class);
if (originalRenderer != null) {
originalRenderer.setAdditionalRootFormatter(new SMRootTestProxyFormatter() {
@Override
public void format(@NotNull SMTestProxy.SMRootTestProxy testProxy, @NotNull TestTreeRenderer renderer) {
final TestStateInfo.Magnitude magnitude = testProxy.getMagnitudeInfo();
if (magnitude == TestStateInfo.Magnitude.RUNNING_INDEX) {
renderer.clear();
renderer.append(GradleBundle.message("gradle.test.runner.ui.tests.tree.presentation.labels.waiting.tests"), SimpleTextAttributes.REGULAR_ATTRIBUTES);
} else if (!testProxy.isInProgress() && testProxy.isEmptySuite()) {
renderer.clear();
renderer.append(GradleBundle.message("gradle.test.runner.ui.tests.tree.presentation.labels.no.tests.were.found"), SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
}
});
}
}
if (task instanceof ExternalSystemExecuteTaskTask) {
final ExternalSystemExecuteTaskTask executeTask = (ExternalSystemExecuteTaskTask) task;
if (executeTask.getArguments() == null || !StringUtil.contains(executeTask.getArguments(), "--tests")) {
executeTask.appendArguments("--tests *");
}
}
return consoleView;
}
use of com.intellij.execution.testframework.sm.runner.ui.TestTreeRenderer in project intellij-plugins by JetBrains.
the class JstdConsoleView method initUI.
@Override
public void initUI() {
super.initUI();
if (myServer == null) {
return;
}
TestTreeView treeView = this.getResultsViewer().getTreeView();
TestTreeRenderer originalRenderer = ObjectUtils.tryCast(treeView.getCellRenderer(), TestTreeRenderer.class);
if (originalRenderer != null) {
myFormatter = new JstdRootTestProxyFormatter(myServer, treeView);
originalRenderer.setAdditionalRootFormatter(myFormatter);
}
if (!myServer.isStopped() && myServer.getCapturedBrowsers().isEmpty()) {
myServer.addLifeCycleListener(new JstdServerLifeCycleAdapter() {
@Override
public void onServerStarted() {
print("To capture a browser open ", ConsoleViewContentType.SYSTEM_OUTPUT);
String url = myServer.getServerUrl() + "/capture";
printHyperlink(url, new OpenUrlHyperlinkInfo(url));
print("\n", ConsoleViewContentType.SYSTEM_OUTPUT);
}
}, this);
}
myServer.addLifeCycleListener(new JstdServerLifeCycleAdapter() {
@Override
public void onServerTerminated(int exitCode) {
print("JsTestDriver server finished with exit code " + exitCode + "\n", ConsoleViewContentType.SYSTEM_OUTPUT);
JstdToolWindowManager.getInstance(getProperties().getProject()).show();
}
}, this);
}
Aggregations