Skip to content

fix: fix for 2023.3 use case #351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
65 changes: 65 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Sonar
on:
workflow_run:
workflows: [Java CI with Gradle]
types:
- completed
jobs:
validate_versions:
runs-on: ubuntu-latest

strategy:
matrix:
IJ:
- 2020.2
- 2020.3
- 2021.1
- 2021.2
- 2021.3
- 2022.1
- 2022.2
- 2022.3
- 2023.1
- 2023.2
- 2023.3
- 2024.1
- 2024.2
- 2024.3

steps:
- uses: actions/checkout@v4
- name: Set up JDK 11 # Java 11 is only used for test NewProjectDialogTest/setProjectSdkIfAvailableTest
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
cache: 'gradle'
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Run integration tests
run: |
cd src/test-project
xvfb-run --server-args="-screen 0 1920x1080x24" ./gradlew integrationUITest --warning-mode none -PcommunityIdeaVersion=${{ matrix.IJ }}
- name: Archiving tests reports
uses: actions/upload-artifact@v4
with:
name: linux-test-reports-${{ matrix.IJ }}
path: src/test-project/build/reports/tests/*
if: always()
- name: Archiving screenshots
uses: actions/upload-artifact@v4
with:
name: linux-screenshots-${{ matrix.IJ }}
path: src/test-project/build/screenshots/*
if-no-files-found: ignore
if: always()
- name: Archiving StepLogger logs
uses: actions/upload-artifact@v4
with:
name: linux-steplogger-logs-${{ matrix.IJ }}
path: src/test-project/build/test-results/*
if: always()
43 changes: 43 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<trusted-key id="2E3A1AFFE42B5F53AF19F780BCF4173966770193" group="org.jetbrains"/>
<trusted-key id="A413F67D71BEEC23ADD0CE0ACB43338E060CF9FA" group="org.jacoco"/>
<trusted-key id="60200AC4AE761F1614D6C46766D68DAA073BE985" group="org.slf4j"/>
<trusted-key id="73B03597B892A329DC9B0F43CF84722DFC242EB9" group="org.easytesting"/>
<trusted-key id="6A30D7A614899833CE2F5FA3CEE8B79520334B30" group="org.assertj" version="2.2.1"/>
<trusted-key id="A778FDE933A96DDA827840D8E2B3D84202B812D9" group="org.assertj" version="2.2.7"/>
<trusted-key id="A5BD02B93E7A40482EB1D66A5F69AD087600B22C" group="org.ow2.asm" name="asm-bom" version="9.5"/>
Expand Down Expand Up @@ -116,6 +117,21 @@
<sha256 value="0e946f486b972c080fc229f65373d15104af6674c630fd9f125c4fd72120773b" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.build" version="0.8.9">
<artifact name="org.jacoco.build-0.8.9.pom">
<sha256 value="02678f267cdaa23ff51772ad1f033a1f3ff5741cc10d444740bd4834d47583b3" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.core" version="0.8.9">
<artifact name="org.jacoco.core-0.8.9.pom">
<sha256 value="5404f7052765a64374d275367fd9485bb5996b369113c89a8557d8f024810f02" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.report" version="0.8.9">
<artifact name="org.jacoco.report-0.8.9.pom">
<sha256 value="81e413bdde52bc70ae63f5cb14e524e5691532db7779b55d5899ee5c0b6fb871" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains" name="annotations" version="13.0">
<artifact name="annotations-13.0.jar">
<sha256 value="ace2a10dc8e2d5fd34925ecac03e4988b2c0f851650c94b8cef49ba1bd111478" origin="Generated by Gradle" reason="Artifact is not signed"/>
Expand All @@ -129,6 +145,11 @@
<sha256 value="f13df2e4caf1febce567667e7c378101a0331d53d1324d6e2dfe3aecfb1f7774" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="org.junit" name="junit-bom" version="5.12.2">
<artifact name="junit-bom-5.12.2.pom">
<sha256 value="cef80fec86454f6806bfb0df24669b5c6f32e2cb728539ea859f47dfdc9bbc17" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="org.junit" name="junit-bom" version="5.5.2">
<artifact name="junit-bom-5.5.2.pom">
<sha256 value="5a49562a4704541e69d4ee316cd7eaf711cddb7cad5d0f886bf8a1fe98d6a9c5" origin="Generated by Gradle" reason="Artifact is not signed"/>
Expand All @@ -147,6 +168,14 @@
<sha256 value="f19afe0923b01935c40f2e7e96d66037e2008b7017917cc7051338377849618e" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="org.junit.jupiter" name="junit-jupiter-api" version="5.12.2">
<artifact name="junit-jupiter-api-5.12.2.jar">
<sha256 value="0b9ca728e4bcd9adc57f29deb9556ff9ed5e08b4e8843b875aba4e4e3e04f092" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="junit-jupiter-api-5.12.2.pom">
<sha256 value="566282166489bd40b12c3507b995e48f8e025e09a05e7d16dd2b98dc642cf7de" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="org.junit.platform" name="junit-platform-commons" version="1.11.3">
<artifact name="junit-platform-commons-1.11.3.jar">
<sha256 value="be262964b0b6b48de977c61d4f931df8cf61e80e750cc3f3a0a39cdd21c1008c" origin="Generated by Gradle" reason="Artifact is not signed"/>
Expand All @@ -155,6 +184,14 @@
<sha256 value="816ebd3244a770d915d9c1d40d3b4651fe348f42f89b7cb7ebd0dee209c52040" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="org.junit.platform" name="junit-platform-commons" version="1.12.2">
<artifact name="junit-platform-commons-1.12.2.jar">
<sha256 value="e683a01e85dfabea520c056ac6015a6162756e602ec653c0da85e233f0afbc18" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="junit-platform-commons-1.12.2.pom">
<sha256 value="4f2b8a9065c909c6892d8622d553b6ab0a70321624499e3b69c1289f59ecc077" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="org.opentest4j" name="opentest4j" version="1.3.0">
<artifact name="opentest4j-1.3.0.jar">
<sha256 value="48e2df636cab6563ced64dcdff8abb2355627cb236ef0bf37598682ddf742f1b" origin="Generated by Gradle" reason="Artifact is not signed"/>
Expand All @@ -163,6 +200,11 @@
<sha256 value="9bf7cffc410f3e8372c2522578df9ca56d9d43bd937e30948706c232a943b355" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="org.ow2" name="ow2" version="1.5.1">
<artifact name="ow2-1.5.1.pom">
<sha256 value="321ddbb7ee6fe4f53dea6b4cd6db74154d6bfa42391c1f763b361b9f485acf05" origin="Generated by Gradle" reason="A key couldn't be downloaded"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm" version="9.5">
<artifact name="asm-9.5.jar">
<sha256 value="b62e84b5980729751b0458c534cf1366f727542bb8d158621335682a460f0353" origin="Generated by Gradle" reason="Artifact is not signed"/>
Expand All @@ -174,6 +216,7 @@
<component group="org.ow2.asm" name="asm-bom" version="9.5">
<artifact name="asm-bom-9.5.pom">
<pgp value="A5BD02B93E7A40482EB1D66A5F69AD087600B22C"/>
<sha256 value="71756b35dd837db638806f00f4077e8bb35fe8d80bd674e8141a307c811635bf" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm-commons" version="9.5">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static RemoteRobot runIde(IntelliJVersion ideaVersion, int port) {
ProcessBuilder pb;

if (ideaVersion.toInt() < 20242) {
pb = new ProcessBuilder("." + File.separator + "gradlew" + fileExtension, "runIdeForUiTests", "-PideaVersion=" + ideaVersion, "-Drobot-server.port=" + port);
pb = new ProcessBuilder("." + File.separator + "gradlew" + fileExtension, "runIdeForUiTests", "-PideaVersion=" + platformTypeVersion[1], "-Drobot-server.port=" + port);
} else {
pb = new ProcessBuilder("." + File.separator + "gradlew" + fileExtension, "runIdeForUiTests", "-Drobot-server.port=" + port, "-PplatformType=" + platformTypeVersion[0], "-PplatformVersion=" + platformTypeVersion[1]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,21 @@ public void activateTab(String tabName) {
* @param cmdToEnter command that will be invoked using the search field
*/
public void invokeCmd(String cmdToEnter) {
invokeSearch(cmdToEnter, true);
}

