From 7ec6f51d12638617883d8dd1a94ae73c4bb2ec3d Mon Sep 17 00:00:00 2001 From: Anusree Lakshmi Date: Sat, 9 Nov 2024 22:01:54 +0530 Subject: [PATCH] closetab-fix --- .../intellij/it/SingleModMPProjectTestCommon.java | 3 ++- .../tools/intellij/it/UIBotTestUtils.java | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java index 7555bbaac..f1ce0623b 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java +++ b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java @@ -98,7 +98,8 @@ public void testOpenBuildFileActionUsingPopUpMenu() { "Editor tab with the name of " + editorTabName + " could not be found."); // Close the editor tab. - UIBotTestUtils.closeFileEditorTab(remoteRobot, editorTabName, "10"); +// UIBotTestUtils.closeFileEditorTab(remoteRobot, editorTabName, "10"); + UIBotTestUtils.rightClickCloseOnFileTab(remoteRobot, editorTabName); } /** diff --git a/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java b/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java index fe2ff14c2..c1e86fd2a 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java +++ b/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java @@ -805,6 +805,21 @@ public static void clickOnFileTab(RemoteRobot remoteRobot, String fileName) { } } + public static void rightClickCloseOnFileTab(RemoteRobot remoteRobot, String fileName) { + ProjectFrameFixture projectFrame = remoteRobot.find(ProjectFrameFixture.class, Duration.ofSeconds(10)); + + try { + String xPath = "//div[@accessiblename='" + fileName + "' and @class='SimpleColoredComponent']"; + ComponentFixture actionButton = projectFrame.getActionButton(xPath, "10"); + actionButton.rightClick(); + ComponentFixture closeFixture = projectFrame.getActionMenuItem("Close"); + closeFixture.click(); + + } catch (WaitForConditionTimeoutException e) { + // file not open, nothing to do + } + } + public static void clickOnFileTabNew(RemoteRobot remoteRobot, String fileName) { ProjectFrameFixture projectFrame = remoteRobot.find(ProjectFrameFixture.class, Duration.ofSeconds(10));