Skip to content

Commit 201fd37

Browse files
authored
bump minimal version to 2022.3 (#356)
* fix: fix CodeWithMe on 2023.1 and starting for other versions Signed-off-by: Stephane Bouchet <[email protected]> * fix: fix Main Menu Signed-off-by: Stephane Bouchet <[email protected]> * chore: bump minimal version to 2022.3, due to IJ gradle plugin 2.x used. see https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin.html#requirements fixes #287 Signed-off-by: Stephane Bouchet <[email protected]> * chore: bump minimal version to 2022.3, due to IJ gradle plugin 2.x used. see https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin.html#requirements fixes #287 Signed-off-by: Stephane Bouchet <[email protected]> * chore: bump minimal version to 2022.3, due to IJ gradle plugin 2.x used. see https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin.html#requirements fixes #287 Signed-off-by: Stephane Bouchet <[email protected]> * chore: bump minimal version to 2022.3, due to IJ gradle plugin 2.x used. see https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin.html#requirements fixes #287 Signed-off-by: Stephane Bouchet <[email protected]> --------- Signed-off-by: Stephane Bouchet <[email protected]>
1 parent 1b178d2 commit 201fd37

File tree

52 files changed

+731
-1635
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+731
-1635
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ jobs:
5656

5757
steps:
5858
- uses: actions/checkout@v4
59-
- name: Set up JDK 11 # Java 11 is only used for test NewProjectDialogTest/setProjectSdkIfAvailableTest
60-
uses: actions/setup-java@v4
61-
with:
62-
java-version: 11
63-
distribution: 'temurin'
64-
cache: 'gradle'
6559
- name: Set up JDK 17
6660
uses: actions/setup-java@v4
6761
with:
@@ -104,12 +98,6 @@ jobs:
10498
runs-on: windows-latest
10599
steps:
106100
- uses: actions/checkout@v4
107-
- name: Set up JDK 11 # Java 11 is only used for test NewProjectDialogTest/setProjectSdkIfAvailableTest
108-
uses: actions/setup-java@v4
109-
with:
110-
java-version: 11
111-
distribution: 'temurin'
112-
cache: 'gradle'
113101
- name: Set up JDK 17
114102
uses: actions/setup-java@v4
115103
with:
@@ -144,12 +132,6 @@ jobs:
144132
runs-on: macos-latest
145133
steps:
146134
- uses: actions/checkout@v4
147-
- name: Set up JDK 11 # Java 11 is only used for test NewProjectDialogTest/setProjectSdkIfAvailableTest
148-
uses: actions/setup-java@v4
149-
with:
150-
java-version: 11
151-
distribution: 'temurin'
152-
cache: 'gradle'
153135
- name: Set up JDK 17
154136
uses: actions/setup-java@v4
155137
with:

.github/workflows/validate.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Validate against IJ versions
22

33
on:
4-
push:
5-
branches: [ main ]
64
pull_request:
75
branches: [ main ]
86

@@ -13,29 +11,16 @@ jobs:
1311
strategy:
1412
matrix:
1513
IJ:
16-
- 2020.2
17-
- 2020.3
18-
- 2021.1
19-
- 2021.2
20-
- 2021.3
21-
- 2022.1
22-
- 2022.2
2314
- 2022.3
2415
- 2023.1
2516
- 2023.2
2617
- 2023.3
2718
- 2024.1
2819
- 2024.2
29-
- 2024.3
20+
# - 2024.3 is the current one
3021

3122
steps:
3223
- uses: actions/checkout@v4
33-
- name: Set up JDK 11 # Java 11 is only used for test NewProjectDialogTest/setProjectSdkIfAvailableTest
34-
uses: actions/setup-java@v4
35-
with:
36-
java-version: 11
37-
distribution: 'temurin'
38-
cache: 'gradle'
3924
- name: Set up JDK 17
4025
uses: actions/setup-java@v4
4126
with:

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ build/
3232
target/
3333
pom.xml
3434

35-
/src/test-project/.intellijPlatform/self-update.lock
35+
/src/test-project/.intellijPlatform/
36+
/.intellijPlatform/

src/main/java/com/redhat/devtools/intellij/commonuitest/UITestRunner.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,11 @@ public static RemoteRobot runIde(IntelliJVersion ideaVersionUnderTest, int port)
6969
StepWorker.registerProcessor(new StepLogger());
7070
ideaVersion = ideaVersionUnderTest;
7171
if (ideaVersionUnderTest.equals(IntelliJVersion.UNSUPPORTED)) {
72-
LOGGER.severe("Cannot run Idea. Version is unsupported");
72+
LOGGER.severe("Cannot run Idea, version is unsupported. Please check supported versions in the documentation.");
7373
return null;
7474
}
7575

7676
return step("Start IntelliJ Idea ('" + ideaVersion + "') listening on port " + port, () -> {
77-
System.setProperty("uitestlib.idea.version", Integer.toString(ideaVersion.toInt()));
7877

7978
acceptAllTermsAndConditions();
8079

@@ -116,22 +115,13 @@ public static void closeIde() {
116115
ideProcess.destroy();
117116
}
118117

119-
/**
120-
* Return the IdeaVersion representation of the currently running IntelliJ Idea version
121-
*
122-
* @return version of the currently running IntelliJ Idea
123-
*/
124-
public static IntelliJVersion getIdeaVersion() {
125-
return ideaVersion;
126-
}
127-
128118
/**
129119
* Return the integer representation of the currently running IntelliJ Idea version
130120
*
131121
* @return version of the currently running IntelliJ Idea
132122
*/
133123
public static int getIdeaVersionInt() {
134-
return getIdeaVersion().toInt();
124+
return ideaVersion.toInt();
135125
}
136126

137127
/**

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

Lines changed: 35 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
import com.intellij.remoterobot.fixtures.ContainerFixture;
1818
import com.intellij.remoterobot.fixtures.DefaultXpath;
1919
import com.intellij.remoterobot.fixtures.FixtureName;
20-
import com.intellij.remoterobot.fixtures.HeavyWeightWindowFixture;
2120
import com.intellij.remoterobot.fixtures.JButtonFixture;
22-
import com.intellij.remoterobot.fixtures.JListFixture;
2321
import com.intellij.remoterobot.fixtures.JPopupMenuFixture;
2422
import com.intellij.remoterobot.fixtures.JTreeFixture;
2523
import com.intellij.remoterobot.utils.UtilsKt;
@@ -91,14 +89,7 @@ public void openProject(String projectName) {
9189
* @param label label of the link to click on
9290
*/
9391
public void clickOnLink(String label) {
94-
// Code for IntelliJ IDEA 2020.3 or newer
95-
if (ideaVersionInt >= 20203) {
96-
welcomeFrameLink(label).click();
97-
}
98-
// Code for IntelliJ IDEA 2020.2 or earlier
99-
else {
100-
actionLink(label).click();
101-
}
92+
welcomeFrameLink(label).click();
10293
}
10394

10495
/**
@@ -134,11 +125,11 @@ public void clearWorkspace() {
134125
public void clearExceptions() {
135126
try {
136127
ideErrorsIcon().click();
137-
find(IdeFatalErrorsDialog.class, Duration.ofSeconds(10)).clearAll();
128+
find(IdeFatalErrorsDialog.class, Duration.ofSeconds(5)).clearAll();
138129
} catch (WaitForConditionTimeoutException e) {
139130
LOGGER.log(Level.INFO, "No fatal errors dialog found to clear.");
140131
try {
141-
find(IdeFatalErrorsDialog.class, Duration.ofSeconds(10)).clearAll();
132+
find(IdeFatalErrorsDialog.class, Duration.ofSeconds(5)).clearAll();
142133
} catch (Exception e2) {
143134
LOGGER.log(Level.INFO, "Second attempt to clear fatal errors dialog also failed.");
144135
}
@@ -149,22 +140,18 @@ public void clearExceptions() {
149140
* Open the 'Preferences' dialog
150141
*/
151142
public void openSettingsDialog() {
152-
if (ideaVersionInt <= 20202) {
153-
clickOnLink("Configure");
154-
HeavyWeightWindowFixture heavyWeightWindowFixture = find(HeavyWeightWindowFixture.class, Duration.ofSeconds(5));
155-
heavyWeightWindowFixture.findText("Preferences").click();
156-
} else if (ideaVersionInt <= 20212) {
157-
JListFixture jListFixture = remoteRobot.find(JListFixture.class, byXpath(XPathDefinitions.JBLIST));
158-
jListFixture.clickItem("Customize", false);
159-
remoteRobot.find(ContainerFixture.class, byXpath(XPathDefinitions.DIALOG_PANEL)).findText("All settings" + '\u2026').click();
160-
} else {
161-
JTreeFixture jTreeFixture = remoteRobot.find(JTreeFixture.class, byXpath(XPathDefinitions.TREE));
162-
jTreeFixture.findText("Customize").click();
163-
if (remoteRobot.isMac()) {
164-
resizeWelcomeWindow();
165-
}
166-
remoteRobot.find(ContainerFixture.class, byXpath(XPathDefinitions.DIALOG_PANEL)).findText("All settings" + '\u2026').click();
143+
JTreeFixture jTreeFixture;
144+
try {
145+
jTreeFixture = remoteRobot.find(JTreeFixture.class, byXpath(XPathDefinitions.TREE));
146+
} catch (WaitForConditionTimeoutException e) {
147+
// workaround for 2022.3
148+
jTreeFixture = remoteRobot.find(JTreeFixture.class, byXpath(XPathDefinitions.TREE_FOR_20223));
149+
}
150+
jTreeFixture.findText("Customize").click();
151+
if (remoteRobot.isMac()) {
152+
resizeWelcomeWindow();
167153
}
154+
remoteRobot.find(ContainerFixture.class, byXpath(XPathDefinitions.DIALOG_PANEL)).findText("All settings" + '\u2026').click();
168155
}
169156

170157
/**
@@ -204,25 +191,10 @@ private void resizeWelcomeWindow() {
204191
* @return fixture for the 'Tip Of the Day' dialog
205192
*/
206193
public TipDialog openTipDialog() {
207-
if (ideaVersionInt >= 20211) {
208-
FlatWelcomeFrame flatWelcomeFrame = remoteRobot.find(FlatWelcomeFrame.class, Duration.ofSeconds(2));
209-
if (ideaVersionInt >= 20223) { // COMMUNITY_V_2022_3 and higher version have different labels for Learn button
210-
flatWelcomeFrame.findText(ButtonLabels.LEARN_LABEL).click();
211-
} else {
212-
flatWelcomeFrame.findText(ButtonLabels.LEARN_INTELLIJ_IDEA_LABEL).click();
213-
}
214-
SharedSteps.waitForComponentByXpath(remoteRobot, 2, 200, byXpath(XPathDefinitions.TIP_DIALOG_2));
215-
flatWelcomeFrame.findText(TIP_OF_THE_DAY).click();
216-
} else if (ideaVersionInt <= 20202) {
217-
clickOnLink("Get Help");
218-
HeavyWeightWindowFixture heavyWeightWindowFixture = find(HeavyWeightWindowFixture.class, Duration.ofSeconds(5));
219-
heavyWeightWindowFixture.findText(TIP_OF_THE_DAY).click();
220-
} else if (ideaVersionInt == 20203) { // IJ 2020.3
221-
actionLink("Help").click();
222-
HeavyWeightWindowFixture heavyWeightWindowFixture = find(HeavyWeightWindowFixture.class, Duration.ofSeconds(5));
223-
heavyWeightWindowFixture.findText(TIP_OF_THE_DAY).click();
224-
}
225-
194+
FlatWelcomeFrame flatWelcomeFrame = remoteRobot.find(FlatWelcomeFrame.class, Duration.ofSeconds(2));
195+
flatWelcomeFrame.findText(ButtonLabels.LEARN_LABEL).click();
196+
SharedSteps.waitForComponentByXpath(remoteRobot, 2, 200, byXpath(XPathDefinitions.TIP_DIALOG_2));
197+
flatWelcomeFrame.findText(TIP_OF_THE_DAY).click();
226198
return remoteRobot.find(TipDialog.class, Duration.ofSeconds(10));
227199
}
228200

@@ -239,45 +211,26 @@ public void disableNotifications() {
239211
switchToProjectsPage();
240212
}
241213

242-
/**
243-
* Prevent the 'Tip of the Day' dialog from opening after project import
244-
*/
245-
public void preventTipDialogFromOpening() {
246-
TipDialog tipDialog = openTipDialog();
247-
tipDialog.dontShowTipsCheckBox().setValue(true);
248-
tipDialog.close();
249-
switchToProjectsPage();
250-
}
251-
252214
/**
253215
* Switch to the 'Projects' page of flat welcome frame
254216
*/
255217
public void switchToProjectsPage() {
256-
if (ideaVersionInt >= 20213) {
257-
JTreeFixture jTreeFixture = remoteRobot.find(JTreeFixture.class, byXpath(XPathDefinitions.TREE));
258-
jTreeFixture.findText(PROJECTS_BUTTON).click();
259-
} else if (ideaVersionInt >= 20203) {
260-
JListFixture jListFixture = remoteRobot.find(JListFixture.class, byXpath(XPathDefinitions.JBLIST));
261-
jListFixture.clickItem(PROJECTS_BUTTON, false);
218+
JTreeFixture jTreeFixture;
219+
try {
220+
jTreeFixture = remoteRobot.find(JTreeFixture.class, byXpath(XPathDefinitions.TREE));
221+
} catch (WaitForConditionTimeoutException e) {
222+
// workaround for 2022.3
223+
jTreeFixture = remoteRobot.find(JTreeFixture.class, byXpath(XPathDefinitions.TREE_FOR_20223));
262224
}
225+
jTreeFixture.findText(PROJECTS_BUTTON).click();
263226
}
264227

265228
private int projectsCount() {
266-
if (ideaVersionInt >= 20222) {
267-
try {
268-
JTreeFixture projects = remoteRobot.findAll(JTreeFixture.class, byXpath(XPathDefinitions.RECENT_PROJECT_PANEL_NEW_2)).get(0);
269-
return projects.findAllText().size() / 2;
270-
} catch (IndexOutOfBoundsException e) {
271-
return 0;
272-
}
273-
} else {
274-
try {
275-
ContainerFixture projectWrapper = find(ContainerFixture.class, byXpath(XPathDefinitions.RECENT_PROJECT_PANEL_NEW));
276-
JListFixture projectList = projectWrapper.find(JListFixture.class, byXpath(XPathDefinitions.MY_LIST));
277-
return projectList.collectItems().size();
278-
} catch (WaitForConditionTimeoutException e) {
279-
return 0;
280-
}
229+
try {
230+
JTreeFixture projects = remoteRobot.findAll(JTreeFixture.class, byXpath(XPathDefinitions.RECENT_PROJECT_PANEL_NEW_2)).get(0);
231+
return projects.findAllText().size() / 2;
232+
} catch (IndexOutOfBoundsException e) {
233+
return 0;
281234
}
282235
}
283236

@@ -293,16 +246,11 @@ private JButtonFixture welcomeFrameLink(String label) {
293246
}
294247

295248
private ComponentFixture ideErrorsIcon() {
296-
return find(ComponentFixture.class, byXpath(XPathDefinitions.IDE_ERROR_ICON), Duration.ofSeconds(10));
249+
return find(ComponentFixture.class, byXpath(XPathDefinitions.IDE_ERROR_ICON), Duration.ofSeconds(5));
297250
}
298251

299252
private void removeTopProjectFromRecentProjects() {
300-
ComponentFixture recentProjects;
301-
if (ideaVersionInt >= 20222) {
302-
recentProjects = remoteRobot.findAll(JTreeFixture.class, byXpath(XPathDefinitions.RECENT_PROJECT_PANEL_NEW_2)).get(0);
303-
} else {
304-
recentProjects = jLists(byXpath(XPathDefinitions.RECENT_PROJECTS)).get(0);
305-
}
253+
ComponentFixture recentProjects = remoteRobot.findAll(JTreeFixture.class, byXpath(XPathDefinitions.RECENT_PROJECT_PANEL_NEW_2)).get(0);
306254

307255
// Clicks on X on first recent project to remove it from the recent projects list (visible only when hovered over with cursor)
308256
recentProjects.runJs("const horizontal_offset = component.getWidth()-22;\n" +
@@ -311,16 +259,12 @@ private void removeTopProjectFromRecentProjects() {
311259
if (ideaVersionInt >= 20231) {
312260
ComponentFixture removeDialog = remoteRobot.find(ComponentFixture.class, byXpath(XPathDefinitions.MY_DIALOG), Duration.ofSeconds(10));
313261
removeDialog.findText(ButtonLabels.REMOVE_FROM_LIST_LABEL).click();
314-
} else if (ideaVersionInt >= 20203) { // Code for IntelliJ Idea 2020.3 or newer
262+
} else {
315263
List<JPopupMenuFixture> jPopupMenuFixtures = jPopupMenus(JPopupMenuFixture.Companion.byType());
316264
if (!jPopupMenuFixtures.isEmpty()) {
317265
JPopupMenuFixture contextMenu = jPopupMenuFixtures.get(0);
318-
if (ideaVersionInt >= 20222) {
319-
contextMenu.select("Remove from Recent Projects" + '\u2026');
320-
button(byXpath(XPathDefinitions.REMOVE_PROJECT_BUTTON)).click();
321-
} else {
322-
contextMenu.select("Remove from Recent Projects");
323-
}
266+
contextMenu.select("Remove from Recent Projects" + '\u2026');
267+
button(byXpath(XPathDefinitions.REMOVE_PROJECT_BUTTON)).click();
324268
}
325269
}
326270
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ public CodeWithMeDialog(@NotNull RemoteRobot remoteRobot, @NotNull RemoteCompone
4848
*/
4949
public static void closeCodeWithMePopupIfItAppears(RemoteRobot remoteRobot) {
5050
CodeWithMeDialog codeWithMeDialog;
51-
int ideaVersionInt = UITestRunner.getIdeaVersionInt();
5251
try {
53-
if (ideaVersionInt <= 20231) {
52+
if (UITestRunner.getIdeaVersionInt() <= 20231) {
5453
codeWithMeDialog = remoteRobot.find(CodeWithMeDialog.class, byXpath("//div[@class='Wrapper']//div[@class='JPanel']"), Duration.ofSeconds(10));
5554
} else {
5655
codeWithMeDialog = remoteRobot.find(CodeWithMeDialog.class, Duration.ofSeconds(10));

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

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import com.intellij.remoterobot.fixtures.FixtureName;
1818
import com.intellij.remoterobot.fixtures.JButtonFixture;
1919
import com.intellij.remoterobot.utils.WaitForConditionTimeoutException;
20-
import com.redhat.devtools.intellij.commonuitest.UITestRunner;
2120
import com.redhat.devtools.intellij.commonuitest.exceptions.UITestException;
2221
import com.redhat.devtools.intellij.commonuitest.utils.constants.ButtonLabels;
2322
import com.redhat.devtools.intellij.commonuitest.utils.constants.XPathDefinitions;
@@ -35,29 +34,11 @@ public NewProjectDialogWizard(@NotNull RemoteRobot remoteRobot, @NotNull RemoteC
3534
super(remoteRobot, remoteComponent);
3635
}
3736

38-
/**
39-
* Move to the previous page of the 'New Project' dialog by clicking on the 'Previous' button
40-
*/
41-
public void previous() {
42-
clickOnButton(ButtonLabels.PREVIOUS_LABEL);
43-
}
44-
45-
/**
46-
* Move to the next page of the 'New Project' dialog by clicking on the 'Next' button
47-
*/
48-
public void next() {
49-
clickOnButton(ButtonLabels.NEXT_LABEL);
50-
}
51-
5237
/**
5338
* Finish the 'New Project' dialog
5439
*/
5540
public void finish() {
56-
if (UITestRunner.getIdeaVersionInt() >= 20221) {
57-
clickOnButton(ButtonLabels.CREATE_LABEL);
58-
} else {
59-
clickOnButton(ButtonLabels.FINISH_LABEL);
60-
}
41+
clickOnButton(ButtonLabels.CREATE_LABEL);
6142
}
6243

6344
/**

0 commit comments

Comments
 (0)