Skip to content

Commit 71a2949

Browse files
committed
fix: fix for 2023.3 use case
Signed-off-by: Stephane Bouchet <[email protected]>
1 parent fe7ae00 commit 71a2949

File tree

2 files changed

+77
-5
lines changed
  • .github/workflows
  • src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/menubar

2 files changed

+77
-5
lines changed

.github/workflows/ci.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,70 @@ jobs:
179179
name: macos-steplogger-logs
180180
path: src/test-project/build/test-results/*
181181
if: always()
182+
183+
validate_versions:
184+
runs-on: ubuntu-latest
185+
needs: run_on_linux
186+
strategy:
187+
matrix:
188+
IJ:
189+
- 2020.2
190+
- 2020.3
191+
- 2021.1
192+
- 2021.2
193+
- 2021.3
194+
- 2022.1
195+
- 2022.2
196+
- 2022.3
197+
- 2023.1
198+
- 2023.2
199+
- 2023.3
200+
- 2024.1
201+
- 2024.2
202+
- 2024.3
203+
204+
steps:
205+
- uses: actions/checkout@v4
206+
- name: Set up JDK 11 # Java 11 is only used for test NewProjectDialogTest/setProjectSdkIfAvailableTest
207+
uses: actions/setup-java@v4
208+
with:
209+
java-version: 11
210+
distribution: 'temurin'
211+
cache: 'gradle'
212+
- name: Set up JDK 17
213+
uses: actions/setup-java@v4
214+
with:
215+
java-version: 17
216+
distribution: 'temurin'
217+
cache: 'gradle'
218+
- name: Run integration tests
219+
run: |
220+
cd src/test-project
221+
xvfb-run --server-args="-screen 0 1920x1080x24" ./gradlew integrationUITest --warning-mode none -PcommunityIdeaVersion=${{ matrix.IJ }}
222+
- name: Archiving tests reports
223+
uses: actions/upload-artifact@v4
224+
with:
225+
name: linux-test-reports
226+
path: src/test-project/build/reports/tests/*
227+
if: always()
228+
- name: Archiving screenshots
229+
uses: actions/upload-artifact@v4
230+
with:
231+
name: linux-screenshots
232+
path: src/test-project/build/screenshots/*
233+
if-no-files-found: ignore
234+
if: always()
235+
- name: Archiving StepLogger logs
236+
uses: actions/upload-artifact@v4
237+
with:
238+
name: linux-steplogger-logs
239+
path: src/test-project/build/test-results/*
240+
if: always()
241+
- name: Archiving coverage for sonar
242+
uses: actions/upload-artifact@v4
243+
if: always()
244+
with:
245+
name: sonar-coverage
246+
path: |
247+
src/test-project/build/test-results/**/*.xml
248+
src/test-project/build/jacoco/

src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/menubar/MenuBar.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import java.time.Duration;
2828
import java.util.List;
29+
import java.util.Optional;
2930

3031
import static com.intellij.remoterobot.search.locators.Locators.byXpath;
3132
import static com.intellij.remoterobot.utils.RepeatUtilsKt.waitFor;
@@ -66,7 +67,7 @@ public void navigateTo(String... path) {
6667

6768
// Wait for the JPopupMenuFixture to appear
6869
waitFor(Duration.ofSeconds(5), Duration.ofSeconds(1), "JPopupMenu to appear", () ->
69-
!remoteRobot.findAll(JPopupMenuFixture.class, JPopupMenuFixture.Companion.byType()).isEmpty()
70+
!remoteRobot.findAll(JPopupMenuFixture.class, JPopupMenuFixture.Companion.byType()).isEmpty()
7071
);
7172
}
7273

@@ -109,18 +110,22 @@ public CommonContainerFixture getMainMenu() {
109110
return cf;
110111
}
111112

112-
public void setVisible(){
113+
public void setVisible() {
113114
// check menu already visible
114115
try {
115116
getMainMenu();
116117
} catch (WaitForConditionTimeoutException e) {
117118
// not visible
118119
MainIdeWindow mainIdeWindow = remoteRobot.find(MainIdeWindow.class, Duration.ofSeconds(5));
119120
mainIdeWindow.searchEverywhere("Appearance");
120-
ScreenshotUtils.takeScreenshot(remoteRobot);
121-
ComponentFixture appearanceDialog = remoteRobot.find(ComponentFixture.class, byXpath("//div[@class='JBViewport'][.//div[@class='MyList']]"));
121+
ComponentFixture appearanceDialog = remoteRobot.find(ComponentFixture.class, byXpath("//div[@class='SearchEverywhereUI']"));
122122
List<RemoteText> items = appearanceDialog.findAllText();
123-
items.stream().filter(remoteText -> remoteText.getText().equals("View | Appearance: Main Menu")).findFirst().ifPresent(RemoteText::click);
123+
Optional<RemoteText> item = items.stream().filter(remoteText -> remoteText.getText().equals("View | Appearance: Main Menu")).findFirst();
124+
if (item.isPresent()) {
125+
item.get().click();
126+
} else {
127+
ScreenshotUtils.takeScreenshot(remoteRobot, "Can't find 'Appearance' Main menu item");
128+
}
124129
}
125130
}
126131
}

0 commit comments

Comments
 (0)