Skip to content
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

Add basic UI test that creates new Quarkus project and builds it using maven #234

Merged
merged 6 commits into from
Oct 6, 2020

Conversation

zcervink
Copy link
Contributor

@zcervink zcervink commented Sep 21, 2020

Fixes: #216

Signed-off-by: Zbynek Cervinka zcervink@redhat.com

Please review @odockal @jkopriva

@jeffmaury
Copy link
Member

Great work. However, it uses a separate sub project which would make it more difficult to write new tests.
Would it be possible to:

  • move the sources to src/it/java and src/it/resources
  • add the require Gradle configuration in build.gradle (see the OpenShift Connector)
  • add the integration tests execution in the main Github Actions so that we run the integration tests as well


import static com.intellij.remoterobot.stepsProcessing.StepWorkerKt.step;


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be also author and also short description what it does.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added author and comments to every Java file.

@@ -0,0 +1,16 @@
#! /bin/bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add also short description, what it does.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need for adding a description after all, because the script has been deleted (it was just a temporary script until the gradle issue is resolved).

…g maven.

Fixes: 216

Signed-off-by: Zbynek Cervinka <zcervink@redhat.com>
@odockal
Copy link

odockal commented Sep 30, 2020

@zcervink @jkopriva I think it can be merged how it is. Another refactoring and creating a lib can be done in next turn.

Copy link
Member

@jeffmaury jeffmaury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the main workflow (CI.yml) should also be updated to run integration tests

build.gradle Outdated
@@ -80,6 +106,10 @@ dependencies {
compile 'org.eclipse.lsp4mp:org.eclipse.lsp4mp.ls:0.1.0'
compile 'org.eclipse.lsp4j:org.eclipse.lsp4j:0.8.1'
compile 'com.vladsch.flexmark:flexmark:0.50.50'
testImplementation("com.intellij.remoterobot:remote-robot:$remoteRobotVersion")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be integrationTestImplementation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

build.gradle Outdated
@@ -110,5 +144,27 @@ jacocoTestReport {

check.dependsOn jacocoTestReport

subprojects {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed


public static void waitUntilTheProjectImportIsComplete(RemoteRobot remoteRobot) {
step("Wait until the project import is complete", () -> {
while (true) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a built-in method for conditional waits in com.intellij.remoterobot.utils.RepeatUtilsKt called waitFor. Please use that instead of endless loops.

Copy link
Contributor Author

@zcervink zcervink Sep 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrichter1 Thank you very much for this advice. The infinite while loops have been replace with the waitFor() method.

@jeffmaury
Copy link
Member

I tested it on my Win10Pro laptop and it failed from me:

  • run ./gradlew runIdeForUiTests in one Windows shell
  • run ./gradlew integrationTest in another

Here is the log:

$ ./gradlew integrationTest                                                                                                                                                            
                                                                                                                                                                                       
> Task :integrationTest                                                                                                                                                                
                                                                                                                                                                                       
org.jboss.tools.intellij.quarkus.BasicTests                                                                                                                                            
                                                                                                                                                                                       
  Test createAQuarkusProjectAndBuildItUsingMaven() FAILED (22.7s)                                                                                                                      
                                                                                                                                                                                       
  com.intellij.remoterobot.utils.WaitForConditionTimeoutException: Exceeded timeout (PT20S) for condition function (Failed to find 'New Project Dialog' by 'MyDialog type' in 20s)     
      at org.jboss.tools.intellij.quarkus.BasicTests.lambda$createAQuarkusProjectAndBuildItUsingMaven$0(BasicTests.java:53)                                                            
                                                                                                                                                                                       
                                                                                                                                                                                       
FAILURE: Executed 1 tests in 33.1s (1 failed)                                                                                                                                          
                                                                                                                                                                                       
                                                                                                                                                                                       
1 test completed, 1 failed                                                                                                                                                             
                                                                                                                                                                                       
> Task :integrationTest FAILED                                                                                                                                                         

Signed-off-by: Zbynek Cervinka <zcervink@redhat.com>
build.gradle Outdated
id "com.adarshr.test-logger" version "1.7.0"
id 'org.jetbrains.kotlin.jvm' version '1.3.71'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

build.gradle Outdated
useJUnitPlatform()
}

wrapper {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last question: what is the rationale for this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed. I have copied it from other gradle configuration, now I see it is not necessary.

Signed-off-by: Zbynek Cervinka <zcervink@redhat.com>
@zcervink
Copy link
Contributor Author

zcervink commented Oct 6, 2020

I tested it on my Win10Pro laptop and it failed from me:

  • run ./gradlew runIdeForUiTests in one Windows shell
  • run ./gradlew integrationTest in another

Here is the log:

$ ./gradlew integrationTest                                                                                                                                                            
                                                                                                                                                                                       
> Task :integrationTest                                                                                                                                                                
                                                                                                                                                                                       
org.jboss.tools.intellij.quarkus.BasicTests                                                                                                                                            
                                                                                                                                                                                       
  Test createAQuarkusProjectAndBuildItUsingMaven() FAILED (22.7s)                                                                                                                      
                                                                                                                                                                                       
  com.intellij.remoterobot.utils.WaitForConditionTimeoutException: Exceeded timeout (PT20S) for condition function (Failed to find 'New Project Dialog' by 'MyDialog type' in 20s)     
      at org.jboss.tools.intellij.quarkus.BasicTests.lambda$createAQuarkusProjectAndBuildItUsingMaven$0(BasicTests.java:53)                                                            
                                                                                                                                                                                       
                                                                                                                                                                                       
FAILURE: Executed 1 tests in 33.1s (1 failed)                                                                                                                                          
                                                                                                                                                                                       
                                                                                                                                                                                       
1 test completed, 1 failed                                                                                                                                                             
                                                                                                                                                                                       
> Task :integrationTest FAILED                                                                                                                                                         

This sometimes happens because there is a delay before the IDE UI appears. We are working on this issue with Jan Richter, for now you need run the ./gradlew runIdeForUiTests command, wait until the UI appears and then run the ./gradlew integrationTest command. There is also an issue with the IDE version - the tests best run on the IC-2020.1 version, some older version has sometimes different UI and the build fails (#242).

Signed-off-by: Zbynek Cervinka <zcervink@redhat.com>
Signed-off-by: Zbynek Cervinka <zcervink@redhat.com>
@zcervink
Copy link
Contributor Author

zcervink commented Oct 6, 2020

@jeffmaury All requested changes from you and from @jrichter1 have been made. Can you make final review/merge if possible?

build.gradle Outdated
integrationTestImplementation("com.intellij.remoterobot:remote-robot:$remoteRobotVersion")
integrationTestImplementation("com.intellij.remoterobot:remote-fixtures:$fixturesVersion")
integrationTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should'n it be integrationTestRuntimeOnly ?

Signed-off-by: Zbynek Cervinka <zcervink@redhat.com>
Copy link
Member

@jeffmaury jeffmaury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congrats. Major improvment

@jeffmaury jeffmaury merged commit 093ffae into redhat-developer:master Oct 6, 2020
@zcervink zcervink deleted the 216 branch October 7, 2020 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automate basic UI test that creates new Quarkus project and builds it using maven
5 participants