Skip to content

Commit

Permalink
closetab-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vaisakhkannan committed Nov 9, 2024
1 parent ecf3525 commit 7ec6f51
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
15 changes: 15 additions & 0 deletions src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down

0 comments on commit 7ec6f51

Please sign in to comment.