Skip to content

Commit c751c52

Browse files
sbouchetangelozerr
authored andcommitted
fix: fix maven import
Signed-off-by: Stephane Bouchet <sbouchet@redhat.com>
1 parent 34b7588 commit c751c52

File tree

16 files changed

+142
-236
lines changed

16 files changed

+142
-236
lines changed

.github/workflows/IJ-latest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ jobs:
3333
- name: Build with Gradle
3434
run: |
3535
LATEST_EAP_SNAPSHOT=$(./gradlew printProductsReleases | grep 'IC-' | head -n 1 | cut -d'-' -f2)
36+
echo "building using latest EAP version $LATEST_EAP_SNAPSHOT"
3637
./gradlew check --continue -PplatformVersion=$LATEST_EAP_SNAPSHOT
3738
38-
3939
- name: Collect Tests Result
4040
uses: actions/upload-artifact@v4
4141
if: always()

.github/workflows/itests.yml

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,32 @@ jobs:
3636
path: build/screenshots/
3737
if-no-files-found: 'ignore'
3838
if: always()
39-
40-
build-macos:
41-
runs-on: macos-latest
4239

43-
steps:
44-
- uses: actions/checkout@v4
45-
- name: Set up JDK 17
46-
uses: actions/setup-java@v4
47-
with:
48-
distribution: temurin
49-
java-version: 17
50-
- name: Run integration tests
51-
run: ./gradlew integrationTest
52-
- uses: actions/upload-artifact@v4
53-
with:
54-
name: ${{ runner.os }}-integration-test-reports
55-
path: build/reports/tests/integrationTest
56-
if: always()
57-
- name: Archiving screenshots
58-
uses: actions/upload-artifact@v4
59-
with:
60-
name: ${{ runner.os }}-screenshots
61-
path: build/screenshots/
62-
if-no-files-found: 'ignore'
63-
if: always()
40+
# disabled. see https://github.com/redhat-developer/intellij-quarkus/issues/1350
41+
# build-macos:
42+
# runs-on: macos-latest
43+
#
44+
# steps:
45+
# - uses: actions/checkout@v4
46+
# - name: Set up JDK 17
47+
# uses: actions/setup-java@v4
48+
# with:
49+
# distribution: temurin
50+
# java-version: 17
51+
# - name: Run integration tests
52+
# run: ./gradlew integrationTest
53+
# - uses: actions/upload-artifact@v4
54+
# with:
55+
# name: ${{ runner.os }}-integration-test-reports
56+
# path: build/reports/tests/integrationTest
57+
# if: always()
58+
# - name: Archiving screenshots
59+
# uses: actions/upload-artifact@v4
60+
# with:
61+
# name: ${{ runner.os }}-screenshots
62+
# path: build/screenshots/
63+
# if-no-files-found: 'ignore'
64+
# if: always()
6465

6566
build-windows:
6667
runs-on: windows-latest

build.gradle.kts

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ sourceSets {
5757
java.srcDir("intellij-community/platform/external-system-impl/testSrc")
5858
java.srcDir("intellij-community/platform/lang-impl/testSources")
5959
java.srcDir("intellij-community/platform/testFramework/extensions/src")
60-
java.srcDir("intellij-community/plugins/gradle/src")
6160
java.srcDir("intellij-community/plugins/gradle/testSources")
6261
java.srcDir("intellij-community/plugins/gradle/tooling-extension-impl/testSources")
63-
java.srcDir("intellij-community/plugins/maven/src/test/java")
6462
java.srcDir("intellij-community/plugins/maven/testFramework/src")
6563
resources.srcDir("src/test/resources")
6664
}
@@ -69,7 +67,7 @@ sourceSets {
6967
java.srcDir("src/it/java")
7068
resources.srcDir("src/it/resources")
7169
compileClasspath += sourceSets.main.get().compileClasspath + sourceSets.test.get().compileClasspath
72-
runtimeClasspath += output + compileClasspath + sourceSets.test.get().runtimeClasspath + sourceSets.test.get().runtimeClasspath
70+
runtimeClasspath += output + compileClasspath + sourceSets.test.get().runtimeClasspath
7371
}
7472
}
7573

@@ -102,7 +100,6 @@ dependencies {
102100
println("bundledPlugins: $platformBundledPlugins")
103101
println("marketplacePlugins: $platformPlugins")
104102
pluginVerifier()
105-
instrumentationTools()
106103
testFramework(TestFrameworkType.Plugin.Java)
107104
}
108105

@@ -151,21 +148,7 @@ dependencies {
151148
builtBy("copyDeps")
152149
})
153150

