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

Handle situation when there is no terminal tab to close #1240

Merged
merged 1 commit into from
Jan 23, 2025
Merged
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
@@ -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
turkeylurkey marked this conversation as resolved.
Show resolved Hide resolved
}
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
Loading