No visible Dialog in MockedUI while Karibu Unit Testing

I am coding in Kotlin. I am trying to migrate my project from Vaadin 22 to Vaadin 23.3. I am using Karibu Testing 1.3.23 for Vaadin Unit Testing.

When I try to: val dialog = _get<Dialog>() in my unit tests, I get the following error: java.lang.AssertionError: /: No visible Dialog in MockedUI["<description_of_mocked_UI>"] matching Dialog: []. Component tree.

From my investigation so far, I understood that my Unit Tests throws an Assertion Error at the the following Karibu function: public fun <T: Component> Component._find(clazz: Class<T>, block: SearchSpec<T>.()->Unit = {}): List<T> after a certain number of iterations.

Any ideas about this? This is my first time working on Karibu Testing.

No visible Dialog in MockedUI while Karibu Unit Testing

This means that there is no Dialog. Karibu prints out the whole component tree there you can see how the UI looked when the error happend

Would you mind checking it out with me? Because I am not able to fully understand it and debug it.

The output says a test is failing because there’s no visible Dialog. This in itself doesn’t say much, because it’s only stating the absence of something. If you test the same scenario manually, is there a dialog there?

By testing the same scenario manually, do you mean writing a script that creates a dialog and shows it on localhost? If yes, I am working on that now.

No I mean operating the UI in a browser

Isn"t that the same thing I proposed above? Creating a dialog, add it to the AppLayout, and see the results on localhost on a browser. If you mean something else, would you mind explaining further please?

I was not able to operate the UI in a browser. I tried different ways, and it kept on showing me this error, which is not trackable. :/
image.png

The server logs might hold more information

Hi. If this is what you mean with server logs, I don’t see useful information to be honest. If not, could you guide me on how to get the server logs? Thanks
image.png

message.txt (4.24 KB)

The one thing I’m missing in that log is something about Vaadin running in either production or development mode

As a comparison, here’s what I get on the log when I start a Spring Boot Vaadin 23 production mode application:

2023-07-14 14:36:27.767  INFO 10856 --- [           main] org.vaadin.example.Application           : No active profile set, falling back to 1 default profile: "default"
2023-07-14 14:36:29.086  INFO 10856 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2023-07-14 14:36:29.097  INFO 10856 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-07-14 14:36:29.097  INFO 10856 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.74]
2023-07-14 14:36:29.199  INFO 10856 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-07-14 14:36:29.199  INFO 10856 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1363 ms
2023-07-14 14:36:29.387  INFO 10856 --- [           main] c.v.f.s.VaadinServletContextInitializer  : Search for VaadinAppShell took 27 ms
2023-07-14 14:36:30.041  INFO 10856 --- [           main] c.v.f.s.DefaultDeploymentConfiguration   : Vaadin is running in production mode.
2023-07-14 14:36:30.106  INFO 10856 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2023-07-14 14:36:30.119  INFO 10856 --- [           main] org.vaadin.example.Application           : Started Application in 2.863 seconds (JVM running for 3.408)

And in development mode, it should show at least

2023-07-14 14:54:08.984  INFO 13748 --- [  restartedMain] c.v.f.s.DefaultDeploymentConfiguration   : 
Vaadin is running in DEVELOPMENT mode - do not use for production deployments.

That’s weird indeed. I will try to investigate the reason of the absence of the mode in my server log.

I just understood what is meant with both modes.
I suppose I am using development mode since I am running the application through Intellij’s run button. In addition, I run it through ./gradlew command, but I suppose that’s development mode also.

Good morning everbody. Any ideas on how to correct this error? I have been stuck for a week now.

You should probably provide some snippet of application and test code, especially where the dialog is opened and how do you test for it

My unit test literally stops at the first line (creation of a Dialog) and generates the above error.
The project code itself is quite huge and contains hundreds of classes and thousands of lines.
image.png