public void searchText(String searchString){
invokeSearch(searchString, false);
}

private void invokeSearch(String searchText, boolean invoke){
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));
new Keyboard(remoteRobot).hotKey(KeyEvent.VK_ENTER);
searchField.setText(searchText);
waitFor(Duration.ofSeconds(30), Duration.ofSeconds(1), "the search dialog in the Search Everywhere popup to load in 30 seconds.", () -> didSearchFinish(searchText));
if(invoke){
new Keyboard(remoteRobot).hotKey(KeyEvent.VK_ENTER);
}
}

private boolean didSearchFinish(String cmdToInvoke) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ public void maximizeIdeWindow() {
* Close the currently opened project
*/
public void closeProject() {
if (remoteRobot.isWin()) {
new MenuBar(remoteRobot).navigateTo("File", "Close Project");
} else {
if (remoteRobot.isMac()) {
invokeCmdUsingSearchEverywherePopup("Close Project");
} else {
new MenuBar(remoteRobot).navigateTo("File", "Close Project");
}
IdeInternalErrorUtils.clearWindowsErrorsIfTheyAppear(remoteRobot);
remoteRobot.find(FlatWelcomeFrame.class, Duration.ofSeconds(10)).runJs("const horizontal_offset = component.getWidth()/2;\n" +
Expand All @@ -98,6 +98,11 @@ public void invokeCmdUsingSearchEverywherePopup(String cmdToInvoke) {
searchEverywherePopup.invokeCmd(cmdToInvoke);
}

public void searchEverywhere(String searchString) {
SearchEverywherePopup searchEverywherePopup = openSearchEverywherePopup();
searchEverywherePopup.searchText(searchString);
}

private SearchEverywherePopup openSearchEverywherePopup() {
try {
find(ActionButtonFixture.class, byXpath("//div[@myicon='search.svg']"), Duration.ofSeconds(5)).click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void waitUntilAllBgTasksFinish() {
* Wait until all the background tasks finish
*/
public void waitUntilAllBgTasksFinish(int timeout) {
waitFor(Duration.ofSeconds(timeout), Duration.ofSeconds(10), "The background tasks did not finish in " + timeout + " seconds.", this::didAllBgTasksFinish);
waitFor(Duration.ofSeconds(timeout), Duration.ofSeconds(10), "the background tasks to finish in " + timeout + " seconds.", this::didAllBgTasksFinish);
}

private boolean didProjectImportFinish() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@
import com.intellij.remoterobot.RemoteRobot;
import com.intellij.remoterobot.fixtures.ActionButtonFixture;
import com.intellij.remoterobot.fixtures.CommonContainerFixture;
import com.intellij.remoterobot.fixtures.ComponentFixture;
import com.intellij.remoterobot.fixtures.JButtonFixture;
import com.intellij.remoterobot.fixtures.JPopupMenuFixture;
import com.intellij.remoterobot.fixtures.dataExtractor.RemoteText;
import com.intellij.remoterobot.utils.WaitForConditionTimeoutException;
import com.redhat.devtools.intellij.commonuitest.UITestRunner;
import com.redhat.devtools.intellij.commonuitest.fixtures.mainidewindow.MainIdeWindow;
import com.redhat.devtools.intellij.commonuitest.utils.constants.XPathDefinitions;
import com.redhat.devtools.intellij.commonuitest.utils.screenshot.ScreenshotUtils;
import org.jetbrains.annotations.NotNull;

import java.time.Duration;
import java.util.List;
import java.util.Optional;

import static com.intellij.remoterobot.search.locators.Locators.byXpath;
import static com.intellij.remoterobot.utils.RepeatUtilsKt.waitFor;
Expand All @@ -35,6 +42,7 @@ public class MenuBar {

public MenuBar(RemoteRobot remoteRobot) {
this.remoteRobot = remoteRobot;
checkVisibility();
}

/**
Expand All @@ -60,7 +68,7 @@ public void navigateTo(String... path) {

// Wait for the JPopupMenuFixture to appear
waitFor(Duration.ofSeconds(5), Duration.ofSeconds(1), "JPopupMenu to appear", () ->
!remoteRobot.findAll(JPopupMenuFixture.class, JPopupMenuFixture.Companion.byType()).isEmpty()
!remoteRobot.findAll(JPopupMenuFixture.class, JPopupMenuFixture.Companion.byType()).isEmpty()
);
}

Expand All @@ -83,7 +91,11 @@ private JButtonFixture mainMenuItem(String label) {
if (remoteRobot.isMac()) {
return null;
}
return getMainMenu().button(byXpath(XPathDefinitions.label(label)), Duration.ofSeconds(10));
}

@NotNull
public CommonContainerFixture getMainMenu() {
CommonContainerFixture cf;
if (remoteRobot.isLinux() && ideaVersionInt <= 20242) {
cf = remoteRobot.find(CommonContainerFixture.class, byXpath(XPathDefinitions.LINUX_MAIN_MENU), Duration.ofSeconds(10));
Expand All @@ -96,7 +108,25 @@ private JButtonFixture mainMenuItem(String label) {
} else {
cf = remoteRobot.find(CommonContainerFixture.class, byXpath(XPathDefinitions.WINDOWS_MAIN_MENU_2020_2_AND_OLDER), Duration.ofSeconds(10));
}
return cf;
}

return cf.button(byXpath(XPathDefinitions.label(label)), Duration.ofSeconds(10));
private void checkVisibility() {
// check menu already visible
try {
getMainMenu();
} catch (WaitForConditionTimeoutException e) {
// not visible
MainIdeWindow mainIdeWindow = remoteRobot.find(MainIdeWindow.class, Duration.ofSeconds(5));
mainIdeWindow.searchEverywhere("Appearance");
ComponentFixture appearanceDialog = remoteRobot.find(ComponentFixture.class, byXpath("//div[@class='SearchEverywhereUI']"));
List<RemoteText> items = appearanceDialog.findAllText();
Optional<RemoteText> item = items.stream().filter(remoteText -> remoteText.getText().equals("View | Appearance: Main Menu")).findFirst();
if (item.isPresent()) {
item.get().click();
} else {
ScreenshotUtils.takeScreenshot(remoteRobot, "Can't find 'Appearance' Main menu item");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public class XPathDefinitions {
@Language("XPath")
public static final String SET_LANGUAGE = "//div[@class='SegmentedButtonComponent'][.//div[contains(@action.key, 'language.groovy')]]";
@Language("XPath")
public static final String SET_BUILD_SYSTEM = "//div[@class='SegmentedButtonComponent'][.//div[@action.key='buildsystem.type.intellij']]";
public static final String SET_BUILD_SYSTEM = "//div[@class='SegmentedButtonComponent'][.//div[@visible_text='IntelliJ']]";
@Language("XPath")
public static final String SET_BUILD_SYSTEM_2024_2_AND_NEWER = "//div[@accessiblename='Build system:' and @class='SegmentedButtonComponent']"; // works for IntelliJ Idea 2024.1 and higher
@Language("XPath")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
*/
public class CreateCloseUtils {

static final int ideaVersionInt = UITestRunner.getIdeaVersionInt();

/**
* Create new project with given project name according to given project type
*
Expand All @@ -50,8 +52,6 @@ public static void createNewProject(RemoteRobot remoteRobot, String projectName,
NewProjectDialogWizard newProjectDialogWizard = openNewProjectDialogFromWelcomeDialog(remoteRobot);
NewProjectFirstPage newProjectFirstPage = newProjectDialogWizard.find(NewProjectFirstPage.class, Duration.ofSeconds(10));

final int ideaVersionInt = UITestRunner.getIdeaVersionInt();

if (ideaVersionInt >= 20221) {
newProjectFirstPage.selectNewProjectType("New Project");
newProjectFirstPage.setLanguage("Java");
Expand Down Expand Up @@ -119,8 +119,10 @@ public static void createEmptyProject(RemoteRobot remoteRobot, String projectNam
public static void waitAfterOpeningProject(RemoteRobot remoteRobot) {
IdeStatusBar ideStatusBar = remoteRobot.find(IdeStatusBar.class, Duration.ofSeconds(10));
ideStatusBar.waitUntilProjectImportIsComplete();
MainIdeWindow mainIdeWindow = remoteRobot.find(MainIdeWindow.class, Duration.ofSeconds(5));
mainIdeWindow.maximizeIdeWindow();
if (ideaVersionInt > 20233) {
MainIdeWindow mainIdeWindow = remoteRobot.find(MainIdeWindow.class, Duration.ofSeconds(5));
mainIdeWindow.maximizeIdeWindow();
}
ideStatusBar.waitUntilAllBgTasksFinish(500);
CodeWithMeDialog.closeCodeWithMePopupIfItAppears(remoteRobot);
}
Expand Down
2 changes: 1 addition & 1 deletion src/test-project/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
plugins {
id("java")
id("jacoco")
id("org.jetbrains.intellij.platform") version ("2.2.1")
id("org.jetbrains.intellij.platform") version ("2.6.0")
}

group = "com.redhat.devtools.intellij"
Expand Down
Loading