Closed Osiris-Team closed 1 month ago
You forgot to call MockVaadin.setup()
@mvysny I didn't change anything regarding the tests. And that is called before if I saw correctly?
Can you share the steps to reproduce please?
@mvysny not sure there are any special steps, I forked, modified it to work with 1JPM and simply executed the maven clean package tasks.
Please make sure that MockVaadin.setup() was called and MockVaadin.teardown() was not called - e.g. place a breakpoints into the tests.
Closing as won't fix since the issue is not in this repo. If it looks like a problem with Karibu Testing itself, please open a bug report there.
Hey, some test is failing for me, any ideas why? I am using a modifed version of this example which you can find here: https://github.com/Osiris-Team/vaadin-boot-example-1jpm However I compared the pom.xml files and they should be pretty similar still. Can you reproduce this issue on the original vaadin-boot-example-maven repo?
Log
```sh No version provided. This might cause issues. Dependency: com.vaadin:vaadin-core No version provided. This might cause issues. Dependency: javax.annotation:javax.annotation-api No version provided. This might cause issues. Dependency: com.vaadin:flow-server-production-mode No version provided. This might cause issues. Dependency: com.vaadin:vaadin-core No version provided. This might cause issues. Dependency: com.vaadin:vaadin-dev No version provided. This might cause issues. Dependency: com.vaadin:vaadin-maven-plugin Generated pom.xml file. Executing: D:\Coding\JAVA\vaadin-boot-example-1jpm\mvnw.cmd clean package Found "D:\Coding\JAVA\vaadin-boot-example-1jpm\.mvn\wrapper\maven-wrapper.jar" [INFO] Scanning for projects... [INFO] [INFO] ---------------< com.example:vaadin-boot-example-maven >---------------- [INFO] Building vaadin-boot-example-maven 1.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ vaadin-boot-example-maven --- [INFO] Deleting D:\Coding\JAVA\vaadin-boot-example-1jpm\target [INFO] [INFO] --- maven-enforcer-plugin:3.3.0:enforce (enforce) @ vaadin-boot-example-maven --- [INFO] Rule 0: org.apache.maven.enforcer.rules.dependency.DependencyConvergence passed [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ vaadin-boot-example-maven --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 3 resources [INFO] [INFO] >>> vaadin-maven-plugin:24.4.7:prepare-frontend (default) > :configure @ vaadin-boot-example-maven >>> [INFO] [INFO] --- vaadin-maven-plugin:24.4.7:configure (configure) @ vaadin-boot-example-maven --- [INFO] Reflections took 681 ms to scan 155 urls, producing 5301 keys and 29980 values [WARNING] The 'configure' goal is only meant to be used in Hilla projects with endpoints. [INFO] [INFO] <<< vaadin-maven-plugin:24.4.7:prepare-frontend (default) < :configure @ vaadin-boot-example-maven <<< [INFO] [INFO] [INFO] --- vaadin-maven-plugin:24.4.7:prepare-frontend (default) @ vaadin-boot-example-maven --- [INFO] Reflections took 185 ms to scan 155 urls, producing 5301 keys and 29980 values [ERROR] Command '[C:\Users\arman\AppData\Roaming\npm\npm.cmd, -v]' failed with exit code '1' [INFO] Reflections took 291 ms to scan 155 urls, producing 5301 keys and 29980 values [INFO] Reflections took 130 ms to scan 155 urls, producing 5301 keys and 29980 values [INFO] Visited 93 classes. Took 140 ms. [INFO] Copying frontend resources from jar files ... [INFO] Visited 155 resources. Took 917 ms. [INFO] [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ vaadin-boot-example-maven --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 5 source files to D:\Coding\JAVA\vaadin-boot-example-1jpm\target\classes [INFO] /D:/Coding/JAVA/vaadin-boot-example-1jpm/src/main/java/JPM.java: D:\Coding\JAVA\vaadin-boot-example-1jpm\src\main\java\JPM.java verwendet oder �berschreibt eine veraltete API. [INFO] /D:/Coding/JAVA/vaadin-boot-example-1jpm/src/main/java/JPM.java: Wiederholen Sie die Kompilierung mit -Xlint:deprecation, um Details zu erhalten. [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ vaadin-boot-example-maven --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory D:\Coding\JAVA\vaadin-boot-example-1jpm\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ vaadin-boot-example-maven --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to D:\Coding\JAVA\vaadin-boot-example-1jpm\target\test-classes [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ vaadin-boot-example-maven --- [INFO] Surefire report directory: D:\Coding\JAVA\vaadin-boot-example-1jpm\target\surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.vaadin.starter.skeleton.MainViewTest Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.03 sec <<< FAILURE! com.vaadin.starter.skeleton.MainViewTest.testGreeting() Time elapsed: 0.029 sec <<< FAILURE! java.lang.IllegalStateException: UI.getCurrent() is null. Have you called MockVaadin.setup()? at com.github.mvysny.kaributesting.v10.UtilsKt.getCurrentUI(Utils.kt:132) at com.github.mvysny.kaributesting.v10.LocatorKt._get(Locator.kt:183) at com.github.mvysny.kaributesting.v10.LocatorJ._get(LocatorJ.java:48) at com.vaadin.starter.skeleton.MainViewTest.testGreeting(MainViewTest.java:73) Results : Failed tests: com.vaadin.starter.skeleton.MainViewTest.testGreeting(): UI.getCurrent() is null. Have you called MockVaadin.setup()? Tests run: 1, Failures: 1, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 7.409 s [INFO] Finished at: 2024-08-04T00:00:48+02:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project vaadin-boot-example-maven: There are test failures. [ERROR] [ERROR] Please refer to D:\Coding\JAVA\vaadin-boot-example-1jpm\target\surefire-reports for the individual test results. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException Exception in thread "main" java.lang.RuntimeException: Maven (mvnw.cmd) finished with an error (1): D:\Coding\JAVA\vaadin-boot-example-1jpm\mvnw.cmd at JPM.executeMaven(JPM.java:145) at ThisProject.main(JPM.java:89) Process finished with exit code 1 ```