diff --git a/pom.xml b/pom.xml index dc4e2f1..a5961c3 100644 --- a/pom.xml +++ b/pom.xml @@ -204,7 +204,7 @@ Guava conflict forces not to use Reflections in ApplicationServiceInitListener.j 9966 STOP - + start-jetty pre-integration-test @@ -237,7 +237,6 @@ Guava conflict forces not to use Reflections in ApplicationServiceInitListener.j prepare-frontend - build-frontend diff --git a/src/test/java/org/vaadin/textfieldformatter/AbstractTest.java b/src/test/java/org/vaadin/textfieldformatter/AbstractTest.java index 463c8ea..7a0cff8 100644 --- a/src/test/java/org/vaadin/textfieldformatter/AbstractTest.java +++ b/src/test/java/org/vaadin/textfieldformatter/AbstractTest.java @@ -6,7 +6,7 @@ import com.vaadin.flow.component.orderedlayout.VerticalLayout; import com.vaadin.flow.router.Route; -@Route(registerAtStartup = false) +@Route(layout = MainView.class) public abstract class AbstractTest extends VerticalLayout { public AbstractTest() { diff --git a/src/test/java/org/vaadin/textfieldformatter/ApplicationServiceInitListener.java b/src/test/java/org/vaadin/textfieldformatter/ApplicationServiceInitListener.java deleted file mode 100644 index fac8ba0..0000000 --- a/src/test/java/org/vaadin/textfieldformatter/ApplicationServiceInitListener.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.vaadin.textfieldformatter; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Set; - -import com.vaadin.flow.router.RouteConfiguration; -import com.vaadin.flow.router.RouterLayout; -import com.vaadin.flow.server.ServiceInitEvent; -import com.vaadin.flow.server.VaadinServiceInitListener; - -public class ApplicationServiceInitListener implements VaadinServiceInitListener { - - @Override - public void serviceInit(ServiceInitEvent event) { - ArrayList> parent = new ArrayList>(); - parent.add(MainLayout.class); - - // Reflections reflections = new Reflections("org.vaadin.textfieldformatter"); - - // Set> allTestUIs = - // reflections.getSubTypesOf(AbstractTest.class); - - Set> allTestUIs = new HashSet<>(); - - allTestUIs.add(BasicCreditCardFieldFormatterUsageUI.class); - allTestUIs.add(BasicIBANFormatterUsageUI.class); - allTestUIs.add(BasicPhoneFieldFormatterUsageUI.class); - allTestUIs.add(CSBFDelimitersUI.class); - allTestUIs.add(CSBFNumericAndPrefixUI.class); - allTestUIs.add(CSBFNumericAndPrefixWithBlocksUI.class); - allTestUIs.add(CSBFNumericAndPrefixWithBuilderUI.class); - allTestUIs.add(CSBFNumericOnlyUI.class); - allTestUIs.add(CSBFReplacingMaskUI.class); - allTestUIs.add(CustomNumeralFieldFormatterUsageUI.class); - allTestUIs.add(DefaultNumeralFieldFormatterUsageUI.class); - - for (Class test : allTestUIs) { - if (!RouteConfiguration.forApplicationScope().isPathRegistered(test.getSimpleName())) { - RouteConfiguration.forApplicationScope().setRoute(test.getSimpleName(), test, parent); - } - } - } - -} diff --git a/src/test/java/org/vaadin/textfieldformatter/MainLayout.java b/src/test/java/org/vaadin/textfieldformatter/MainView.java similarity index 92% rename from src/test/java/org/vaadin/textfieldformatter/MainLayout.java rename to src/test/java/org/vaadin/textfieldformatter/MainView.java index bfcd89a..bd559ae 100644 --- a/src/test/java/org/vaadin/textfieldformatter/MainLayout.java +++ b/src/test/java/org/vaadin/textfieldformatter/MainView.java @@ -12,14 +12,14 @@ import com.vaadin.flow.theme.Theme; import com.vaadin.flow.theme.lumo.Lumo; -@Route("") +@Route @Theme(Lumo.class) -public class MainLayout extends HorizontalLayout implements RouterLayout { +public class MainView extends HorizontalLayout implements RouterLayout { private VerticalLayout menu; private HasElement content; - public MainLayout() { + public MainView() { menu = new VerticalLayout(); menu.setSpacing(true); menu.setMargin(true); diff --git a/src/test/java/org/vaadin/textfieldformatter/it/AbstractCustomTestBenchTestCase.java b/src/test/java/org/vaadin/textfieldformatter/it/AbstractCustomTestBenchTestCase.java index 5519baf..81375a8 100644 --- a/src/test/java/org/vaadin/textfieldformatter/it/AbstractCustomTestBenchTestCase.java +++ b/src/test/java/org/vaadin/textfieldformatter/it/AbstractCustomTestBenchTestCase.java @@ -1,17 +1,21 @@ package org.vaadin.textfieldformatter.it; -import org.junit.After; +import org.junit.Rule; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.vaadin.textfieldformatter.AbstractTest; +import com.vaadin.testbench.ScreenshotOnFailureRule; import com.vaadin.testbench.TestBenchTestCase; public abstract class AbstractCustomTestBenchTestCase extends TestBenchTestCase { protected static final int TESTPORT = 8080; protected static final String BASEURL = "http://localhost:" + TESTPORT + "/"; + @Rule + public ScreenshotOnFailureRule screenshotOnFailure = new ScreenshotOnFailureRule(this, true); + public AbstractCustomTestBenchTestCase() { super(); } @@ -34,13 +38,6 @@ protected void startBrowser(WebDriver driver) { } protected void openUI(Class testClass) { - driver.navigate().to(BASEURL + testClass.getSimpleName()); - } - - @After - public void teardown() { - if (driver != null) { - driver.quit(); - } + driver.get(BASEURL + testClass.getSimpleName().toLowerCase()); } } diff --git a/src/test/resources/META-INF/services/com.vaadin.flow.server.VaadinServiceInitListener b/src/test/resources/META-INF/services/com.vaadin.flow.server.VaadinServiceInitListener deleted file mode 100644 index 739686e..0000000 --- a/src/test/resources/META-INF/services/com.vaadin.flow.server.VaadinServiceInitListener +++ /dev/null @@ -1 +0,0 @@ -org.vaadin.textfieldformatter.ApplicationServiceInitListener \ No newline at end of file diff --git a/webdrivers.xml b/webdrivers.xml index f142fcd..839f4a0 100644 --- a/webdrivers.xml +++ b/webdrivers.xml @@ -2,10 +2,10 @@ - + - http://chromedriver.storage.googleapis.com/74.0.3729.6/chromedriver_win32.zip - fbc10cbc20da67246e2da89c4763a2fb2671ee71 + http://chromedriver.storage.googleapis.com/76.0.3809.126/chromedriver_win32.zip + 4b673be1bce27e9177e42027ba08a54b704270fd sha1 @@ -13,10 +13,10 @@ - + - https://chromedriver.storage.googleapis.com/74.0.3729.6/chromedriver_linux64.zip - 848a3689d5846eb1b2d5e0d745bb5adf655430ae + https://chromedriver.storage.googleapis.com/76.0.3809.126/chromedriver_linux64.zip + 632683aa20c8af87a06ae8a87c915c0b4dfcf89b sha1 @@ -24,10 +24,10 @@ - + - https://chromedriver.storage.googleapis.com/74.0.3729.6/chromedriver_mac64.zip - d13d083807beb828694045fd56a99cf4a605060d + https://chromedriver.storage.googleapis.com/76.0.3809.126/chromedriver_mac64.zip + f7e417258e9eb8b405dfb782346d7aa3380fde97 sha1