summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-11-01 22:52:48 +0200
committerPekka Hyvönen <pekka@vaadin.com>2016-12-09 09:39:00 +0200
commitcbbd1710fe1a72a841860fedeb274007ebf7ec3b (patch)
tree64cd436b0bfcb33d02dbc235e74406fb08bae0c5 /uitest
parente4af2f2a319b9e4d683ca6286ede423629e5bf52 (diff)
downloadvaadin-framework-cbbd1710fe1a72a841860fedeb274007ebf7ec3b.tar.gz
vaadin-framework-cbbd1710fe1a72a841860fedeb274007ebf7ec3b.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.java39
-rw-r--r--uitest/src/test/java/com/vaadin/tests/extensions/UnknownExtensionHandlingTest.java58
3 files changed, 142 insertions, 0 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
new file mode 100644
index 0000000000..d9dfee506d
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/UnknownComponentConnectorTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that a user is notified about a missing component from the widgetset
+ */
+public class UnknownComponentConnectorTest extends MultiBrowserTest {
+
+ @Test
+ public void testConnectorNotFoundInWidgetset() throws Exception {
+ openTestURL();
+ WebElement component = vaadinElementById("no-connector-component");
+ assertTrue(component.getText().startsWith(
+ "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/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;
+ }
+
+}