mvysny / karibu-testing

Vaadin Server-Side Browserless Containerless Unit Testing
Apache License 2.0
105 stars 14 forks source link

Using Karibu together with Testbench in a pure Vaadin Flow App #78

Closed satorstefan closed 2 years ago

satorstefan commented 3 years ago

Dear Martin,

I would like to use Karibu together with Testbench, but during test execution this exception is thrown:

java.lang.IllegalStateException: Polymer 3 webjar is on the classpath, indicating compatibility mode:

jar:file:/C:/Users/stefan.sator/.m2/repository/org/webjars/bowergithub/polymer/polymer/2.7.0/polymer-2.7.0.jar!/META-INF/resources/webjars/polymer/polymer.html. Karibu-Testing 1.2.x doesn't support Vaadin 14 Compatibility mode; please use Karibu-Testing 1.1.x instead. Alternatively, if you're not using compatibility mode, please exclude all webjars from your vaadin/vaadin-core dependency; please see the Skeleton Starter or Karibu10-helloworld-app on how to do that.

at com.github.mvysny.kaributesting.v10.VaadinMeta.checkNotVaadin14CompatMode(VaadinVersion.kt:122)
at com.github.mvysny.kaributesting.v10.VaadinMeta.isCompatibilityMode(VaadinVersion.kt:97)
at com.github.mvysny.kaributesting.v10.MockVaadin.setup(MockVaadin.kt:78)
at de.hahnunternehmensberatung.domain.main.ApplicationTest.setup(ApplicationTest.java:57)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at 

This can be fixed be changing the pom like this and thereby remove the polymer jar: `

com.vaadin
        <artifactId>vaadin-testbench</artifactId>
        <!-- <exclusions>
        <exclusion>
            <groupId>*</groupId>
            <artifactId>polymer</artifactId>
        </exclusion>
        </exclusions> -->
        <scope>test</scope>
    </dependency>`

But I suppose that Testbench will not work any longer.

Can you give me any hints what could be possible solutions to this? The app is a pure Flow app based on the vaadin starter.

If I understand this correct then polymer should be removed or is already removed on newer vaadin version. Maybe I just should update?

Currently I used: `14.6.5</vaadin.version>

com.vaadin
    <artifactId>vaadin-testbench</artifactId>
    <version>14.6.5</version>

`

Best regards Stefan

mvysny commented 3 years ago

Hi Stefan, i think testbench should not depend on the polymer library and thus excluding polymer should not affect the testbench itself. Also polymer webjar was the old way of creating vaadin apps and is not used anymore, so it should be completely safe to exclude polymer. I can take a look at some point, but I'm on a vacation right now and trying to stay away from the computer 😁

mvysny commented 2 years ago

There is a demo project for TestBench here: https://github.com/mvysny/testbench-simplest-demo unfortunately it's for Vaadin 8 and doesn't use Karibu-Testing. I can add KT there; and also I can create a Vaadin14 version of the project and also use TB and KT there as well, but it has to wait until the end of this month.

mvysny commented 2 years ago

I've created the https://github.com/mvysny/testbench-simplest-demo-14 example project which demoes both TestBench and Karibu-Testing in the same project, please take a look and let me know what you think :+1:

satorstefan commented 2 years ago

Hello Martin,

I switched to Vaadin 20 already and therefor will not check this because I dont need it any longer.

Is your vacation already over?

Best regards Stefan


Von: Martin Vysny @.> Gesendet: Montag, 26. Juli 2021 13:35 An: mvysny/karibu-testing @.> Cc: satorstefan @.>; Author @.> Betreff: Re: [mvysny/karibu-testing] Using Karibu together with Testbench in a pure Vaadin Flow App (#78)

I've created the https://github.com/mvysny/testbench-simplest-demo-14https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmvysny%2Ftestbench-simplest-demo-14&data=04%7C01%7C%7C82c311b2cc8342c63e8808d950298470%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637628961501658183%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Pu8dePw%2F7aUOX4QMUbHu3xBh4uPpnnJy0Ah%2FzT6fYy8%3D&reserved=0 example project which demoes both TestBench and Karibu-Testing in the same project, please take a look and let me know what you think 👍

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmvysny%2Fkaribu-testing%2Fissues%2F78%23issuecomment-886624139&data=04%7C01%7C%7C82c311b2cc8342c63e8808d950298470%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637628961501668141%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=PEvFG%2BskRfUgpHEE8OE8O3jRnUBsUCw9t8czdNCPlKo%3D&reserved=0, or unsubscribehttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGDJJ4HUQQT6S242LC65ACDTZVCBJANCNFSM474FFVCA&data=04%7C01%7C%7C82c311b2cc8342c63e8808d950298470%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637628961501668141%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2BODfl5Xci1BCiTcTcqf0m7%2FXQCtADV37zWFvC2PO2Bk%3D&reserved=0.