]> source.dussan.org Git - vaadin-framework.git/commitdiff
Correct addon init param widgetset IT test.
authorDenis Anisimov <denis@vaadin.com>
Mon, 7 Nov 2016 14:31:59 +0000 (16:31 +0200)
committerDenis Anisimov <denis@vaadin.com>
Mon, 7 Nov 2016 14:31:59 +0000 (16:31 +0200)
Change-Id: I413481a325ebad15aa16dd639c788cc72f18dc52

test/addon-using-init-param-widget-set/src/test/java/com/vaadin/test/addonusinginitparamwidgetset/AddonUsingInitParamWidgetSetIT.java
test/widget-set-testutil/src/test/java/com/vaadin/test/defaultwidgetset/AbstractWidgetSetIT.java

index f11034c8efa48c42b74ed11edd9576f409e8720a..18b0069eb2fcb19f4cfa0613483cd7f2333785b0 100644 (file)
@@ -8,8 +8,9 @@ public class AddonUsingInitParamWidgetSetIT extends AbstractWidgetSetIT {
 
     @Test
     public void appStartsUserCanInteract() {
-        testAppStartsUserCanInteract("com.vaadin.DefaultWidgetSet");
-        assertUnknownComponentShown("com.vaadin.addon.contextmenu.ContextMenu");
+        testAppStartsUserCanInteract("com.vaadin.DefaultWidgetSet", true);
+        assertHasDebugMessage(
+                "does not contain an implementation for com.vaadin.addon.contextmenu.ContextMenu");
     }
 
 }
index d29828158b4ed0bf8885780b1f74a69e17cd7bea..c6d4f1756b33e9923012c15b3feee33157c66e9a 100644 (file)
@@ -1,5 +1,7 @@
 package com.vaadin.test.defaultwidgetset;
 
+import java.util.List;
+
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Rule;
@@ -26,7 +28,16 @@ public abstract class AbstractWidgetSetIT extends TestBenchTestCase {
     }
 
     protected void testAppStartsUserCanInteract(String expectedWidgetSet) {
-        getDriver().get("http://localhost:8080");
+        testAppStartsUserCanInteract(expectedWidgetSet, false);
+    }
+
+    protected void testAppStartsUserCanInteract(String expectedWidgetSet,
+            boolean debug) {
+        String url = "http://localhost:8080";
+        if (debug) {
+            url += "?debug";
+        }
+        getDriver().get(url);
 
         TextFieldElement nameInput = $(TextFieldElement.class).first();
         nameInput.setValue("John Dåe");
@@ -56,4 +67,19 @@ public abstract class AbstractWidgetSetIT extends TestBenchTestCase {
                 "does not contain implementation for " + componentClass));
     }
 
+    protected void assertHasDebugMessage(String message) {
+        List<WebElement> elements = getDriver().findElements(
+                By.xpath("//span[@class='v-debugwindow-message']"));
+        boolean found = false;
+        for (WebElement element : elements) {
+            if (element.getText().contains(message)) {
+                found = true;
+                break;
+            }
+        }
+        Assert.assertTrue(
+                "Cannot find debug message containing '" + message + "'",
+                found);
+    }
+
 }