154-
implementation(libs.annotations) // to build against platform <= 2023.2 and gradle intellij plugin > 2.0
155-
156-
// And now for some serious HACK!!!
157-
// Starting with 2023.1, all gradle tests fail importing projects with a:
158-
// com.intellij.openapi.externalSystem.model.ExternalSystemException: Unable to load class 'org.codehaus.plexus.logging.Logger'
159-
// Hence adding a jar containing the missing class, to the test classpath
160-
// The version matches the jar found in the IJ version used to compile the project
161-
// This is so wrong/ridiculous!
162-
testImplementation("org.eclipse.sisu:org.eclipse.sisu.plexus:0.3.4")
163-
164-
testImplementation("org.assertj:assertj-core:3.19.0")
165-
166-
testImplementation("org.opentest4j:opentest4j:1.3.0")
167-
168-
testImplementation("junit:junit:4.13.2")
151+
testImplementation(libs.junit)
169152
}
170153

171154
// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
@@ -251,17 +234,13 @@ val integrationTest by intellijPlatformTesting.testIde.registering {
251234
classpath = sourceSets["integrationTest"].runtimeClasspath
252235
outputs.upToDateWhen { false }
253236
mustRunAfter(tasks["test"])
254-
systemProperty ("debug-retrofit", "enable")
255-
}
256-
plugins {
257-
robotServerPlugin("0.11.23")
258237
}
259238

260239
dependencies {
261-
testImplementation("com.redhat.devtools.intellij:intellij-common-ui-test-library:0.4.4-SNAPSHOT")
262-
testImplementation("com.squareup.retrofit2:retrofit:2.11.0")
263-
testImplementation("com.squareup.retrofit2:converter-gson:2.11.0")
264-
testImplementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
240+
testRuntimeOnly(libs.junit.jupiter.engine)
241+
testImplementation(libs.junit.platform.launcher)
242+
testImplementation(libs.junit.jupiter.api)
243+
testImplementation(libs.devtools.common.ui.test)
265244
}
266245
}
267246

@@ -344,7 +323,6 @@ tasks {
344323
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-tasks.html#runIdeForUiTests
345324
val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
346325
task {
347-
systemProperty ("debug-retrofit", "enable")
348326
jvmArgumentProviders += CommandLineArgumentProvider {
349327
listOf(
350328
"-Drobot-server.port=8580",
@@ -355,7 +333,7 @@ val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
355333
}
356334
}
357335
plugins {
358-
robotServerPlugin("0.11.23")
336+
robotServerPlugin()
359337
}
360338
}
361339

gradle/libs.versions.toml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
[versions]
22
# libraries
3-
annotations = "24.0.1"
3+
junit = "4.13.2"
4+
junit-platform = "1.11.3"
5+
junit-jupiter = "5.11.3"
6+
devtools-common-ui-test = "0.4.4-SNAPSHOT"
47

58
# plugins
69
testlogger = "4.0.0"
710
kotlin = "2.0.20"
811
changelog = "2.2.0"
912
gradleIntelliJPlugin = "2.2.1"
1013

11-
1214
[libraries]
13-
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }
15+
junit = { group = "junit", name = "junit", version.ref = "junit" }
16+
junit-platform-launcher = { group = "org.junit.platform", name = "junit-platform-launcher", version.ref = "junit-platform" }
17+
junit-jupiter-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junit-jupiter" }
18+
junit-jupiter-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit-jupiter" }
19+
devtools-common-ui-test = { group = "com.redhat.devtools.intellij", name = "intellij-common-ui-test-library", version.ref = "devtools-common-ui-test" }
1420

1521
[plugins]
1622
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }

src/it/java/org/jboss/tools/intellij/quarkus/fixtures/dialogs/project/pages/QuarkusNewProjectFirstPage.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,18 @@
1212

1313
import com.intellij.remoterobot.RemoteRobot;
1414
import com.intellij.remoterobot.data.RemoteComponent;
15+
import com.intellij.remoterobot.fixtures.ComboBoxFixture;
1516
import com.intellij.remoterobot.fixtures.DefaultXpath;
1617
import com.intellij.remoterobot.fixtures.FixtureName;
18+
import com.redhat.devtools.intellij.commonuitest.UITestRunner;
1719
import com.redhat.devtools.intellij.commonuitest.fixtures.dialogs.project.pages.NewProjectFirstPage;
1820
import org.jboss.tools.intellij.quarkus.utils.XPathDefinitions;
1921
import org.jetbrains.annotations.NotNull;
2022

