Skip to content

Commit

Permalink
test: allow remote connection to debug window (#143)
Browse files Browse the repository at this point in the history
Prevents error logs on browser console that make some test fail
  • Loading branch information
mcollovati authored Nov 30, 2023
1 parent 4eb35f9 commit 8595c07
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
import java.util.Arrays;
import java.util.List;

import com.vaadin.flow.testcategory.ChromeTests;
import com.vaadin.flow.testutil.ChromeBrowserTest;
import com.vaadin.testbench.annotations.BrowserConfiguration;
import com.vaadin.testbench.parallel.Browser;
import com.vaadin.testbench.parallel.BrowserUtil;
import io.quarkus.test.common.QuarkusTestResource;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
Expand All @@ -11,19 +17,14 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.openqa.selenium.remote.DesiredCapabilities;

import com.vaadin.flow.testcategory.ChromeTests;
import com.vaadin.flow.testutil.ChromeBrowserTest;
import com.vaadin.testbench.annotations.BrowserConfiguration;
import com.vaadin.testbench.parallel.Browser;
import com.vaadin.testbench.parallel.BrowserUtil;

/**
* Simplified chrome test that doesn't handle view/IT class paths. Uses Jupiter
* API
*/
@Category(ChromeTests.class)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@ExtendWith(ScreenshotsOnFailureExtension.class)
@ExtendWith({ ScreenshotsOnFailureExtension.class })
@QuarkusTestResource(VaadinSystemPropertiesPropagator.class)
public abstract class AbstractChromeIT extends ChromeBrowserTest {

@AfterEach
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.vaadin.flow.test;

import java.util.HashMap;
import java.util.Map;

import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;

/**
* Propagates all Vaadin related system properties to Quarkus test.
*/
public class VaadinSystemPropertiesPropagator
implements QuarkusTestResourceLifecycleManager {

@Override
public Map<String, String> start() {
Map<String, String> props = new HashMap<>();
System.getProperties().stringPropertyNames().stream()
.filter(key -> key.startsWith("vaadin."))
.forEach(key -> props.put(key, System.getProperty(key)));
return props;
}

@Override
public void stop() {
}
}
5 changes: 5 additions & 0 deletions integration-tests/development/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<vaadin.devmode.hostsAllowed>*</vaadin.devmode.hostsAllowed>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
Expand Down

0 comments on commit 8595c07

Please sign in to comment.