aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test
diff options
context:
space:
mode:
authorDenis Anisimov <denis@vaadin.com>2016-11-24 18:15:27 +0300
committerVaadin Code Review <review@vaadin.com>2016-11-25 13:18:22 +0000
commit98366af1e2703f0606d231a43b32f768e88c1f70 (patch)
tree8487fdf90762bf55c2976eca1f50cf14ffb3a1c8 /uitest/src/test
parentd37b2d430eca6b0eeacb48626c0bbfb33d1502de (diff)
downloadvaadin-framework-98366af1e2703f0606d231a43b32f768e88c1f70.tar.gz
vaadin-framework-98366af1e2703f0606d231a43b32f768e88c1f70.zip
Provide tests for "required indicator" property for options groups.
Fixes vaadin/framework8-issues#459 This is not a fix because the issue is about AL only and it's by design. But this patch provides tests for CheckBoxGroup and RadioButtonGroup. Change-Id: I8d43ab435327478c7199b8b0a7739d6d1064c822
Diffstat (limited to 'uitest/src/test')
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/HasValueRequiredIndicatorTest.java55
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupRequiredIndicatorTest.java29
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupRequiredIndicatorTest.java29
3 files changed, 113 insertions, 0 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/HasValueRequiredIndicatorTest.java b/uitest/src/test/java/com/vaadin/tests/components/HasValueRequiredIndicatorTest.java
new file mode 100644
index 0000000000..09c4572526
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/HasValueRequiredIndicatorTest.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2000-2016 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 java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Point;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * @author Vaadin Ltd
+ *
+ */
+public abstract class HasValueRequiredIndicatorTest extends MultiBrowserTest {
+
+ @Test
+ public void requiredIndicatorVisible() {
+ openTestURL();
+ List<WebElement> layouts = findElements(By.className("vaadin-layout"));
+ Assert.assertTrue(layouts.size() > 0);
+ layouts.stream().forEach(this::checkRequiredIndicator);
+ }
+
+ protected void checkRequiredIndicator(WebElement layout) {
+ WebElement caption = layout.findElement(By.className("v-caption"));
+ Assert.assertTrue(caption.isDisplayed());
+ WebElement indicator = caption
+ .findElement(By.className("v-required-field-indicator"));
+ Assert.assertTrue(indicator.isDisplayed());
+ Point layoutLocation = layout.getLocation();
+ Point indicatorLocation = indicator.getLocation();
+ Assert.assertTrue("Indicator x-axis location is not inside layout",
+ indicatorLocation.getX() >= layoutLocation.getX());
+ Assert.assertTrue("Indicator y-axis location is not inside layout",
+ indicatorLocation.getY() >= layoutLocation.getY());
+ }
+}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupRequiredIndicatorTest.java b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupRequiredIndicatorTest.java
new file mode 100644
index 0000000000..8ec52b630a
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupRequiredIndicatorTest.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2000-2016 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.checkboxgroup;
+
+import com.vaadin.tests.components.HasValueRequiredIndicatorTest;
+
+/**
+ * The test logic is in the superclass.
+ *
+ * @author Vaadin Ltd
+ *
+ */
+public class CheckBoxGroupRequiredIndicatorTest
+ extends HasValueRequiredIndicatorTest {
+
+}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupRequiredIndicatorTest.java b/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupRequiredIndicatorTest.java
new file mode 100644
index 0000000000..bb1a1ba1d9
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupRequiredIndicatorTest.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2000-2016 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.radiobuttongroup;
+
+import com.vaadin.tests.components.HasValueRequiredIndicatorTest;
+
+/**
+ * The tests are in the superclass.
+ *
+ * @author Vaadin Ltd
+ *
+ */
+public class RadioButtonGroupRequiredIndicatorTest
+ extends HasValueRequiredIndicatorTest {
+
+}