23+
import java.time.Duration;
24+
25+
import static com.intellij.remoterobot.search.locators.Locators.byXpath;
26+
2127
/**
2228
* New project dialog fixture
2329
*
@@ -29,4 +35,12 @@ public class QuarkusNewProjectFirstPage extends NewProjectFirstPage {
2935
public QuarkusNewProjectFirstPage(@NotNull RemoteRobot remoteRobot, @NotNull RemoteComponent remoteComponent) {
3036
super(remoteRobot, remoteComponent);
3137
}
38+
39+
@Override
40+
public ComboBoxFixture getProjectJdkComboBox() {
41+
if (UITestRunner.getIdeaVersionInt() >= 20241) {
42+
return comboBox(byXpath(XPathDefinitions.PROJECT_SDK_COMBOBOX_PROJECT_WIZARD), Duration.ofSeconds(10));
43+
}
44+
throw new UnsupportedOperationException("Get Project SDK ComboBox is not supported yet for IDEA version " + UITestRunner.getIdeaVersionInt());
45+
}
3246
}

src/it/java/org/jboss/tools/intellij/quarkus/tests/AbstractQuarkusTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
* @author zcervink@redhat.com
2727
*/
2828
@ExtendWith(ScreenshotAfterTestFailExtension.class)
29-
abstract public class AbstractQuarkusTest {
29+
public abstract class AbstractQuarkusTest {
3030
protected static RemoteRobot remoteRobot;
3131
private static boolean intelliJHasStarted = false;
3232

3333
@BeforeAll
3434
protected static void startIntelliJ() {
3535
if (!intelliJHasStarted) {
36-
remoteRobot = UITestRunner.runIde(IntelliJVersion.COMMUNITY_V_2023_2, 8580);
36+
remoteRobot = UITestRunner.runIde(IntelliJVersion.COMMUNITY_V_2024_3, 8580);
3737
intelliJHasStarted = true;
3838
Runtime.getRuntime().addShutdownHook(new CloseIntelliJBeforeQuit());
3939

src/it/java/org/jboss/tools/intellij/quarkus/tests/BasicTest.java

Lines changed: 7 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,18 @@
1111
package org.jboss.tools.intellij.quarkus.tests;
1212

1313
import com.intellij.remoterobot.RemoteRobot;
14-
import com.intellij.remoterobot.fixtures.CommonContainerFixture;
1514
import com.intellij.remoterobot.fixtures.ComponentFixture;
16-
import com.intellij.remoterobot.fixtures.JButtonFixture;
1715
import com.intellij.remoterobot.fixtures.JTextFieldFixture;
18-
import com.intellij.remoterobot.fixtures.JTreeFixture;
19-
import com.intellij.remoterobot.utils.WaitForConditionTimeoutException;
20-
import com.redhat.devtools.intellij.commonuitest.UITestRunner;
2116
import com.redhat.devtools.intellij.commonuitest.fixtures.dialogs.FlatWelcomeFrame;
2217
import com.redhat.devtools.intellij.commonuitest.fixtures.dialogs.project.NewProjectDialogWizard;
2318
import com.redhat.devtools.intellij.commonuitest.fixtures.mainidewindow.MainIdeWindow;
2419
import com.redhat.devtools.intellij.commonuitest.fixtures.mainidewindow.idestatusbar.IdeStatusBar;
2520
import com.redhat.devtools.intellij.commonuitest.fixtures.mainidewindow.toolwindowspane.BuildView;
2621
import com.redhat.devtools.intellij.commonuitest.fixtures.mainidewindow.toolwindowspane.ToolWindowPane;
27-
import com.redhat.devtools.intellij.commonuitest.fixtures.mainidewindow.toolwindowspane.ToolWindowsPane;
2822
import com.redhat.devtools.intellij.commonuitest.fixtures.mainidewindow.toolwindowspane.buildtoolpane.GradleBuildToolPane;
2923
import com.redhat.devtools.intellij.commonuitest.fixtures.mainidewindow.toolwindowspane.buildtoolpane.MavenBuildToolPane;
3024
import com.redhat.devtools.intellij.commonuitest.utils.constants.ProjectLocation;
3125
import com.redhat.devtools.intellij.commonuitest.utils.project.CreateCloseUtils;
32-
import com.redhat.devtools.intellij.commonuitest.utils.screenshot.ScreenshotUtils;
3326
import org.jboss.tools.intellij.quarkus.fixtures.dialogs.project.pages.QuarkusNewProjectFinalPage;
3427
import org.jboss.tools.intellij.quarkus.fixtures.dialogs.project.pages.QuarkusNewProjectFirstPage;
3528
import org.jboss.tools.intellij.quarkus.fixtures.dialogs.project.pages.QuarkusNewProjectSecondPage;
@@ -48,8 +41,6 @@
4841
import java.time.Duration;
4942

5043
import static com.intellij.remoterobot.search.locators.Locators.byXpath;
51-
import static com.intellij.remoterobot.utils.RepeatUtilsKt.waitFor;
52-
import static com.intellij.remoterobot.utils.RepeatUtilsKt.waitForIgnoringError;
5344
import static org.junit.jupiter.api.Assertions.assertTrue;
5445

5546
/**
@@ -76,7 +67,7 @@ public void createBuildQuarkusMavenTest() {
7667
ToolWindowPane toolWindowPane = remoteRobot.find(ToolWindowPane.class, Duration.ofSeconds(10));
7768
toolWindowPane.openMavenBuildToolPane();
7869
MavenBuildToolPane mavenBuildToolPane = toolWindowPane.find(MavenBuildToolPane.class, Duration.ofSeconds(10));
79-
mavenBuildToolPane.buildProject("install");
70+
mavenBuildToolPane.buildProject("verify");
8071
boolean isBuildSuccessful = toolWindowPane.find(BuildView.class, Duration.ofSeconds(10)).isBuildSuccessful();
8172
assertTrue(isBuildSuccessful, "The build should be successful but is not.");
8273
}
@@ -99,29 +90,27 @@ private void createQuarkusProject(RemoteRobot remoteRobot, String projectName, B
9990
NewProjectDialogWizard newProjectDialogWizard = remoteRobot.find(NewProjectDialogWizard.class, Duration.ofSeconds(10));
10091
QuarkusNewProjectFirstPage quarkusNewProjectFirstPage = newProjectDialogWizard.find(QuarkusNewProjectFirstPage.class, Duration.ofSeconds(10));
10192
quarkusNewProjectFirstPage.selectNewProjectType("Quarkus");
102-
10393
if (endpointURLType == EndpointURLType.CUSTOM) {
10494
ComponentFixture customEndpointURLJBRadioButton = remoteRobot.findAll(ComponentFixture.class, byXpath(XPathDefinitions.CUSTOM_ENDPOINT_URL_RADIO_BUTTON)).get(0);
10595
customEndpointURLJBRadioButton.click();
10696
JTextFieldFixture customEndpointURLJTextField = remoteRobot.findAll(JTextFieldFixture.class, byXpath(XPathDefinitions.CUSTOM_ENDPOINT_URL_TEXT_FIELD)).get(0);
10797
customEndpointURLJTextField.setText("https://code.quarkus.io");
10898
}
99+
quarkusNewProjectFirstPage.setProjectSdkIfAvailable(JAVA_VERSION_FOR_QUARKUS_PROJECT);
109100
newProjectDialogWizard.next();
110101

111102
QuarkusNewProjectSecondPage quarkusNewProjectSecondPage = newProjectDialogWizard.find(QuarkusNewProjectSecondPage.class, Duration.ofSeconds(10));
112103
quarkusNewProjectSecondPage.setBuildTool(buildTool);
113104
quarkusNewProjectSecondPage.setJavaVersion(JAVA_VERSION_FOR_QUARKUS_PROJECT);
114105
newProjectDialogWizard.next();
106+
115107
newProjectDialogWizard.find(QuarkusNewProjectThirdPage.class, Duration.ofSeconds(10)); // wait for third page to be loaded
116108
newProjectDialogWizard.next();
117109

118-
waitForIgnoringError(Duration.ofMillis(1000L),() -> remoteRobot.callJs("true"));
119-
120110
QuarkusNewProjectFinalPage quarkusNewProjectFinalPage = newProjectDialogWizard.find(QuarkusNewProjectFinalPage.class, Duration.ofSeconds(10));
121111
quarkusNewProjectFinalPage.setProjectName(projectName);
122-
123-
String QUARKUS_PROJECT_LOCATION = ProjectLocation.PROJECT_LOCATION + File.separator + projectName;
124-
Path quarkusProjectDir = Paths.get(QUARKUS_PROJECT_LOCATION);
112+
String quarkusProjectLocation = ProjectLocation.PROJECT_LOCATION + File.separator + projectName;
113+
Path quarkusProjectDir = Paths.get(quarkusProjectLocation);
125114
boolean doesProjectDirExists = Files.exists(quarkusProjectDir);
126115
if (!doesProjectDirExists) {
127116
try {
@@ -130,52 +119,14 @@ private void createQuarkusProject(RemoteRobot remoteRobot, String projectName, B
130119
throw new RuntimeException(e);
131120
}
132121
}
133-
134-
quarkusNewProjectFinalPage.setProjectLocation(QUARKUS_PROJECT_LOCATION);
135-
122+
quarkusNewProjectFinalPage.setProjectLocation(quarkusProjectLocation);
136123
newProjectDialogWizard.finish();
137124

138-
//minimizeProjectImportPopupIfItAppears();
139-
140125
IdeStatusBar ideStatusBar = remoteRobot.find(IdeStatusBar.class, Duration.ofSeconds(10));
141-
waitFor(Duration.ofSeconds(30), Duration.ofSeconds(3), "The project import did not finish in 5 minutes.", this::didProjectImportFinish);
126+
ideStatusBar.waitUntilProjectImportIsComplete();
142127

143-
//ideStatusBar.waitUntilProjectImportIsComplete();
144-
ScreenshotUtils.takeScreenshot(remoteRobot);
145128
MainIdeWindow mainIdeWindow = remoteRobot.find(MainIdeWindow.class, Duration.ofSeconds(5));
146129
mainIdeWindow.maximizeIdeWindow();
147-
ideStatusBar.waitUntilAllBgTasksFinish(500);
148130
}
149131

150-
private boolean didProjectImportFinish() {
151-
try {
152-
remoteRobot.find(ComponentFixture.class, byXpath(com.redhat.devtools.intellij.commonuitest.utils.constants.XPathDefinitions.ENGRAVED_LABEL), Duration.ofSeconds(1));
153-
} catch (WaitForConditionTimeoutException e) {
154-
return true;
155-
}
156-
return false;
157-
}
158-
159-
private void minimizeProjectImportPopupIfItAppears() {
160-
try {
161-
waitForIgnoringError(Duration.ofSeconds(30), Duration.ofMillis(200), "Close the project import popup if it appears...", () -> {
162-
remoteRobot.find(JButtonFixture.class, byXpath(XPathDefinitions.PROJECT_IMPORT_POPUP_MINIMIZE_BUTTON)).click();
163-
return true;
164-
});
165-
} catch (Exception e) {
166-
//suppress non-existing popup timeout
167-
}
168-
}
169-
170-
private void buildGradleProject(GradleBuildToolPane gradleBuildToolPane) {
171-
gradleBuildToolPane.find(JTreeFixture.class, JTreeFixture.Companion.byType(), Duration.ofSeconds(30));
172-
gradleBuildToolPane.expandAll();
173-
gradleBuildToolPane.gradleTaskTree().findAllText("build").get(1).doubleClick();
174-
if (UITestRunner.getIdeaVersionInt() >= 20221) {
175-
remoteRobot.find(ToolWindowPane.class).find(BuildView.class).waitUntilBuildHasFinished();
176-
} else {
177-
remoteRobot.find(ToolWindowsPane.class).find(BuildView.class).waitUntilBuildHasFinished();
178-
}
179-
remoteRobot.find(IdeStatusBar.class, Duration.ofSeconds(10)).waitUntilAllBgTasksFinish();
180-
}
181132
}

src/it/java/org/jboss/tools/intellij/quarkus/utils/XPathDefinitions.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,27 @@
1111

1212
package org.jboss.tools.intellij.quarkus.utils;
1313

14+
import org.intellij.lang.annotations.Language;
15+
1416
/**
1517
* XPath definitions
1618
*
1719
* @author zcervink@redhat.com
1820
*/
1921
public class XPathDefinitions {
20-
public static final String PROJECT_IMPORT_POPUP_MINIMIZE_BUTTON = "//div[@text='Background']";
22+
@Language("XPath")
2123
public static final String DIALOG_ROOT_PANE = "//div[@class='DialogRootPane']";
24+
@Language("XPath")
2225
public static final String CUSTOM_ENDPOINT_URL_RADIO_BUTTON = "//div[@accessiblename='Custom:' and @class='JBRadioButton' and @text='Custom:']";
26+
@Language("XPath")
2327
public static final String CUSTOM_ENDPOINT_URL_TEXT_FIELD = "//div[@class='BorderlessTextField']";
28+
@Language("XPath")
2429
public static final String SET_BUILD_TOOL_COMBO_BOX = "//div[@accessiblename='Tool:' and @class='ComboBox']";
30+
@Language("XPath")
2531
public static final String PROJECT_SETTINGS_COMPONENTS = "//div[@class='NamePathComponent']/*";
32+
@Language("XPath")
2633
public static final String JAVA_VERSION_COMBO_BOX = "//div[@accessiblename='Java version:' and @class='ComboBox']";
34+
@Language("XPath")
35+
public static final String PROJECT_SDK_COMBOBOX_PROJECT_WIZARD = "//div[@class='JdkComboBox']";
36+
2737
}

0 commit comments

Comments
 (0)