diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/routing/PushRouteWildcardParameterView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/routing/PushRouteWildcardParameterView.java index 1878535edcb..20ef34cb13e 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/routing/PushRouteWildcardParameterView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/routing/PushRouteWildcardParameterView.java @@ -4,16 +4,20 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import com.vaadin.flow.component.PushConfiguration; import com.vaadin.flow.component.UI; import com.vaadin.flow.component.html.Div; import com.vaadin.flow.component.html.Span; -import com.vaadin.flow.component.page.Push; +import com.vaadin.flow.di.Lookup; +import com.vaadin.flow.osgi.OSGiMarker; import com.vaadin.flow.router.BeforeEvent; import com.vaadin.flow.router.HasUrlParameter; import com.vaadin.flow.router.Route; import com.vaadin.flow.router.WildcardParameter; +import com.vaadin.flow.server.VaadinService; +import com.vaadin.flow.shared.communication.PushMode; +import com.vaadin.flow.shared.ui.Transport; -@Push @Route("com.vaadin.flow.uitest.ui.routing.PushRouteWildcardParameterView") public class PushRouteWildcardParameterView extends Div implements HasUrlParameter { @@ -24,6 +28,19 @@ public class PushRouteWildcardParameterView extends Div public static final String LABEL_ID = "label"; private final Span label = new Span(); + public PushRouteWildcardParameterView() { + Lookup lookup = VaadinService.getCurrent().getContext() + .getAttribute(Lookup.class); + PushConfiguration pushConfiguration = UI.getCurrent() + .getPushConfiguration(); + pushConfiguration.setPushMode(PushMode.AUTOMATIC); + if (lookup.lookup(OSGiMarker.class) == null) { + pushConfiguration.setTransport(Transport.WEBSOCKET_XHR); + } else { + pushConfiguration.setTransport(Transport.LONG_POLLING); + } + } + @Override public void setParameter(BeforeEvent event, @WildcardParameter String parameter) { diff --git a/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/routing/PushRouteWildcardParameterIT.java b/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/routing/PushRouteWildcardParameterIT.java index 4141f52324b..a8e6b2a203a 100644 --- a/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/routing/PushRouteWildcardParameterIT.java +++ b/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/routing/PushRouteWildcardParameterIT.java @@ -2,14 +2,11 @@ import org.junit.Assert; import org.junit.Test; -import org.junit.experimental.categories.Category; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import com.vaadin.flow.testcategory.IgnoreOSGi; import com.vaadin.flow.testutil.ChromeBrowserTest; -@Category(IgnoreOSGi.class) public class PushRouteWildcardParameterIT extends ChromeBrowserTest { // #8968: Push connection with parameter containing slashes