Skip to content

Commit c9d89aa

Browse files
authored
fix: Update library for IJ 2023.2 (#200)
* chore: updated IntelliJVersion.java, test-project gradle version fix: added junit platform dependency to test-project to run tests chore: Update org.jetbrains.intellij to 1.17.0 chore: Update gradle to 7.6-all feat: Switch testing version to IC-2023.2 Authored-by: Richard Kocian <[email protected]> Signed-off-by: Martin Szuc <[email protected]> * fix: open tip dialog for IJ 2022.1+ also added SharedSteps class with waitForComponentByXpath Signed-off-by: Martin Szuc <[email protected]> * fix: clearWorkspace changes: Remove the projects on disk first, then try to remove them from flatWelcomeFrame's recent projects for better stability. added: click a Remove from project button for IJ versions 2023+ Signed-off-by: Martin Szuc <[email protected]> * fix: OpenFileTest correctly verifies opened file for IJ 2023.2 Signed-off-by: Martin Szuc <[email protected]> * fix: isBuildSuccessful more robust in BuildView.java Gradle and Maven builds have different outputs in console in BuildView. Signed-off-by: Martin Szuc <[email protected]> * fix: selectNewProjectTypeTest correctly verifies isEmptyProjectPageDisplayed chore: up java version for jdk selection in tests Signed-off-by: Martin Szuc <[email protected]> * fix: stripeButton for Maven/Gradle for IJ 2023.2+ Signed-off-by: Martin Szuc <[email protected]> * chore: update version to java 17 in GHA Signed-off-by: Martin Szuc <[email protected]> fix: Added java 11 to Windows GHA workflow fixes testing feature to change sdk version when creating project Signed-off-by: Martin Szuc <[email protected]> * fix: waits for FlatWelcomeFrame and selectOpenedFileTest stabilizing the test Signed-off-by: Martin Szuc <[email protected]> --------- Signed-off-by: Martin Szuc <[email protected]>
1 parent 554f157 commit c9d89aa

File tree

20 files changed

+154
-76
lines changed

20 files changed

+154
-76
lines changed

.github/workflows/dialogs.information_settings.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@v2
18-
- name: Set up JDK 11
18+
- name: Set up JDK 17
1919
uses: actions/setup-java@v1
2020
with:
21-
java-version: 11
21+
java-version: 17
2222
- name: Run integration tests
2323
run: |
2424
export DISPLAY=:99.0
@@ -50,10 +50,10 @@ jobs:
5050

5151
steps:
5252
- uses: actions/checkout@v2
53-
- name: Set up JDK 11
53+
- name: Set up JDK 17
5454
uses: actions/setup-java@v1
5555
with:
56-
java-version: 11
56+
java-version: 17
5757
- name: Run integration tests
5858
run: |
5959
cd src/test-project
@@ -83,10 +83,10 @@ jobs:
8383

8484
steps:
8585
- uses: actions/checkout@v2
86-
- name: Set up JDK 11
86+
- name: Set up JDK 17
8787
uses: actions/setup-java@v1
8888
with:
89-
java-version: 11
89+
java-version: 17
9090
- name: Run integration tests
9191
run: |
9292
cd src\test-project

.github/workflows/dialogs.project_manipulation.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@v2
18-
- name: Set up JDK 11
18+
- name: Set up JDK 17
1919
uses: actions/setup-java@v1
2020
with:
21-
java-version: 11
21+
java-version: 17
2222
- name: Run integration tests
2323
run: |
2424
export DISPLAY=:99.0
@@ -50,10 +50,10 @@ jobs:
5050

5151
steps:
5252
- uses: actions/checkout@v2
53-
- name: Set up JDK 11
53+
- name: Set up JDK 17
5454
uses: actions/setup-java@v1
5555
with:
56-
java-version: 11
56+
java-version: 17
5757
- name: Run integration tests
5858
run: |
5959
cd src/test-project
@@ -87,6 +87,10 @@ jobs:
8787
uses: actions/setup-java@v1
8888
with:
8989
java-version: 11
90+
- name: Set up JDK 17
91+
uses: actions/setup-java@v1
92+
with:
93+
java-version: 17
9094
- name: Run integration tests
9195
run: |
9296
cd src\test-project

.github/workflows/dialogs.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@v2
18-
- name: Set up JDK 11
18+
- name: Set up JDK 17
1919
uses: actions/setup-java@v1
2020
with:
21-
java-version: 11
21+
java-version: 17
2222
- name: Run integration tests
2323
run: |
2424
export DISPLAY=:99.0
@@ -50,10 +50,10 @@ jobs:
5050

5151
steps:
5252
- uses: actions/checkout@v2
53-
- name: Set up JDK 11
53+
- name: Set up JDK 17
5454
uses: actions/setup-java@v1
5555
with:
56-
java-version: 11
56+
java-version: 17
5757
- name: Run integration tests
5858
run: |
5959
cd src/test-project
@@ -83,10 +83,10 @@ jobs:
8383

8484
steps:
8585
- uses: actions/checkout@v2
86-
- name: Set up JDK 11
86+
- name: Set up JDK 17
8787
uses: actions/setup-java@v1
8888
with:
89-
java-version: 11
89+
java-version: 17
9090
- name: Run integration tests
9191
run: |
9292
cd src\test-project

.github/workflows/mainidewindow.idestatusbar_screenshot.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ jobs:
3131

3232
steps:
3333
- uses: actions/checkout@v2
34-
- name: Set up JDK 11
34+
- name: Set up JDK 17
3535
uses: actions/setup-java@v1
3636
with:
37-
java-version: 11
37+
java-version: 17
3838
- name: Run integration tests
3939
run: |
4040
export DISPLAY=:99.0
@@ -66,10 +66,10 @@ jobs:
6666

6767
steps:
6868
- uses: actions/checkout@v2
69-
- name: Set up JDK 11
69+
- name: Set up JDK 17
7070
uses: actions/setup-java@v1
7171
with:
72-
java-version: 11
72+
java-version: 17
7373
- name: Run integration tests
7474
run: |
7575
cd src/test-project
@@ -99,10 +99,10 @@ jobs:
9999

100100
steps:
101101
- uses: actions/checkout@v2
102-
- name: Set up JDK 11
102+
- name: Set up JDK 17
103103
uses: actions/setup-java@v1
104104
with:
105-
java-version: 11
105+
java-version: 17
106106
- name: Run integration tests
107107
run: |
108108
cd src\test-project

.github/workflows/mainidewindow.toolwindowspane.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@v2
18-
- name: Set up JDK 11
18+
- name: Set up JDK 17
1919
uses: actions/setup-java@v1
2020
with:
21-
java-version: 11
21+
java-version: 17
2222
- name: Run integration tests
2323
run: |
2424
export DISPLAY=:99.0
@@ -50,10 +50,10 @@ jobs:
5050

5151
steps:
5252
- uses: actions/checkout@v2
53-
- name: Set up JDK 11
53+
- name: Set up JDK 17
5454
uses: actions/setup-java@v1
5555
with:
56-
java-version: 11
56+
java-version: 17
5757
- name: Run integration tests
5858
run: |
5959
cd src/test-project
@@ -83,10 +83,10 @@ jobs:
8383

8484
steps:
8585
- uses: actions/checkout@v2
86-
- name: Set up JDK 11
86+
- name: Set up JDK 17
8787
uses: actions/setup-java@v1
8888
with:
89-
java-version: 11
89+
java-version: 17
9090
- name: Run integration tests
9191
run: |
9292
cd src\test-project

.github/workflows/sonar.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
with:
1414
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
1515
ref: ${{github.event.workflow_run.head_sha}}
16-
- name: Set up JDK 11
16+
- name: Set up JDK 17
1717
uses: actions/setup-java@v1
1818
with:
19-
java-version: 11
19+
java-version: 17
2020
- name: Download artifacts
2121
uses: actions/[email protected]
2222
with:

src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/FlatWelcomeFrame.java

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,19 @@
1212

1313
import com.intellij.remoterobot.RemoteRobot;
1414
import com.intellij.remoterobot.data.RemoteComponent;
15-
import com.intellij.remoterobot.fixtures.CommonContainerFixture;
16-
import com.intellij.remoterobot.fixtures.ComponentFixture;
17-
import com.intellij.remoterobot.fixtures.ContainerFixture;
18-
import com.intellij.remoterobot.fixtures.DefaultXpath;
19-
import com.intellij.remoterobot.fixtures.FixtureName;
20-
import com.intellij.remoterobot.fixtures.HeavyWeightWindowFixture;
21-
import com.intellij.remoterobot.fixtures.JButtonFixture;
22-
import com.intellij.remoterobot.fixtures.JLabelFixture;
23-
import com.intellij.remoterobot.fixtures.JListFixture;
24-
import com.intellij.remoterobot.fixtures.JPopupMenuFixture;
25-
import com.intellij.remoterobot.fixtures.JTreeFixture;
15+
import com.intellij.remoterobot.fixtures.*;
2616
import com.intellij.remoterobot.utils.UtilsKt;
2717
import com.intellij.remoterobot.utils.WaitForConditionTimeoutException;
2818
import com.redhat.devtools.intellij.commonuitest.UITestRunner;
2919
import com.redhat.devtools.intellij.commonuitest.fixtures.dialogs.errors.IdeFatalErrorsDialog;
3020
import com.redhat.devtools.intellij.commonuitest.fixtures.dialogs.information.TipDialog;
3121
import com.redhat.devtools.intellij.commonuitest.fixtures.dialogs.settings.SettingsDialog;
3222
import com.redhat.devtools.intellij.commonuitest.fixtures.dialogs.settings.pages.NotificationsPage;
23+
import com.redhat.devtools.intellij.commonuitest.utils.constants.ButtonLabels;
3324
import com.redhat.devtools.intellij.commonuitest.utils.constants.XPathDefinitions;
3425
import com.redhat.devtools.intellij.commonuitest.utils.internalerror.IdeInternalErrorUtils;
3526
import com.redhat.devtools.intellij.commonuitest.utils.runner.IntelliJVersion;
27+
import com.redhat.devtools.intellij.commonuitest.utils.steps.SharedSteps;
3628
import org.apache.commons.io.FileUtils;
3729
import org.jetbrains.annotations.NotNull;
3830

@@ -96,10 +88,7 @@ public void clickOnLink(String label) {
9688
* Clear the workspace by deleting the content of the IdeaProjects folder and clearing all the projects' links in the 'Welcome to IntelliJ IDEA' dialog
9789
*/
9890
public void clearWorkspace() {
99-
for (int i = 0; i < projectsCount(); i++) {
100-
removeTopProjectFromRecentProjects();
101-
}
102-
91+
// Remove projects on disk
10392
try {
10493
String pathToDirToMakeEmpty = System.getProperty("user.home") + File.separator + "IdeaProjects";
10594
boolean doesProjectDirExists = Files.exists(Paths.get(pathToDirToMakeEmpty));
@@ -111,6 +100,10 @@ public void clearWorkspace() {
111100
} catch (IOException e) {
112101
LOGGER.log(Level.SEVERE, e.getMessage(), e);
113102
}
103+
// Remove projects from FlatWelcomeFrame's recent projects
104+
for (int i = 0; i < projectsCount(); i++) {
105+
removeTopProjectFromRecentProjects();
106+
}
114107
}
115108

116109
/**
@@ -156,23 +149,27 @@ public void openSettingsDialog() {
156149
* @return fixture for the 'Tip Of the Day' dialog
157150
*/
158151
public TipDialog openTipDialog() {
159-
if (ideaVersion <= 20202) {
152+
if (ideaVersion <= 20202) { // IJ 2020.2 and older
160153
clickOnLink("Get Help");
161154
HeavyWeightWindowFixture heavyWeightWindowFixture = find(HeavyWeightWindowFixture.class, Duration.ofSeconds(5));
162155
heavyWeightWindowFixture.findText(TIP_OF_THE_DAY).click();
163-
} else if (ideaVersion <= 20203) {
156+
} else if (ideaVersion == 20203) { // IJ 2020.3
164157
actionLink("Help").click();
165158
HeavyWeightWindowFixture heavyWeightWindowFixture = find(HeavyWeightWindowFixture.class, Duration.ofSeconds(5));
166159
heavyWeightWindowFixture.findText(TIP_OF_THE_DAY).click();
167-
} else if (ideaVersion <= 20212) {
160+
} else if (ideaVersion <= 20212) { // IJ 2021.1 - IJ 2021.2
168161
JListFixture jListFixture = remoteRobot.find(JListFixture.class, byXpath(XPathDefinitions.JBLIST));
169-
jListFixture.findText("Learn IntelliJ IDEA").click();
162+
jListFixture.findText(ButtonLabels.LEARN_LABEL).click();
170163
remoteRobot.find(JLabelFixture.class, byXpath(XPathDefinitions.TIP_DIALOG_2)).click();
171-
} else {
164+
} else { // IJ 2021.3 and newer
172165
IdeInternalErrorUtils.clearWindowsErrorsIfTheyAppear(remoteRobot);
173-
JTreeFixture jTreeFixture = remoteRobot.find(JTreeFixture.class, byXpath(XPathDefinitions.TREE));
174-
jTreeFixture.findText("Learn IntelliJ IDEA").click();
175-
FlatWelcomeFrame flatWelcomeFrame = remoteRobot.find(FlatWelcomeFrame.class);
166+
FlatWelcomeFrame flatWelcomeFrame = remoteRobot.find(FlatWelcomeFrame.class, Duration.ofSeconds(2));
167+
if (ideaVersion >= 20223) { // learn label for IJ 2022.3 and newer
168+
flatWelcomeFrame.findText(ButtonLabels.LEARN_LABEL).click();
169+
} else { // learn label for IJ 2022.2 and older
170+
flatWelcomeFrame.findText(ButtonLabels.LEARN_INTELLIJ_IDEA_LABEL).click();
171+
}
172+
SharedSteps.waitForComponentByXpath(remoteRobot, 2, 1, byXpath(XPathDefinitions.TIP_DIALOG_2));
176173
flatWelcomeFrame.findText(TIP_OF_THE_DAY).click();
177174
}
178175

@@ -254,11 +251,15 @@ private void removeTopProjectFromRecentProjects() {
254251
recentProjects = jLists(byXpath(XPathDefinitions.RECENT_PROJECTS)).get(0);
255252
}
256253

254+
// Clicks on X on first recent project to remove it from the recent projects list (visible only when hovered over with cursor)
257255
recentProjects.runJs("const horizontal_offset = component.getWidth()-22;\n" +
258256
"robot.click(component, new Point(horizontal_offset, 22), MouseButton.LEFT_BUTTON, 1);");
259257

260-
// Code for IntelliJ Idea 2020.3 or newer
261-
if (ideaVersion >= 20203) {
258+
if (ideaVersion >= 20231) {
259+
ComponentFixture removeDialog = remoteRobot.find(ComponentFixture.class, byXpath(XPathDefinitions.MY_DIALOG), Duration.ofSeconds(2));
260+
removeDialog.findText(ButtonLabels.REMOVE_FROM_LIST_LABEL)
261+
.click();
262+
} else if (ideaVersion >= 20203) { // Code for IntelliJ Idea 2020.3 or newer
262263
List<JPopupMenuFixture> jPopupMenuFixtures = jPopupMenus(JPopupMenuFixture.Companion.byType());
263264
if (!jPopupMenuFixtures.isEmpty()) {
264265
JPopupMenuFixture contextMenu = jPopupMenuFixtures.get(0);

src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/AbstractToolWinPane.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@ public void closeGradleBuildToolPane() {
9999
public JButtonFixture stripeButton(String label, boolean isPaneOpened) {
100100
if (isPaneOpened) {
101101
if (label.equals(ButtonLabels.MAVEN_STRIPE_BUTTON_LABEL) || label.equals(ButtonLabels.GRADLE_STRIPE_BUTTON_LABEL)) {
102-
return button(byXpath(XPathDefinitions.toolWindowSvg(label)), Duration.ofSeconds(2));
102+
if (UITestRunner.getIdeaVersionInt() >= 20221) { // Code for IntelliJ version 2022.1 and newer
103+
return button(byXpath(XPathDefinitions.toolWindowButton(label)), Duration.ofSeconds(2));
104+
} else { // Code for IntelliJ versions 2021.3 and older
105+
return button(byXpath(XPathDefinitions.toolWindowSvg(label)), Duration.ofSeconds(2));
106+
}
103107
} else if (label.equals(ButtonLabels.PROJECT_STRIPE_BUTTON_LABEL)) {
104108
return button(byXpath(XPathDefinitions.TOOLTIP_TEXT_PROJECT), Duration.ofSeconds(2));
105109
}

src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/BuildView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void waitUntilBuildHasFinished() {
5454
*/
5555
public boolean isBuildSuccessful() {
5656
String runConsoleOutput = TextUtils.listOfRemoteTextToString(buildConsole().findAllText());
57-
return runConsoleOutput.contains("BUILD SUCCESS");
57+
return runConsoleOutput.contains("BUILD SUCCESS") || runConsoleOutput.contains("exit code 0");
5858
}
5959

6060
/**

src/main/java/com/redhat/devtools/intellij/commonuitest/utils/constants/ButtonLabels.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public class ButtonLabels {
3333
public static final String GOT_IT_LABEL = "Got It";
3434
public static final String MORE_SETTINGS = "More Settings";
3535
public static final String ARTIFACT_COORDINATES = "Artifact Coordinates";
36+
public static final String LEARN_INTELLIJ_IDEA_LABEL = "Learn IntelliJ IDEA";
37+
public static final String LEARN_LABEL = "Learn";
38+
public static final String REMOVE_FROM_LIST_LABEL = "Remove From List";
3639

3740
private ButtonLabels() {
3841
throw new UITestException("Utility class with static methods.");

0 commit comments

Comments
 (0)