Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ tasks {

jacocoTestReport {
executionData.setFrom(fileTree(layout.buildDirectory).include("/jacoco/*.exec"))
//classDirectories.setFrom(instrumentCode)
reports {
xml.required = true
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand All @@ -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
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand All @@ -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));
Expand All @@ -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);
Expand All @@ -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<JPopupMenuFixture> 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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();
Expand All @@ -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);
Expand All @@ -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();
Expand All @@ -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);
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -120,7 +123,7 @@ public void closeAdvanceSettings() {
private boolean isAdvancedSettingsOpened() {
List<ComponentFixture> 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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
Expand All @@ -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);
Expand All @@ -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();
Expand All @@ -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);
Expand All @@ -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();
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down Expand Up @@ -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 {
Expand All @@ -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();
Expand All @@ -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));
Expand Down Expand Up @@ -140,7 +139,7 @@ public void setProjectSdkIfAvailable(String targetSdkName) {
return;
}

if (UITestRunner.getIdeaVersionInt() >= 20221) {
if (ideaVersionInt >= 20221) {
projectJdkComboBox.click();
boolean popupOpenedPermanently = false;
try {
Expand Down
Loading
Loading