From 6278f60edebe4d92f772a8bcb0d3375a0221c076 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Mar 2025 16:47:44 +0000 Subject: [PATCH 1/6] chore(deps): bump remote-robot from 0.11.22 to 0.11.23 Bumps `remote-robot` from 0.11.22 to 0.11.23. Updates `com.intellij.remoterobot:remote-robot` from 0.11.22 to 0.11.23 Updates `com.intellij.remoterobot:remote-fixtures` from 0.11.22 to 0.11.23 --- updated-dependencies: - dependency-name: com.intellij.remoterobot:remote-robot dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: com.intellij.remoterobot:remote-fixtures dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8b9e1caa..403fde6d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] # libraries -remote-robot = "0.11.22" +remote-robot = "0.11.23" kotlin = "2.1.0" junit-jupiter = "5.11.3" From 34a37fb71488110068de0f7346cc9e729c4b2df8 Mon Sep 17 00:00:00 2001 From: Stephane Bouchet Date: Wed, 9 Apr 2025 15:39:20 +0200 Subject: [PATCH 2/6] fix: fix failing tests Signed-off-by: Stephane Bouchet --- build.gradle.kts | 1 - .../intellij/commonuitest/UITestRunner.java | 4 +-- .../fixtures/dialogs/FlatWelcomeFrame.java | 35 +++++++++---------- .../navigation/SearchEverywherePopup.java | 2 +- .../pages/AbstractNewProjectFinalPage.java | 17 +++++---- .../pages/JavaNewProjectFinalPage.java | 19 +++++----- .../project/pages/NewProjectFirstPage.java | 11 +++--- .../fixtures/mainidewindow/MainIdeWindow.java | 6 +++- .../mainidewindow/menubar/MenuBar.java | 16 ++++----- .../toolwindowspane/AbstractToolWinPane.java | 11 +++--- .../toolwindowspane/ProjectExplorer.java | 7 ++-- .../buildtoolpane/GradleBuildToolPane.java | 18 ++++------ .../buildtoolpane/MavenBuildToolPane.java | 18 ++++++---- .../utils/project/CreateCloseUtils.java | 9 ++--- .../commonuitest/utils/steps/SharedSteps.java | 4 +-- src/test-project/gradle.properties | 2 +- .../information/CodeWithMeDialogTest.java | 3 +- .../NewProjectDialogTest.java | 21 +++++------ .../toolwindowspane/BuildViewTest.java | 4 +-- .../toolwindowspane/ProjectExplorerTest.java | 4 +-- .../GradleBuildToolPaneTest.java | 2 +- .../buildtoolpane/MavenBuildToolPaneTest.java | 16 +++++++-- 22 files changed, 123 insertions(+), 107 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index fb65e86d..160b1bb7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -43,7 +43,6 @@ tasks { jacocoTestReport { executionData.setFrom(fileTree(layout.buildDirectory).include("/jacoco/*.exec")) - //classDirectories.setFrom(instrumentCode) reports { xml.required = true } diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/UITestRunner.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/UITestRunner.java index 77f92d6b..21f893c0 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/UITestRunner.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/UITestRunner.java @@ -11,12 +11,12 @@ package com.redhat.devtools.intellij.commonuitest; import com.intellij.remoterobot.RemoteRobot; -import com.intellij.remoterobot.fixtures.CommonContainerFixture; import com.intellij.remoterobot.stepsProcessing.StepLogger; import com.intellij.remoterobot.stepsProcessing.StepWorker; import com.redhat.devtools.intellij.commonuitest.exceptions.UITestException; import com.redhat.devtools.intellij.commonuitest.utils.constants.XPathDefinitions; import com.redhat.devtools.intellij.commonuitest.utils.runner.IntelliJVersion; +import com.redhat.devtools.intellij.commonuitest.utils.steps.SharedSteps; import java.io.File; import java.io.FileOutputStream; @@ -154,7 +154,7 @@ public static RemoteRobot getRemoteRobot() { public static RemoteRobot getRemoteRobotConnection(int port) { return step("Create an instance of the RemoteRobot listening on port " + port, () -> { RemoteRobot remoteRobot = new RemoteRobot("http://127.0.0.1:" + port); - waitFor(Duration.ofSeconds(30), Duration.ofMillis(500), () -> remoteRobot.find(CommonContainerFixture.class, byXpath(XPathDefinitions.FLAT_WELCOME_FRAME)).isShowing()); + SharedSteps.waitForComponentByXpath(remoteRobot,30, 200, byXpath(XPathDefinitions.FLAT_WELCOME_FRAME)); return remoteRobot; }); } diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/FlatWelcomeFrame.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/FlatWelcomeFrame.java index f7afc644..f050617d 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/FlatWelcomeFrame.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/FlatWelcomeFrame.java @@ -61,12 +61,11 @@ public class FlatWelcomeFrame extends CommonContainerFixture { private static final String PROJECTS_BUTTON = "Projects"; private static final String TIP_OF_THE_DAY = "Tip of the Day"; private final RemoteRobot remoteRobot; - private final int ideaVersion; + private final int ideaVersionInt = UITestRunner.getIdeaVersionInt(); public FlatWelcomeFrame(@NotNull RemoteRobot remoteRobot, @NotNull RemoteComponent remoteComponent) { super(remoteRobot, remoteComponent); this.remoteRobot = remoteRobot; - this.ideaVersion = UITestRunner.getIdeaVersion().toInt(); } /** @@ -93,7 +92,7 @@ public void openProject(String projectName) { */ public void clickOnLink(String label) { // Code for IntelliJ IDEA 2020.3 or newer - if (ideaVersion >= 20203) { + if (ideaVersionInt >= 20203) { welcomeFrameLink(label).click(); } // Code for IntelliJ IDEA 2020.2 or earlier @@ -150,11 +149,11 @@ public void clearExceptions() { * Open the 'Preferences' dialog */ public void openSettingsDialog() { - if (ideaVersion <= 20202) { + if (ideaVersionInt <= 20202) { clickOnLink("Configure"); HeavyWeightWindowFixture heavyWeightWindowFixture = find(HeavyWeightWindowFixture.class, Duration.ofSeconds(5)); heavyWeightWindowFixture.findText("Preferences").click(); - } else if (ideaVersion <= 20212) { + } else if (ideaVersionInt <= 20212) { JListFixture jListFixture = remoteRobot.find(JListFixture.class, byXpath(XPathDefinitions.JBLIST)); jListFixture.clickItem("Customize", false); remoteRobot.find(ContainerFixture.class, byXpath(XPathDefinitions.DIALOG_PANEL)).findText("All settings" + '\u2026').click(); @@ -205,20 +204,20 @@ private void resizeWelcomeWindow() { * @return fixture for the 'Tip Of the Day' dialog */ public TipDialog openTipDialog() { - if (ideaVersion >= 20211) { + if (ideaVersionInt >= 20211) { FlatWelcomeFrame flatWelcomeFrame = remoteRobot.find(FlatWelcomeFrame.class, Duration.ofSeconds(2)); - if (ideaVersion >= 20223) { // COMMUNITY_V_2022_3 and higher version have different labels for Learn button + if (ideaVersionInt >= 20223) { // COMMUNITY_V_2022_3 and higher version have different labels for Learn button flatWelcomeFrame.findText(ButtonLabels.LEARN_LABEL).click(); } else { flatWelcomeFrame.findText(ButtonLabels.LEARN_INTELLIJ_IDEA_LABEL).click(); } - SharedSteps.waitForComponentByXpath(remoteRobot, 2, 1, byXpath(XPathDefinitions.TIP_DIALOG_2)); + SharedSteps.waitForComponentByXpath(remoteRobot, 2, 200, byXpath(XPathDefinitions.TIP_DIALOG_2)); flatWelcomeFrame.findText(TIP_OF_THE_DAY).click(); - } else if (ideaVersion <= 20202) { + } else if (ideaVersionInt <= 20202) { clickOnLink("Get Help"); HeavyWeightWindowFixture heavyWeightWindowFixture = find(HeavyWeightWindowFixture.class, Duration.ofSeconds(5)); heavyWeightWindowFixture.findText(TIP_OF_THE_DAY).click(); - } else if (ideaVersion == 20203) { // IJ 2020.3 + } else if (ideaVersionInt == 20203) { // IJ 2020.3 actionLink("Help").click(); HeavyWeightWindowFixture heavyWeightWindowFixture = find(HeavyWeightWindowFixture.class, Duration.ofSeconds(5)); heavyWeightWindowFixture.findText(TIP_OF_THE_DAY).click(); @@ -254,17 +253,17 @@ public void preventTipDialogFromOpening() { * Switch to the 'Projects' page of flat welcome frame */ public void switchToProjectsPage() { - if (ideaVersion >= 20213) { + if (ideaVersionInt >= 20213) { JTreeFixture jTreeFixture = remoteRobot.find(JTreeFixture.class, byXpath(XPathDefinitions.TREE)); jTreeFixture.findText(PROJECTS_BUTTON).click(); - } else if (ideaVersion >= 20203) { + } else if (ideaVersionInt >= 20203) { JListFixture jListFixture = remoteRobot.find(JListFixture.class, byXpath(XPathDefinitions.JBLIST)); jListFixture.clickItem(PROJECTS_BUTTON, false); } } private int projectsCount() { - if (ideaVersion >= 20222) { + if (ideaVersionInt >= 20222) { try { JTreeFixture projects = remoteRobot.findAll(JTreeFixture.class, byXpath(XPathDefinitions.RECENT_PROJECT_PANEL_NEW_2)).get(0); return projects.findAllText().size() / 2; @@ -287,7 +286,7 @@ private JButtonFixture welcomeFrameLink(String label) { if (UtilsKt.hasAnyComponent(this, byXpath(XPathDefinitions.RECENT_PROJECT_PANEL_NEW))) { return button(byXpath(XPathDefinitions.jBOptionButton(label)), Duration.ofSeconds(2)); } - if (ideaVersion >= 20241 && label.equals("New Project")) { + if (ideaVersionInt >= 20241 && label.equals("New Project")) { return button(byXpath(XPathDefinitions.CREATE_NEW_PROJECT), Duration.ofSeconds(2)); } return button(byXpath(XPathDefinitions.nonOpaquePanel(label)), Duration.ofSeconds(2)); @@ -299,7 +298,7 @@ private ComponentFixture ideErrorsIcon() { private void removeTopProjectFromRecentProjects() { ComponentFixture recentProjects; - if (ideaVersion >= 20222) { + if (ideaVersionInt >= 20222) { recentProjects = remoteRobot.findAll(JTreeFixture.class, byXpath(XPathDefinitions.RECENT_PROJECT_PANEL_NEW_2)).get(0); } else { recentProjects = jLists(byXpath(XPathDefinitions.RECENT_PROJECTS)).get(0); @@ -309,14 +308,14 @@ private void removeTopProjectFromRecentProjects() { recentProjects.runJs("const horizontal_offset = component.getWidth()-22;\n" + "robot.click(component, new Point(horizontal_offset, 22), MouseButton.LEFT_BUTTON, 1);"); - if (ideaVersion >= 20231) { + if (ideaVersionInt >= 20231) { ComponentFixture removeDialog = remoteRobot.find(ComponentFixture.class, byXpath(XPathDefinitions.MY_DIALOG), Duration.ofSeconds(10)); removeDialog.findText(ButtonLabels.REMOVE_FROM_LIST_LABEL).click(); - } else if (ideaVersion >= 20203) { // Code for IntelliJ Idea 2020.3 or newer + } else if (ideaVersionInt >= 20203) { // Code for IntelliJ Idea 2020.3 or newer List jPopupMenuFixtures = jPopupMenus(JPopupMenuFixture.Companion.byType()); if (!jPopupMenuFixtures.isEmpty()) { JPopupMenuFixture contextMenu = jPopupMenuFixtures.get(0); - if (ideaVersion >= 20222) { + if (ideaVersionInt >= 20222) { contextMenu.select("Remove from Recent Projects" + '\u2026'); button(byXpath(XPathDefinitions.REMOVE_PROJECT_BUTTON)).click(); } else { diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/navigation/SearchEverywherePopup.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/navigation/SearchEverywherePopup.java index be015ce6..d908ecb3 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/navigation/SearchEverywherePopup.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/navigation/SearchEverywherePopup.java @@ -67,7 +67,7 @@ public void activateTab(String tabName) { * @param cmdToEnter command that will be invoked using the search field */ public void invokeCmd(String cmdToEnter) { - JTextFieldFixture searchField = textField(JTextFieldFixture.Companion.byType(), Duration.ofSeconds(10)); + JTextFieldFixture searchField = textField(JTextFieldFixture.Companion.byType(), Duration.ofSeconds(2)); searchField.click(); searchField.setText(cmdToEnter); waitFor(Duration.ofSeconds(30), Duration.ofSeconds(1), "The search in the Search Everywhere popup did not finish in 30 seconds.", () -> didSearchFinish(cmdToEnter)); diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/AbstractNewProjectFinalPage.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/AbstractNewProjectFinalPage.java index bdef5398..c1305012 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/AbstractNewProjectFinalPage.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/AbstractNewProjectFinalPage.java @@ -35,6 +35,9 @@ @DefaultXpath(by = "MyDialog type", xpath = XPathDefinitions.DIALOG_ROOT_PANE) @FixtureName(name = "New Project Dialog") public abstract class AbstractNewProjectFinalPage extends CommonContainerFixture { + + private final int ideaVersionInt = UITestRunner.getIdeaVersionInt(); + protected AbstractNewProjectFinalPage(@NotNull RemoteRobot remoteRobot, @NotNull RemoteComponent remoteComponent) { super(remoteRobot, remoteComponent); } @@ -45,7 +48,7 @@ protected AbstractNewProjectFinalPage(@NotNull RemoteRobot remoteRobot, @NotNull * @return currently set new project name */ public String getProjectName() { - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { return textFields(byXpath(XPathDefinitions.JBTEXT_FIELD)).get(0).getText(); } else { return textFields(JTextFieldFixture.Companion.byType()).get(0).getText(); @@ -58,7 +61,7 @@ public String getProjectName() { * @param projectName name of the new project */ public void setProjectName(String projectName) { - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { textFields(byXpath(XPathDefinitions.JBTEXT_FIELD)).get(0).setText(projectName); } else { textFields(JTextFieldFixture.Companion.byType()).get(0).setText(projectName); @@ -71,7 +74,7 @@ public void setProjectName(String projectName) { * @return currently set new project location */ public String getProjectLocation() { - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { return find(JTextFieldFixture.class, byXpath(XPathDefinitions.EXTENDABLE_TEXT_FIELD)).getText(); } else { return textFields(JTextFieldFixture.Companion.byType()).get(1).getText(); @@ -84,7 +87,7 @@ public String getProjectLocation() { * @param projectLocation project location of the new project */ public void setProjectLocation(String projectLocation) { - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { find(JTextFieldFixture.class, byXpath(XPathDefinitions.EXTENDABLE_TEXT_FIELD )).setText(projectLocation); } else { textFields(JTextFieldFixture.Companion.byType()).get(1).setText(projectLocation); @@ -96,7 +99,7 @@ public void setProjectLocation(String projectLocation) { */ public void openAdvanceSettings() { if (!isAdvancedSettingsOpened()) { - if (UITestRunner.getIdeaVersionInt() >= 20222) { + if (ideaVersionInt >= 20222) { find(ComponentFixture.class, byXpath(XPathDefinitions.COLLAPSIBLE_TITLED_SEPARATOR_NEW)).click(); } else { find(ComponentFixture.class, byXpath(XPathDefinitions.COLLAPSIBLE_TITLED_SEPARATOR)).click(); @@ -109,7 +112,7 @@ public void openAdvanceSettings() { */ public void closeAdvanceSettings() { if (isAdvancedSettingsOpened()) { - if (UITestRunner.getIdeaVersionInt() >= 20222) { + if (ideaVersionInt >= 20222) { find(ComponentFixture.class, byXpath(XPathDefinitions.COLLAPSIBLE_TITLED_SEPARATOR_NEW)).click(); } else { find(ComponentFixture.class, byXpath(XPathDefinitions.COLLAPSIBLE_TITLED_SEPARATOR)).click(); @@ -120,7 +123,7 @@ public void closeAdvanceSettings() { private boolean isAdvancedSettingsOpened() { List cf; - if (UITestRunner.getIdeaVersionInt() >= 20222) { + if (ideaVersionInt >= 20222) { cf = findAll(ComponentFixture.class, byXpath(XPathDefinitions.COLLAPSIBLE_TITLED_SEPARATOR_NEW_SIBLINGS)); } else { cf = findAll(ComponentFixture.class, byXpath(XPathDefinitions.COLLAPSIBLE_TITLED_SEPARATOR_SIBLINGS)); diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/JavaNewProjectFinalPage.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/JavaNewProjectFinalPage.java index ea0a62f5..4821bd4c 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/JavaNewProjectFinalPage.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/JavaNewProjectFinalPage.java @@ -36,6 +36,9 @@ @DefaultXpath(by = "MyDialog type", xpath = XPathDefinitions.DIALOG_ROOT_PANE) @FixtureName(name = "New Project Dialog") public class JavaNewProjectFinalPage extends AbstractNewProjectFinalPage { + + private final int ideaVersionInt = UITestRunner.getIdeaVersionInt(); + public JavaNewProjectFinalPage(@NotNull RemoteRobot remoteRobot, @NotNull RemoteComponent remoteComponent) { super(remoteRobot, remoteComponent); } @@ -70,10 +73,10 @@ public void closeMoreSettings() { * @return name of the module currently inserted in the input field */ public String getModuleName() { - if (UITestRunner.getIdeaVersionInt() >= 20242) { + if (ideaVersionInt >= 20242) { return find(JTextFieldFixture.class, byXpath(XPathDefinitions.GET_SET_MODULE_NAME_2024_2_AND_NEWER)).getText(); } - else if (UITestRunner.getIdeaVersionInt() >= 20221) { + else if (ideaVersionInt >= 20221) { return find(JTextFieldFixture.class, byXpath(XPathDefinitions.GET_SET_MODULE_NAME)).getText(); } else { return textField("Module name:", true).getText(); @@ -86,10 +89,10 @@ else if (UITestRunner.getIdeaVersionInt() >= 20221) { * @param moduleName name of the module that will be set into the input field */ public void setModuleName(String moduleName) { - if (UITestRunner.getIdeaVersionInt() >= 20242) { + if (ideaVersionInt >= 20242) { find(JTextFieldFixture.class, byXpath(XPathDefinitions.GET_SET_MODULE_NAME_2024_2_AND_NEWER)).setText(moduleName); } - else if (UITestRunner.getIdeaVersionInt() >= 20221) { + else if (ideaVersionInt >= 20221) { find(JTextFieldFixture.class, byXpath(XPathDefinitions.GET_SET_MODULE_NAME)).setText(moduleName); } else { textField("Module name:", true).setText(moduleName); @@ -102,7 +105,7 @@ else if (UITestRunner.getIdeaVersionInt() >= 20221) { * @return location of the content root currently inserted in the input field */ public String getContentRoot() { - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { return find(JTextFieldFixture.class, byXpath(XPathDefinitions.GET_SET_CONTENT_ROOT)).getText(); } else { return textField("Content root:", true).getText(); @@ -115,7 +118,7 @@ public String getContentRoot() { * @param contentRoot location of the content root that will be set into the input field */ public void setContentRoot(String contentRoot) { - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { find(JTextFieldFixture.class, byXpath(XPathDefinitions.GET_SET_CONTENT_ROOT)).setText(contentRoot); } else { textField("Content root:", true).setText(contentRoot); @@ -128,7 +131,7 @@ public void setContentRoot(String contentRoot) { * @return location of the module file currently inserted in the input field */ public String getModuleFileLocation() { - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { return find(JTextFieldFixture.class, byXpath(XPathDefinitions.GET_SET_MODULE_FILE_LOCATION)).getText(); } else { return textField("Module file location:", true).getText(); @@ -141,7 +144,7 @@ public String getModuleFileLocation() { * @param moduleFileLocation location of the module file that will be set into the input field */ public void setModuleFileLocation(String moduleFileLocation) { - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { find(JTextFieldFixture.class, byXpath(XPathDefinitions.GET_SET_MODULE_FILE_LOCATION)).setText(moduleFileLocation); } else { textField("Module file location:", true).setText(moduleFileLocation); diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/NewProjectFirstPage.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/NewProjectFirstPage.java index 14023e04..6f9cfad8 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/NewProjectFirstPage.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/NewProjectFirstPage.java @@ -48,12 +48,11 @@ public class NewProjectFirstPage extends AbstractNewProjectFinalPage { protected final RemoteRobot remoteRobot; private boolean isProjectSdkItemsLoaded = false; - private final int ideaVersion; + private final int ideaVersionInt = UITestRunner.getIdeaVersionInt(); public NewProjectFirstPage(@NotNull RemoteRobot remoteRobot, @NotNull RemoteComponent remoteComponent) { super(remoteRobot, remoteComponent); this.remoteRobot = remoteRobot; - this.ideaVersion = UITestRunner.getIdeaVersion().toInt(); } /** @@ -85,7 +84,7 @@ public JTextFieldFixture getProjectNameTextField() { * @param language project language */ public void setLanguage(String language) { - if (ideaVersion >= 20241) { + if (ideaVersionInt >= 20241) { JListFixture jListFixture = remoteRobot.find(JListFixture.class, byXpath(XPathDefinitions.JBLIST)); jListFixture.clickItem(language, false); } else { @@ -99,7 +98,7 @@ public void setLanguage(String language) { * @param buildSystem build system type */ public void setBuildSystem(String buildSystem) { - if (ideaVersion >= 20241) { + if (ideaVersionInt >= 20241) { find(JLabelFixture.class, byXpath(XPathDefinitions.SET_BUILD_SYSTEM_2024_2_AND_NEWER)).findText(buildSystem).click(); } else { find(JLabelFixture.class, byXpath(XPathDefinitions.SET_BUILD_SYSTEM)).findText(buildSystem).click(); @@ -112,7 +111,7 @@ public void setBuildSystem(String buildSystem) { * @return JdkComboBox fixture */ public ComboBoxFixture getProjectJdkComboBox() { - if (ideaVersion >= 20241) { + if (ideaVersionInt >= 20241) { return comboBox(byXpath(XPathDefinitions.JDK_COMBOBOX_PROJECT_WIZARD), Duration.ofSeconds(10)); } return comboBox(byXpath(XPathDefinitions.JDK_COMBOBOX), Duration.ofSeconds(10)); @@ -140,7 +139,7 @@ public void setProjectSdkIfAvailable(String targetSdkName) { return; } - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { projectJdkComboBox.click(); boolean popupOpenedPermanently = false; try { diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/MainIdeWindow.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/MainIdeWindow.java index 6762f2ac..8728dc34 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/MainIdeWindow.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/MainIdeWindow.java @@ -12,6 +12,7 @@ import com.intellij.remoterobot.RemoteRobot; import com.intellij.remoterobot.data.RemoteComponent; +import com.intellij.remoterobot.fixtures.ActionButtonFixture; import com.intellij.remoterobot.fixtures.CommonContainerFixture; import com.intellij.remoterobot.fixtures.DefaultXpath; import com.intellij.remoterobot.fixtures.FixtureName; @@ -28,6 +29,8 @@ import com.redhat.devtools.intellij.commonuitest.utils.internalerror.IdeInternalErrorUtils; +import static com.intellij.remoterobot.search.locators.Locators.byXpath; + /** * Main IDE window fixture * @@ -97,7 +100,8 @@ public void invokeCmdUsingSearchEverywherePopup(String cmdToInvoke) { private SearchEverywherePopup openSearchEverywherePopup() { try { - SearchEverywherePopup searchEverywherePopup = find(SearchEverywherePopup.class, Duration.ofSeconds(10)); + find(ActionButtonFixture.class, byXpath("//div[@myicon='search.svg']"), Duration.ofSeconds(5)).click(); + SearchEverywherePopup searchEverywherePopup = find(SearchEverywherePopup.class, Duration.ofSeconds(5)); searchEverywherePopup.activateTab("All"); return searchEverywherePopup; } catch (WaitForConditionTimeoutException e) { diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/menubar/MenuBar.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/menubar/MenuBar.java index e219b53a..c8603c5a 100755 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/menubar/MenuBar.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/menubar/MenuBar.java @@ -17,7 +17,6 @@ import com.intellij.remoterobot.fixtures.JPopupMenuFixture; import com.redhat.devtools.intellij.commonuitest.UITestRunner; import com.redhat.devtools.intellij.commonuitest.utils.constants.XPathDefinitions; -import com.redhat.devtools.intellij.commonuitest.utils.runner.IntelliJVersion; import java.time.Duration; import java.util.List; @@ -32,11 +31,10 @@ */ public class MenuBar { private final RemoteRobot remoteRobot; - private final IntelliJVersion ideaVersion; + private final int ideaVersionInt = UITestRunner.getIdeaVersionInt(); public MenuBar(RemoteRobot remoteRobot) { this.remoteRobot = remoteRobot; - this.ideaVersion = UITestRunner.getIdeaVersion(); } /** @@ -48,13 +46,13 @@ public void navigateTo(String... path) { if (path.length == 0) { return; } - if (UITestRunner.getIdeaVersionInt() >= 20242) { + if (ideaVersionInt >= 20242) { remoteRobot.find(ActionButtonFixture.class, byXpath(XPathDefinitions.MAIN_MENU)).click(); } JButtonFixture mainMenuFirstItem = mainMenuItem(path[0]); if (mainMenuFirstItem != null) { - if (UITestRunner.getIdeaVersionInt() >= 20242) { + if (ideaVersionInt >= 20242) { mainMenuFirstItem.moveMouse(); } else { mainMenuFirstItem.click(); @@ -87,13 +85,13 @@ private JButtonFixture mainMenuItem(String label) { } CommonContainerFixture cf; - if (remoteRobot.isLinux()) { + if (remoteRobot.isLinux() && ideaVersionInt <= 20242) { cf = remoteRobot.find(CommonContainerFixture.class, byXpath(XPathDefinitions.LINUX_MAIN_MENU), Duration.ofSeconds(10)); - } else if (remoteRobot.isWin() && ideaVersion.toInt() >= 20241) { + } else if ((remoteRobot.isWin() && ideaVersionInt >= 20241) || (remoteRobot.isLinux() && ideaVersionInt > 20242)) { cf = remoteRobot.find(CommonContainerFixture.class, byXpath(XPathDefinitions.WINDOWS_MAIN_MENU_2024_1_AND_NEWER), Duration.ofSeconds(10)); - } else if (remoteRobot.isWin() && ideaVersion.toInt() >= 20222) { + } else if (remoteRobot.isWin() && ideaVersionInt >= 20222) { cf = remoteRobot.find(CommonContainerFixture.class, byXpath(XPathDefinitions.WINDOWS_MAIN_MENU_2022_2_TO_2023_2), Duration.ofSeconds(10)); - } else if (remoteRobot.isWin() && ideaVersion.toInt() >= 20203) { + } else if (remoteRobot.isWin() && ideaVersionInt >= 20203) { cf = remoteRobot.find(CommonContainerFixture.class, byXpath(XPathDefinitions.WINDOWS_MAIN_MENU_2020_3_TO_2022_1), Duration.ofSeconds(10)); } else { cf = remoteRobot.find(CommonContainerFixture.class, byXpath(XPathDefinitions.WINDOWS_MAIN_MENU_2020_2_AND_OLDER), Duration.ofSeconds(10)); diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/AbstractToolWinPane.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/AbstractToolWinPane.java index 967dfeee..09b19fb8 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/AbstractToolWinPane.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/AbstractToolWinPane.java @@ -35,6 +35,7 @@ */ public abstract class AbstractToolWinPane extends CommonContainerFixture { private final RemoteRobot remoteRobot; + private final int ideaVersionInt = UITestRunner.getIdeaVersionInt(); protected AbstractToolWinPane(@NotNull RemoteRobot remoteRobot, @NotNull RemoteComponent remoteComponent) { super(remoteRobot, remoteComponent); @@ -93,7 +94,7 @@ public void closeGradleBuildToolPane() { public JButtonFixture stripeButton(String label, boolean isPaneOpened) { if (isPaneOpened) { if (label.equals(ButtonLabels.MAVEN_STRIPE_BUTTON_LABEL) || label.equals(ButtonLabels.GRADLE_STRIPE_BUTTON_LABEL)) { - if (UITestRunner.getIdeaVersionInt() >= 20223) { // Code for IntelliJ version 2022.3 and newer + if (ideaVersionInt >= 20223) { // Code for IntelliJ version 2022.3 and newer return button(byXpath(XPathDefinitions.toolWindowButton(label)), Duration.ofSeconds(2)); } else { // Code for IntelliJ versions 2022.2 and older return button(byXpath(XPathDefinitions.toolWindowSvg(label)), Duration.ofSeconds(2)); @@ -126,7 +127,7 @@ private void clickOnStripeButton(String label, boolean isPaneOpened) { "The '" + label + "' stripe button is not available.", () -> isStripeButtonAvailable(label, isPaneOpened)); - if (UITestRunner.getIdeaVersionInt() >= 20242) { + if (ideaVersionInt >= 20242) { // For IntelliJ IDEA 2024.2 and newer if (isRightToolbarButton(label)) { ToolWindowRightToolbar toolWindowRightToolbar = remoteRobot.find(ToolWindowRightToolbar.class, Duration.ofSeconds(10)); @@ -135,7 +136,7 @@ private void clickOnStripeButton(String label, boolean isPaneOpened) { ToolWindowLeftToolbar toolWindowLeftToolbar = remoteRobot.find(ToolWindowLeftToolbar.class, Duration.ofSeconds(10)); toolWindowLeftToolbar.clickStripeButton(label); } - } else if (UITestRunner.getIdeaVersionInt() >= 20221) { + } else if (ideaVersionInt >= 20221) { // For IntelliJ IDEA 2022.1 to 2024.1 ToolWindowPane toolWindowPane = remoteRobot.find(ToolWindowPane.class, Duration.ofSeconds(10)); toolWindowPane.stripeButton(label, isPaneOpened).click(); @@ -148,7 +149,7 @@ private void clickOnStripeButton(String label, boolean isPaneOpened) { private boolean isStripeButtonAvailable(String label, boolean isPaneOpened) { try { - if (UITestRunner.getIdeaVersionInt() >= 20242) { + if (ideaVersionInt >= 20242) { // For IntelliJ IDEA 2024.2 and newer if (isRightToolbarButton(label)) { ToolWindowRightToolbar toolWindowRightToolbar = remoteRobot.find(ToolWindowRightToolbar.class, Duration.ofSeconds(2)); @@ -157,7 +158,7 @@ private boolean isStripeButtonAvailable(String label, boolean isPaneOpened) { ToolWindowLeftToolbar toolWindowLeftToolbar = remoteRobot.find(ToolWindowLeftToolbar.class, Duration.ofSeconds(2)); toolWindowLeftToolbar.findStripeButton(label); } - } else if (UITestRunner.getIdeaVersionInt() >= 20221) { + } else if (ideaVersionInt >= 20221) { // For IntelliJ IDEA 2022.1 to 2024.1 ToolWindowPane toolWindowPane = remoteRobot.find(ToolWindowPane.class, Duration.ofSeconds(2)); toolWindowPane.stripeButton(label, isPaneOpened); diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/ProjectExplorer.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/ProjectExplorer.java index 8933763a..528b2274 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/ProjectExplorer.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/ProjectExplorer.java @@ -36,6 +36,7 @@ @FixtureName(name = "Tool Windows Pane") public class ProjectExplorer extends CommonContainerFixture { private final RemoteRobot remoteRobot; + private final int ideaVersionInt = UITestRunner.getIdeaVersionInt(); public ProjectExplorer(@NotNull RemoteRobot remoteRobot, @NotNull RemoteComponent remoteComponent) { super(remoteRobot, remoteComponent); @@ -109,7 +110,7 @@ public void selectOpenedFile() { */ public void expandAll() { projectViewTree().moveMouse(); - if (UITestRunner.getIdeaVersionInt() >= 20242) { + if (ideaVersionInt >= 20242) { actionButton(byXpath(XPathDefinitions.MY_ICON_EXPAND_ALL_2024_2), Duration.ofSeconds(5)).click(); } else { actionButton(byXpath(XPathDefinitions.MY_ICON_EXPAND_ALL), Duration.ofSeconds(5)).click(); @@ -121,7 +122,7 @@ public void expandAll() { */ public void collapseAll() { projectViewTree().moveMouse(); - if (UITestRunner.getIdeaVersionInt() >= 20242) { + if (ideaVersionInt >= 20242) { actionButton(byXpath(XPathDefinitions.MY_ICON_COLLAPSE_ALL_2024_2), Duration.ofSeconds(5)).click(); } else { actionButton(byXpath(XPathDefinitions.MY_ICON_COLLAPSE_ALL), Duration.ofSeconds(5)).click(); @@ -135,7 +136,7 @@ public void collapseAll() { */ public JPopupMenuFixture openSettingsPopup() { projectViewTree().moveMouse(); - if (UITestRunner.getIdeaVersionInt() >= 20242) { + if (ideaVersionInt >= 20242) { actionButton(byXpath(XPathDefinitions.MY_ICON_MORE_VERTICAL), Duration.ofSeconds(5)).click(); } else { actionButton(byXpath(XPathDefinitions.MY_ICON_GEAR_PLAIN), Duration.ofSeconds(5)).click(); diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/buildtoolpane/GradleBuildToolPane.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/buildtoolpane/GradleBuildToolPane.java index 02a6b802..6386074b 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/buildtoolpane/GradleBuildToolPane.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/buildtoolpane/GradleBuildToolPane.java @@ -40,6 +40,7 @@ @FixtureName(name = "Tool Windows Pane") public class GradleBuildToolPane extends CommonContainerFixture { private final RemoteRobot remoteRobot; + private final int ideaVersionInt = UITestRunner.getIdeaVersionInt(); public GradleBuildToolPane(@NotNull RemoteRobot remoteRobot, @NotNull RemoteComponent remoteComponent) { super(remoteRobot, remoteComponent); @@ -58,7 +59,7 @@ public void reloadAllGradleProjects() { * Expand all */ public void expandAll() { - if (UITestRunner.getIdeaVersionInt() >= 20242) { // Code for IntelliJ version 2024.2 and newer + if (ideaVersionInt >= 20242) { // Code for IntelliJ version 2024.2 and newer actionButton(byXpath(XPathDefinitions.MY_ICON_EXPAND_ALL_2024_2), Duration.ofSeconds(2)).click(); } else { // Code for IntelliJ version 2024.1 and older actionButton(byXpath(XPathDefinitions.MY_ICON_EXPAND_ALL_IDE), Duration.ofSeconds(2)).click(); @@ -69,7 +70,7 @@ public void expandAll() { * Collapse all */ public void collapseAll() { - if (UITestRunner.getIdeaVersionInt() >= 20242) { // Code for IntelliJ version 2024.2 and newer + if (ideaVersionInt >= 20242) { // Code for IntelliJ version 2024.2 and newer actionButton(byXpath(XPathDefinitions.MY_ICON_COLLAPSE_ALL_2024_2), Duration.ofSeconds(2)).click(); } else { // Code for IntelliJ version 2024.1 and older actionButton(byXpath(XPathDefinitions.MY_ICON_COLLAPSE_ALL_IDE), Duration.ofSeconds(2)).click(); @@ -81,16 +82,9 @@ public void collapseAll() { */ public void buildProject() { waitFor(Duration.ofSeconds(30), Duration.ofSeconds(2), "The Gradle tasks tree did not appear in 30 seconds.", this::isGradleTreeVisible); - - // ISSUE #199 - https://github.com/JetBrains/intellij-ui-test-robot/issues/199 - if (remoteRobot.isMac()) { - expandAll(); - } else { - gradleTaskTree().expandAll(); - } - - gradleTaskTree().findAllText("build").get(1).doubleClick(); - if (UITestRunner.getIdeaVersionInt() >= 20221) { + expandAll(); + gradleTaskTree().doubleClickPath(new String[]{"Tasks", "build", "build"}, true); + if (ideaVersionInt >= 20221) { remoteRobot.find(ToolWindowPane.class).find(BuildView.class).waitUntilBuildHasFinished(); } else { remoteRobot.find(ToolWindowsPane.class).find(BuildView.class).waitUntilBuildHasFinished(); diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/buildtoolpane/MavenBuildToolPane.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/buildtoolpane/MavenBuildToolPane.java index 5c16c16b..f8b269f6 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/buildtoolpane/MavenBuildToolPane.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/buildtoolpane/MavenBuildToolPane.java @@ -40,6 +40,7 @@ @FixtureName(name = "Tool Windows Pane") public class MavenBuildToolPane extends CommonContainerFixture { private final RemoteRobot remoteRobot; + private final int ideaVersionInt = UITestRunner.getIdeaVersionInt(); public MavenBuildToolPane(@NotNull RemoteRobot remoteRobot, @NotNull RemoteComponent remoteComponent) { super(remoteRobot, remoteComponent); @@ -57,7 +58,7 @@ public void reloadAllMavenProjects() { * Collapse all */ public void collapseAll() { - if (UITestRunner.getIdeaVersionInt() >= 20242) { + if (ideaVersionInt >= 20242) { actionButton(byXpath(XPathDefinitions.MY_ICON_COLLAPSE_ALL_2024_2), Duration.ofSeconds(2)).click(); } else { actionButton(byXpath(XPathDefinitions.MY_ICON_COLLAPSE_ALL_FOR), Duration.ofSeconds(2)).click(); @@ -67,18 +68,21 @@ public void collapseAll() { /** * Build the project * - * @param lifecycle name of the lifecycle you want to invoke (clean, validate, compile, test, package, verify, install, site, deploy) + * @param goal name of the Lifecycle goal you want to invoke (clean, validate, compile, test, package, verify, install, site, deploy) */ - public void buildProject(String lifecycle) { + public void buildProject(String goal) { waitFor(Duration.ofSeconds(30), Duration.ofSeconds(2), "The Maven target tree did not appear in 30 seconds.", this::isMavenTreeVisible); - mavenTargetTree().expandAll(); - mavenTargetTree().findAllText(lifecycle).get(0).doubleClick(); - if (UITestRunner.getIdeaVersionInt() >= 20221) { + JTreeFixture tree = mavenTargetTree(); + // below workaround due to https://github.com/JetBrains/intellij-ui-test-robot/issues/459 + tree.doubleClickRow(0); // expand root + tree.doubleClickRowWithText("Lifecycle" ,true); // expand Lifecycle + tree.doubleClickRowWithText(goal,true); + if (ideaVersionInt >= 20221) { remoteRobot.find(ToolWindowPane.class).find(BuildView.class).waitUntilBuildHasFinished(); } else { remoteRobot.find(ToolWindowsPane.class).find(BuildView.class).waitUntilBuildHasFinished(); } - remoteRobot.find(IdeStatusBar.class, Duration.ofSeconds(10)).waitUntilAllBgTasksFinish(); + remoteRobot.find(IdeStatusBar.class, Duration.ofSeconds(30)).waitUntilAllBgTasksFinish(); } /** diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/utils/project/CreateCloseUtils.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/utils/project/CreateCloseUtils.java index ed99fcad..357c9f8a 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/utils/project/CreateCloseUtils.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/utils/project/CreateCloseUtils.java @@ -50,7 +50,9 @@ public static void createNewProject(RemoteRobot remoteRobot, String projectName, NewProjectDialogWizard newProjectDialogWizard = openNewProjectDialogFromWelcomeDialog(remoteRobot); NewProjectFirstPage newProjectFirstPage = newProjectDialogWizard.find(NewProjectFirstPage.class, Duration.ofSeconds(10)); - if (UITestRunner.getIdeaVersionInt() >= 20221) { + final int ideaVersionInt = UITestRunner.getIdeaVersionInt(); + + if (ideaVersionInt >= 20221) { newProjectFirstPage.selectNewProjectType("New Project"); newProjectFirstPage.setLanguage("Java"); switch (newProjectType) { @@ -70,9 +72,8 @@ public static void createNewProject(RemoteRobot remoteRobot, String projectName, newProjectFirstPage.setProjectSdkIfAvailable("17"); - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { newProjectFirstPage.getProjectNameTextField().click(); // Click to gain focus on newProjectFirstPage - newProjectFirstPage.setProjectName(projectName); newProjectFirstPage.setProjectLocation(ProjectLocation.PROJECT_LOCATION); } else { @@ -185,7 +186,7 @@ public static AbstractNewProjectFinalPage getFinalPage(NewProjectDialogWizard ne * @param remoteRobot reference to the RemoteRobot instance */ private static void ensureEmptyProjectPageIsOpened(NewProjectFirstPage newProjectFirstPage, RemoteRobot remoteRobot) { - int ideaVersionInt = UITestRunner.getIdeaVersionInt(); + final int ideaVersionInt = UITestRunner.getIdeaVersionInt(); boolean isEmptyProjectPageDisplayed; if (ideaVersionInt >= 20231) { // For IntelliJ IDEA version 2023.1 and newer diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/utils/steps/SharedSteps.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/utils/steps/SharedSteps.java index f2259673..31cbabea 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/utils/steps/SharedSteps.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/utils/steps/SharedSteps.java @@ -28,11 +28,11 @@ private SharedSteps() {} * * @param robot The RemoteRobot instance for interaction with the IntelliJ IDEA UI. * @param duration The maximum time to wait for the component to become visible, in seconds. - * @param interval The interval at which to check the component's visibility, in seconds. + * @param interval The interval at which to check the component's visibility, in milliseconds. * @param xpath The XPath locator used to find the component within the UI hierarchy. */ public static void waitForComponentByXpath(RemoteRobot robot, int duration, int interval , Locator xpath) { - waitFor(Duration.ofSeconds(duration), Duration.ofSeconds(interval), () -> robot.findAll(ComponentFixture.class, xpath) + waitFor(Duration.ofSeconds(duration), Duration.ofMillis(interval), () -> robot.findAll(ComponentFixture.class, xpath) .stream() .anyMatch(ComponentFixture::isShowing)); } diff --git a/src/test-project/gradle.properties b/src/test-project/gradle.properties index 81b5009b..be2b716d 100644 --- a/src/test-project/gradle.properties +++ b/src/test-project/gradle.properties @@ -1 +1 @@ -ideaVersion=2024.2 +ideaVersion=2024.3 diff --git a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/dialogs/information/CodeWithMeDialogTest.java b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/dialogs/information/CodeWithMeDialogTest.java index 5528b0e7..96ac0268 100644 --- a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/dialogs/information/CodeWithMeDialogTest.java +++ b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/dialogs/information/CodeWithMeDialogTest.java @@ -11,7 +11,6 @@ package com.redhat.devtools.intellij.commonuitest.fixtures.test.dialogs.information; import com.redhat.devtools.intellij.commonuitest.AbstractLibraryBaseTest; -import com.redhat.devtools.intellij.commonuitest.UITestRunner; import com.redhat.devtools.intellij.commonuitest.fixtures.dialogs.information.CodeWithMeDialog; import com.redhat.devtools.intellij.commonuitest.fixtures.dialogs.project.NewProjectDialogWizard; import com.redhat.devtools.intellij.commonuitest.fixtures.dialogs.project.pages.AbstractNewProjectFinalPage; @@ -44,7 +43,7 @@ static void prepareProject() { NewProjectDialogWizard newProjectDialogWizard = openNewProjectDialogFromWelcomeDialog(remoteRobot); NewProjectFirstPage newProjectFirstPage = newProjectDialogWizard.find(NewProjectFirstPage.class, Duration.ofSeconds(10)); - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { newProjectFirstPage.selectNewProjectType("New Project"); newProjectFirstPage.getProjectNameTextField().click(); // Click to gain focus on newProjectFirstPage newProjectFirstPage.setProjectName(PROJECT_NAME); diff --git a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/dialogs/project_manipulation/NewProjectDialogTest.java b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/dialogs/project_manipulation/NewProjectDialogTest.java index 78ae2990..6d95a714 100644 --- a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/dialogs/project_manipulation/NewProjectDialogTest.java +++ b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/dialogs/project_manipulation/NewProjectDialogTest.java @@ -57,6 +57,7 @@ class NewProjectDialogTest extends AbstractLibraryBaseTest { private static final String ADVANCED_SETTINGS_SHOULD_BE_OPENED_MSG = "The 'Advanced Settings' section should be opened but is not"; private static final String ADVANCED_SETTINGS_SHOULD_BE_CLOSED_MSG = "The 'Advanced Settings' section should be closed but is not"; private static final String BUT_IS = "but is"; + private final int ideaVersionInt = UITestRunner.getIdeaVersionInt(); private NewProjectDialogWizard newProjectDialogWizard; private NewProjectFirstPage newProjectFirstPage; @@ -159,7 +160,7 @@ void closeAdvancedSettingsTest() { void getSetModuleNameTest() { navigateToSetProjectNamePage(CreateCloseUtils.NewProjectType.PLAIN_JAVA); JavaNewProjectFinalPage javaFinalPage = newProjectDialogWizard.find(JavaNewProjectFinalPage.class, Duration.ofSeconds(10)); - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { javaFinalPage.openAdvanceSettings(); } else { javaFinalPage.openMoreSettings(); @@ -176,7 +177,7 @@ void getSetModuleNameTest() { void getSetContentRootTest() { navigateToSetProjectNamePage(CreateCloseUtils.NewProjectType.PLAIN_JAVA); JavaNewProjectFinalPage javaFinalPage = newProjectDialogWizard.find(JavaNewProjectFinalPage.class, Duration.ofSeconds(10)); - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { javaFinalPage.openAdvanceSettings(); } else { javaFinalPage.openMoreSettings(); @@ -193,7 +194,7 @@ void getSetContentRootTest() { void getSetModuleFileLocationTest() { navigateToSetProjectNamePage(CreateCloseUtils.NewProjectType.PLAIN_JAVA); JavaNewProjectFinalPage javaFinalPage = newProjectDialogWizard.find(JavaNewProjectFinalPage.class, Duration.ofSeconds(10)); - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { javaFinalPage.openAdvanceSettings(); } else { javaFinalPage.openMoreSettings(); @@ -309,7 +310,7 @@ void nextButtonTest() { @Test void finishButtonTest() { - if (UITestRunner.getIdeaVersionInt() < 20221) { + if (ideaVersionInt < 20221) { newProjectFirstPage.selectNewProjectType(CreateCloseUtils.NewProjectType.PLAIN_JAVA.toString()); newProjectFirstPage.setProjectSdkIfAvailable("17"); assertThrows(UITestException.class, () -> @@ -376,7 +377,7 @@ JListFixture.class, byXpath(XPathDefinitions.EMPTY_PROJECT) selectJavaNewProjectType(); boolean isProjectSDKLabelVisible; - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { isProjectSDKLabelVisible = !newProjectFirstPage.findAll(JLabelFixture.class, byXpath("//div[@text.key='label.project.wizard.new.project.jdk']")).isEmpty(); } else { isProjectSDKLabelVisible = !newProjectFirstPage.findAll(JLabelFixture.class, byXpath("//div[@text='Project SDK:']")).isEmpty(); @@ -386,7 +387,7 @@ JListFixture.class, byXpath(XPathDefinitions.EMPTY_PROJECT) private void selectJavaNewProjectType() { newProjectFirstPage = remoteRobot.find(NewProjectFirstPage.class, Duration.ofSeconds(10)); - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { newProjectFirstPage.selectNewProjectType("New Project"); } else { newProjectFirstPage.selectNewProjectType("Java"); @@ -413,7 +414,7 @@ void createEmptyProjectTest() { } private void navigateToSetProjectNamePage(CreateCloseUtils.NewProjectType newProjectType) { - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { newProjectFirstPage.setBuildSystem(newProjectType.toString().equals("Java") ? "IntelliJ" : newProjectType.toString()); return; } @@ -442,7 +443,7 @@ private void testProjectNameAndLocationInputField(CreateCloseUtils.NewProjectTyp } private void testOpenArtifactCoordinatesMavenGradle(CreateCloseUtils.NewProjectType newProjectType) { - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { return; } navigateToSetProjectNamePage(newProjectType); @@ -455,14 +456,14 @@ private void testOpenArtifactCoordinatesMavenGradle(CreateCloseUtils.NewProjectT } private void testArtifactCoordinatesAttributes(CreateCloseUtils.NewProjectType newProjectType, ArtifactCoordinatesAttributes attribute) { - if (UITestRunner.getIdeaVersionInt() >= 20221 && attribute == ArtifactCoordinatesAttributes.VERSION) { + if (ideaVersionInt >= 20221 && attribute == ArtifactCoordinatesAttributes.VERSION) { return; } navigateToSetProjectNamePage(newProjectType); MavenGradleNewProjectFinalPage mavenGradleFinalPage = newProjectDialogWizard.find(MavenGradleNewProjectFinalPage.class, Duration.ofSeconds(10)); - if (UITestRunner.getIdeaVersionInt() >= 20221) { + if (ideaVersionInt >= 20221) { mavenGradleFinalPage.openAdvanceSettings(); } else { mavenGradleFinalPage.openArtifactCoordinates(); diff --git a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/BuildViewTest.java b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/BuildViewTest.java index d0501824..f78052e0 100644 --- a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/BuildViewTest.java +++ b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/BuildViewTest.java @@ -43,8 +43,6 @@ static void prepareProject() { } else { toolWinPane = remoteRobot.find(ToolWindowsPane.class, Duration.ofSeconds(10)); } - toolWinPane.openMavenBuildToolPane(); - toolWinPane.find(MavenBuildToolPane.class, Duration.ofSeconds(10)).buildProject("verify"); } @AfterAll @@ -54,6 +52,8 @@ static void closeCurrentProject() { @Test void waitForSuccessfulBuildTest() { + toolWinPane.openMavenBuildToolPane(); + toolWinPane.find(MavenBuildToolPane.class, Duration.ofSeconds(10)).buildProject("verify"); BuildView buildView = toolWinPane.find(BuildView.class, Duration.ofSeconds(10)); buildView.waitUntilBuildHasFinished(); assertTrue(buildView.isBuildSuccessful(), "The build should be successful but is not."); diff --git a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/ProjectExplorerTest.java b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/ProjectExplorerTest.java index 49253e42..7c09f3f1 100644 --- a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/ProjectExplorerTest.java +++ b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/ProjectExplorerTest.java @@ -121,9 +121,9 @@ void selectOpenedFileTest() { projectExplorer.expandAll(); projectExplorer.openFile(PROJECT_NAME, "src", "Main"); projectExplorer.projectViewTree().clickRow(0); - SharedSteps.waitForComponentByXpath(remoteRobot, 3, 1, byXpath(XPathDefinitions.MY_ICON_LOCATE_SVG)); + SharedSteps.waitForComponentByXpath(remoteRobot, 3, 200, byXpath(XPathDefinitions.MY_ICON_LOCATE_SVG)); projectExplorer.selectOpenedFile(); - SharedSteps.waitForComponentByXpath(remoteRobot, 3, 1, byXpath(XPathDefinitions.MY_ICON_LOCATE_SVG)); + SharedSteps.waitForComponentByXpath(remoteRobot, 3, 200, byXpath(XPathDefinitions.MY_ICON_LOCATE_SVG)); assertTrue(projectExplorer.projectViewTree().isPathSelected( projectExplorer.projectViewTree().getValueAtRow(0), "src", "Main"), "The file 'Main' should be selected but is not." diff --git a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/buildtoolpane/GradleBuildToolPaneTest.java b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/buildtoolpane/GradleBuildToolPaneTest.java index 5bb573a1..45d37fa3 100644 --- a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/buildtoolpane/GradleBuildToolPaneTest.java +++ b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/buildtoolpane/GradleBuildToolPaneTest.java @@ -76,7 +76,7 @@ void expandAll() { @Test void collapseAll() { - gradleBuildToolPane.gradleTaskTree().expandAll(); + gradleBuildToolPane.expandAll(); int itemsCountBeforeCollapsing = gradleBuildToolPane.gradleTaskTree().collectRows().size(); gradleBuildToolPane.collapseAll(); int itemsCountAfterCollapsing = gradleBuildToolPane.gradleTaskTree().collectRows().size(); diff --git a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/buildtoolpane/MavenBuildToolPaneTest.java b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/buildtoolpane/MavenBuildToolPaneTest.java index 29e224d6..4734617f 100644 --- a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/buildtoolpane/MavenBuildToolPaneTest.java +++ b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/buildtoolpane/MavenBuildToolPaneTest.java @@ -10,6 +10,7 @@ ******************************************************************************/ package com.redhat.devtools.intellij.commonuitest.fixtures.test.mainidewindow.toolwindowspane.buildtoolpane; +import com.intellij.remoterobot.fixtures.JTreeFixture; import com.redhat.devtools.intellij.commonuitest.AbstractLibraryBaseTest; import com.redhat.devtools.intellij.commonuitest.UITestRunner; import com.redhat.devtools.intellij.commonuitest.fixtures.mainidewindow.toolwindowspane.AbstractToolWinPane; @@ -24,6 +25,7 @@ import java.time.Duration; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; /** @@ -67,10 +69,18 @@ void reloadAllMavenProjectsTest() { @Test void collapseAllTest() { - mavenBuildToolPane.mavenTargetTree().expandAll(); - int itemsCountBeforeCollapsing = mavenBuildToolPane.mavenTargetTree().collectRows().size(); + JTreeFixture tree = mavenBuildToolPane.mavenTargetTree(); + tree.doubleClickRow(0); // expand root + for (String row : tree.collectRows()) { + if (!row.equals(PROJECT_NAME)) { + tree.doubleClickRowWithText(row, true); // expand first children + } + } + int itemsCountBeforeCollapsing = tree.collectRows().size(); + assertTrue(itemsCountBeforeCollapsing > 1, "The Maven tree did not expand correctly"); mavenBuildToolPane.collapseAll(); - int itemsCountAfterCollapsing = mavenBuildToolPane.mavenTargetTree().collectRows().size(); + int itemsCountAfterCollapsing = tree.collectRows().size(); + assertEquals(1, itemsCountAfterCollapsing); assertTrue(itemsCountAfterCollapsing < itemsCountBeforeCollapsing, "The 'Collapse All' operation was unsuccessful."); } } \ No newline at end of file From 4adfd8e1f09ece34e16f79f4c53f7b1ba591d840 Mon Sep 17 00:00:00 2001 From: Stephane Bouchet Date: Wed, 9 Apr 2025 16:51:54 +0200 Subject: [PATCH 3/6] fix: fix failing tests Signed-off-by: Stephane Bouchet --- .../toolwindowspane/openclose/PEPaneAndStripeButtonTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/openclose/PEPaneAndStripeButtonTest.java b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/openclose/PEPaneAndStripeButtonTest.java index a39ab0f1..05047550 100644 --- a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/openclose/PEPaneAndStripeButtonTest.java +++ b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/mainidewindow/toolwindowspane/openclose/PEPaneAndStripeButtonTest.java @@ -60,7 +60,7 @@ void projectExplorerPaneOpenCloseTest() { } @Test - @DisabledIfSystemProperty(named = "uitestlib.idea.version", matches = "20242") + @DisabledIfSystemProperty(named = "uitestlib.idea.version", matches = "20242|20243") void stripeButtonTest() { try { toolWinPane.stripeButton(ButtonLabels.MAVEN_STRIPE_BUTTON_LABEL, false); From 2d6bc2557898ee03564c0e98e8c6868b723340bf Mon Sep 17 00:00:00 2001 From: Stephane Bouchet Date: Tue, 6 May 2025 18:19:59 +0200 Subject: [PATCH 4/6] chore: fixed dependency metadata. Signed-off-by: Stephane Bouchet --- gradle/verification-metadata.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 35fc66a1..b4673b4d 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -9,7 +9,7 @@ - + From 43602f60230a344337acd9ab94ad47d3f0c378bd Mon Sep 17 00:00:00 2001 From: Stephane Bouchet Date: Tue, 6 May 2025 18:25:02 +0200 Subject: [PATCH 5/6] chore: fixed dependency metadata. Signed-off-by: Stephane Bouchet --- HISTORY.md | 17 ++++++++++ gradle/verification-metadata.xml | 57 ++++++++++++++++++++------------ 2 files changed, 52 insertions(+), 22 deletions(-) create mode 100644 HISTORY.md diff --git a/HISTORY.md b/HISTORY.md new file mode 100644 index 00000000..d4eba706 --- /dev/null +++ b/HISTORY.md @@ -0,0 +1,17 @@ +### Changelog + +All notable changes to this project will be documented in this file. Dates are displayed in UTC. + +Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). + +#### [Unreleased](https://github.com/redhat-developer/intellij-common-ui-test-library/compare/v0.4.3...HEAD) + +- fix: fix failed tests screenshot comment [`#335`](https://github.com/redhat-developer/intellij-common-ui-test-library/pull/335) +- chore: fix sonar issues [`#333`](https://github.com/redhat-developer/intellij-common-ui-test-library/pull/333) +- Integration tests fix [`#332`](https://github.com/redhat-developer/intellij-common-ui-test-library/pull/332) +- Integration tests fix [`#331`](https://github.com/redhat-developer/intellij-common-ui-test-library/pull/331) +- chore: fix integration tests [`#327`](https://github.com/redhat-developer/intellij-common-ui-test-library/pull/327) +- chore: fix publishing [`#328`](https://github.com/redhat-developer/intellij-common-ui-test-library/pull/328) +- chore: bump version [`a94c6cd`](https://github.com/redhat-developer/intellij-common-ui-test-library/commit/a94c6cde6ac97645e6bfee99f1c8fe5a13fea185) +- chore(skip-release): Update sonar.yml [`191c03b`](https://github.com/redhat-developer/intellij-common-ui-test-library/commit/191c03be187a34ec5f51ba5bce91a30f6f8f4ff3) +- chore(skip-release): Update sonar.yml [`3e32f0f`](https://github.com/redhat-developer/intellij-common-ui-test-library/commit/3e32f0f997af0ca9acec36b823007df585b7dd36) diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index b4673b4d..e2d5c8b2 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -30,33 +30,33 @@ - - - + + + - - + + - - - + + + - - - + + + - - + + - - - + + + - - + + @@ -131,7 +131,7 @@ - + @@ -192,9 +192,22 @@ - - - + + + + + + + + + + + + + + + + From 352d35fd24ee6d7e7b21c4220d7f123cf60f4ed7 Mon Sep 17 00:00:00 2001 From: Stephane Bouchet Date: Tue, 6 May 2025 18:25:39 +0200 Subject: [PATCH 6/6] chore: fixed dependency metadata. Signed-off-by: Stephane Bouchet --- HISTORY.md | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 HISTORY.md diff --git a/HISTORY.md b/HISTORY.md deleted file mode 100644 index d4eba706..00000000 --- a/HISTORY.md +++ /dev/null @@ -1,17 +0,0 @@ -### Changelog - -All notable changes to this project will be documented in this file. Dates are displayed in UTC. - -Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - -#### [Unreleased](https://github.com/redhat-developer/intellij-common-ui-test-library/compare/v0.4.3...HEAD) - -- fix: fix failed tests screenshot comment [`#335`](https://github.com/redhat-developer/intellij-common-ui-test-library/pull/335) -- chore: fix sonar issues [`#333`](https://github.com/redhat-developer/intellij-common-ui-test-library/pull/333) -- Integration tests fix [`#332`](https://github.com/redhat-developer/intellij-common-ui-test-library/pull/332) -- Integration tests fix [`#331`](https://github.com/redhat-developer/intellij-common-ui-test-library/pull/331) -- chore: fix integration tests [`#327`](https://github.com/redhat-developer/intellij-common-ui-test-library/pull/327) -- chore: fix publishing [`#328`](https://github.com/redhat-developer/intellij-common-ui-test-library/pull/328) -- chore: bump version [`a94c6cd`](https://github.com/redhat-developer/intellij-common-ui-test-library/commit/a94c6cde6ac97645e6bfee99f1c8fe5a13fea185) -- chore(skip-release): Update sonar.yml [`191c03b`](https://github.com/redhat-developer/intellij-common-ui-test-library/commit/191c03be187a34ec5f51ba5bce91a30f6f8f4ff3) -- chore(skip-release): Update sonar.yml [`3e32f0f`](https://github.com/redhat-developer/intellij-common-ui-test-library/commit/3e32f0f997af0ca9acec36b823007df585b7dd36)