Skip to content

Commit

Permalink
fix: Fixed UI tests on Linux and Windows (#1349)
Browse files Browse the repository at this point in the history
* Added QuarkusNewProjectThirdPage class
* Enabled UI tests on GAs. Disabled mac-os ui tests. Added more output.
* Bumped intellij-common-ui-test-library version to 0.4.0
* Select java version for Quarkus project added
* Remote robot server port replaced with "System.getProperty(...)"

Signed-off-by: Oleksii Korniienko <[email protected]>
  • Loading branch information
olkornii committed Jul 4, 2024
1 parent b945502 commit 302b789
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
export DISPLAY=:99.0
Xvfb -ac :99 -screen 0 1920x1080x24 &
chmod +x gradlew
./gradlew integrationTest
./gradlew integrationTest --info
- uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-integration-test-reports
Expand All @@ -38,30 +38,30 @@ jobs:
build/screenshots/
if: always()

build-macos:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Run integration tests
run: |
./gradlew integrationTest
- uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-integration-test-reports
path: build/reports/tests/integrationTest
if: always()
- name: Archiving screenshots
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-screenshots
path: |
build/screenshots/
if: always()
# build-macos:
# runs-on: macos-latest
#
# steps:
# - uses: actions/checkout@v2
# - name: Set up JDK 17
# uses: actions/setup-java@v1
# with:
# java-version: 17
# - name: Run integration tests
# run: |
# ./gradlew integrationTest --info
# - uses: actions/upload-artifact@v2
# with:
# name: ${{ runner.os }}-integration-test-reports
# path: build/reports/tests/integrationTest
# if: always()
# - name: Archiving screenshots
# uses: actions/upload-artifact@v2
# with:
# name: ${{ runner.os }}-screenshots
# path: |
# build/screenshots/
# if: always()

build-windows:
runs-on: windows-latest
Expand All @@ -74,7 +74,7 @@ jobs:
java-version: 17
- name: Run integration tests
run: |
.\gradlew.bat integrationTest
.\gradlew.bat integrationTest --info
shell: powershell
- uses: actions/upload-artifact@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ dependencies {
builtBy("copyDeps")
})

testImplementation("com.redhat.devtools.intellij:intellij-common-ui-test-library:0.2.0")
testImplementation("com.redhat.devtools.intellij:intellij-common-ui-test-library:0.4.0")

// And now for some serious HACK!!!
// Starting with 2023.1, all gradle tests fail importing projects with a:
Expand Down Expand Up @@ -270,7 +270,7 @@ tasks {
// Configure UI tests plugin
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
runIdeForUiTests {
systemProperty("robot-server.port", "8082")
systemProperty("robot-server.port", System.getProperty("robot-server.port"))
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
systemProperty("jb.consents.confirmation.enabled", "false")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,15 @@ public void setBuildTool(BuildTool buildTool) {
comboBoxFixture.selectItem(buildTool.toString());
}
}

/**
* Set java version
*/
public void setJavaVersion(String javaVersion){
ComboBoxFixture comboBoxFixture = comboBox(byXpath(XPathDefinitions.JAVA_VERSION_COMBO_BOX), Duration.ofSeconds(10));
if (!comboBoxFixture.selectedText().contains(javaVersion)) {
comboBoxFixture.click(); // extra click needed due to an issue - https://github.com/JetBrains/intellij-ui-test-robot/issues/112
comboBoxFixture.selectItem(javaVersion);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*******************************************************************************
* Copyright (c) 2024 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution,
* and is available at https://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.intellij.quarkus.fixtures.dialogs.project.pages;

import com.intellij.remoterobot.RemoteRobot;
import com.intellij.remoterobot.data.RemoteComponent;
import com.intellij.remoterobot.fixtures.CommonContainerFixture;
import com.intellij.remoterobot.fixtures.DefaultXpath;
import com.intellij.remoterobot.fixtures.FixtureName;
import org.jboss.tools.intellij.quarkus.utils.XPathDefinitions;
import org.jetbrains.annotations.NotNull;

/**
* New project dialog fixture
*
* @author [email protected]
*/
@DefaultXpath(by = "MyDialog type", xpath = XPathDefinitions.DIALOG_ROOT_PANE)
@FixtureName(name = "New Project Dialog")
public class QuarkusNewProjectThirdPage extends CommonContainerFixture {
public QuarkusNewProjectThirdPage(@NotNull RemoteRobot remoteRobot, @NotNull RemoteComponent remoteComponent) {
super(remoteRobot, remoteComponent);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ abstract public class AbstractQuarkusTest {
@BeforeAll
protected static void startIntelliJ() {
if (!intelliJHasStarted) {
remoteRobot = UITestRunner.runIde(IntelliJVersion.COMMUNITY_V_2022_1, 8580);
remoteRobot = UITestRunner.runIde(IntelliJVersion.COMMUNITY_V_2023_2, 8580);
intelliJHasStarted = true;
Runtime.getRuntime().addShutdownHook(new CloseIntelliJBeforeQuit());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.jboss.tools.intellij.quarkus.fixtures.dialogs.project.pages.QuarkusNewProjectFinalPage;
import org.jboss.tools.intellij.quarkus.fixtures.dialogs.project.pages.QuarkusNewProjectFirstPage;
import org.jboss.tools.intellij.quarkus.fixtures.dialogs.project.pages.QuarkusNewProjectSecondPage;
import org.jboss.tools.intellij.quarkus.fixtures.dialogs.project.pages.QuarkusNewProjectThirdPage;
import org.jboss.tools.intellij.quarkus.utils.BuildTool;
import org.jboss.tools.intellij.quarkus.utils.EndpointURLType;
import org.jboss.tools.intellij.quarkus.utils.XPathDefinitions;
Expand All @@ -49,6 +50,7 @@
public class BasicTest extends AbstractQuarkusTest {
private final String NEW_QUARKUS_MAVEN_PROJECT_NAME = "code-with-quarkus-maven";
private final String NEW_QUARKUS_GRADLE_PROJECT_NAME = "code-with-quarkus-gradle";
private final String JAVA_VERSION_FOR_QUARKUS_PROJECT = "17";

@AfterEach
public void finishTestRun() {
Expand Down Expand Up @@ -100,7 +102,9 @@ private void createQuarkusProject(RemoteRobot remoteRobot, String projectName, B

QuarkusNewProjectSecondPage quarkusNewProjectSecondPage = newProjectDialogWizard.find(QuarkusNewProjectSecondPage.class, Duration.ofSeconds(10));
quarkusNewProjectSecondPage.setBuildTool(buildTool);
quarkusNewProjectSecondPage.setJavaVersion(JAVA_VERSION_FOR_QUARKUS_PROJECT);
newProjectDialogWizard.next();
newProjectDialogWizard.find(QuarkusNewProjectThirdPage.class, Duration.ofSeconds(10)); // wait for third page to be loaded
newProjectDialogWizard.next();
try {
Thread.sleep(1000L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ public class XPathDefinitions {
public static final String CUSTOM_ENDPOINT_URL_TEXT_FIELD = "//div[@class='BorderlessTextField']";
public static final String SET_BUILD_TOOL_COMBO_BOX = "//div[@accessiblename='Tool:' and @class='ComboBox']";
public static final String PROJECT_SETTINGS_COMPONENTS = "//div[@class='NamePathComponent']/*";
public static final String JAVA_VERSION_COMBO_BOX = "//div[@accessiblename='Java version:' and @class='ComboBox']";
}

0 comments on commit 302b789

Please sign in to comment.