summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-11-01 22:52:48 +0200
committerVaadin Code Review <review@vaadin.com>2016-11-03 06:49:34 +0000
commitf0544952ae3c77c789ac1053526e2ec383c39e80 (patch)
treec649a15aee4453a72c2be2e6fbf5b34892a09dd5 /uitest
parentd0221ce1c6ebe460ffa8074967aa6d0602b3cd42 (diff)
downloadvaadin-framework-f0544952ae3c77c789ac1053526e2ec383c39e80.tar.gz
vaadin-framework-f0544952ae3c77c789ac1053526e2ec383c39e80.zip
Show a sensible message for missing extensions (#10799)
Also remove ComponentMissingFromDefaultWidgetsetTest since it's identical to UnknownComponentConnectorTest Change-Id: I4b4b8f40c8376f4ea26b73d41191a3e7e811df01
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/extensions/UnknownExtensionHandling.java45
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/UnknownComponentConnectorTest.java2
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetsetTest.java40
-rw-r--r--uitest/src/test/java/com/vaadin/tests/extensions/UnknownExtensionHandlingTest.java58
4 files changed, 104 insertions, 41 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/extensions/UnknownExtensionHandling.java b/uitest/src/main/java/com/vaadin/tests/extensions/UnknownExtensionHandling.java
new file mode 100644
index 0000000000..9356ad2225
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/extensions/UnknownExtensionHandling.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.extensions;
+
+import com.vaadin.server.AbstractClientConnector;
+import com.vaadin.server.AbstractExtension;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Label;
+
+public class UnknownExtensionHandling extends AbstractTestUI {
+
+ // Extension without @Connect counterpart
+ public static class MyExtension extends AbstractExtension {
+ @Override
+ public void extend(AbstractClientConnector target) {
+ super.extend(target);
+ }
+ }
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Label label = new Label(
+ "A label with a missing extension, should cause sensible output in the debug window / browser console");
+
+ MyExtension extension = new MyExtension();
+ extension.extend(label);
+
+ addComponent(label);
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/tests/components/UnknownComponentConnectorTest.java b/uitest/src/test/java/com/vaadin/tests/components/UnknownComponentConnectorTest.java
index c734463180..d9dfee506d 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/UnknownComponentConnectorTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/UnknownComponentConnectorTest.java
@@ -32,7 +32,7 @@ public class UnknownComponentConnectorTest extends MultiBrowserTest {
openTestURL();
WebElement component = vaadinElementById("no-connector-component");
assertTrue(component.getText().startsWith(
- "Widgetset 'com.vaadin.DefaultWidgetSet' does not contain "
+ "Widgetset 'com.vaadin.DefaultWidgetSet' does not contain an "
+ "implementation for com.vaadin.tests.components.UnknownComponentConnector."
+ "ComponentWithoutConnector."));
}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetsetTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetsetTest.java
deleted file mode 100644
index 3a2600df6f..0000000000
--- a/uitest/src/test/java/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetsetTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.tests.components.ui;
-
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.openqa.selenium.WebElement;
-
-import com.vaadin.tests.tb3.MultiBrowserTest;
-
-/**
- * Test for testing if a component is missing from a widgetset.
- *
- * @author Vaadin Ltd
- */
-public class ComponentMissingFromDefaultWidgetsetTest extends MultiBrowserTest {
-
- @Test
- public void testComponentInTestingWidgetset() {
- openTestURL();
- WebElement component = vaadinElementById("missing-component");
- assertTrue(component.getText().startsWith(
- "Widgetset 'com.vaadin.DefaultWidgetSet' does not contain implementation for com.vaadin.tests.widgetset.server.MissingFromDefaultWidgetsetComponent."));
-
- }
-}
diff --git a/uitest/src/test/java/com/vaadin/tests/extensions/UnknownExtensionHandlingTest.java b/uitest/src/test/java/com/vaadin/tests/extensions/UnknownExtensionHandlingTest.java
new file mode 100644
index 0000000000..e16abf1f61
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/extensions/UnknownExtensionHandlingTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.extensions;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.extensions.UnknownExtensionHandling.MyExtension;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class UnknownExtensionHandlingTest extends SingleBrowserTest {
+
+ @Test
+ public void testUnknownExtensionHandling() {
+ setDebug(true);
+ openTestURL();
+
+ openDebugLogTab();
+
+ Assert.assertTrue(
+ hasMessageContaining(MyExtension.class.getCanonicalName()));
+
+ Assert.assertFalse(hasMessageContaining("Hierachy claims"));
+ }
+
+ private boolean hasMessageContaining(String needle) {
+ List<WebElement> elements = findElements(
+ By.className("v-debugwindow-message"));
+ for (WebElement messageElement : elements) {
+ // Can't use getText() since element isn't scrolled into view
+ String text = (String) executeScript(
+ "return arguments[0].textContent", messageElement);
+ if (text.contains(needle)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+}