Skip to content

Commit

Permalink
Merge pull request #1240 from turkeylurkey/issue-1238
Browse files Browse the repository at this point in the history
Handle situation when there is no terminal tab to close
  • Loading branch information
turkeylurkey authored Jan 23, 2025
2 parents 034fa10 + 5f4009a commit c357daa
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2023, 2024 IBM Corporation.
* Copyright (c) 2023, 2025 IBM Corporation.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -13,6 +13,7 @@
import com.intellij.remoterobot.RemoteRobot;
import com.intellij.remoterobot.fixtures.ComponentFixture;
import com.intellij.remoterobot.utils.Keyboard;
import com.intellij.remoterobot.utils.WaitForConditionTimeoutException;
import io.openliberty.tools.intellij.it.fixtures.ProjectFrameFixture;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.condition.EnabledOnOs;
Expand Down Expand Up @@ -1242,11 +1243,15 @@ public static void deleteDirectoryIfExists(String dirPath) {
* Clean project.
*/
public void stopTerminal() {

Keyboard keyboard = new Keyboard(remoteRobot);
ProjectFrameFixture projectFrame = remoteRobot.find(ProjectFrameFixture.class, Duration.ofSeconds(10));
ComponentFixture terminal = remoteRobot.find(ComponentFixture.class, byXpath("//div[@class='JBTerminalPanel']"), Duration.ofSeconds(10));

ProjectFrameFixture projectFrame;
ComponentFixture terminal;
try {
projectFrame = remoteRobot.find(ProjectFrameFixture.class, Duration.ofSeconds(10));
terminal = remoteRobot.find(ComponentFixture.class, byXpath("//div[@class='JBTerminalPanel']"), Duration.ofSeconds(10));
} catch (WaitForConditionTimeoutException w) {
return; // there is no terminal with a Liberty to stop
}
terminal.rightClick();
ComponentFixture openFixtureNewTab = projectFrame.getActionMenuItem("New Tab");
openFixtureNewTab.click(new Point());
Expand All @@ -1268,7 +1273,6 @@ public void stopTerminal() {
* Stop the Server.
*/
public void cleanTerminal() {

Keyboard keyboard = new Keyboard(remoteRobot);
// Perform clean
if (getBuildCategory() == BuildType.MAVEN_TYPE) {
Expand Down

0 comments on commit c357daa

Please sign in to comment.