From d8aecac1b300c2223bedc65a0040af6bfc8edd44 Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 28 Dec 2016 17:29:53 +0200 Subject: Provide a smoke test for a Form. Fixes vaadin/framework8-issues#585 --- .../java/com/vaadin/tests/smoke/FormSmoke.java | 58 +++++++++++++++++++++ .../v7/tests/components/form/FormTooltips.java | 58 --------------------- .../java/com/vaadin/tests/smoke/FormSmokeTest.java | 60 ++++++++++++++++++++++ .../v7/tests/components/form/FormTooltipsTest.java | 60 ---------------------- 4 files changed, 118 insertions(+), 118 deletions(-) create mode 100644 uitest/src/main/java/com/vaadin/tests/smoke/FormSmoke.java delete mode 100644 uitest/src/main/java/com/vaadin/v7/tests/components/form/FormTooltips.java create mode 100644 uitest/src/test/java/com/vaadin/tests/smoke/FormSmokeTest.java delete mode 100644 uitest/src/test/java/com/vaadin/v7/tests/components/form/FormTooltipsTest.java diff --git a/uitest/src/main/java/com/vaadin/tests/smoke/FormSmoke.java b/uitest/src/main/java/com/vaadin/tests/smoke/FormSmoke.java new file mode 100644 index 0000000000..295dc6596f --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/smoke/FormSmoke.java @@ -0,0 +1,58 @@ +/* + * Copyright 2012 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.smoke; + +import java.util.Arrays; + +import com.vaadin.server.UserError; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractReindeerTestUI; +import com.vaadin.tests.data.bean.Person; +import com.vaadin.tests.data.bean.Sex; +import com.vaadin.v7.data.util.BeanItem; +import com.vaadin.v7.ui.Form; +import com.vaadin.v7.ui.TextField; + +public class FormSmoke extends AbstractReindeerTestUI { + + @Override + protected void setup(VaadinRequest request) { + final Form form = new Form(); + form.setId("tooltipForm"); + form.setDescription("Some description"); + form.setItemDataSource( + new BeanItem<>( + new Person("foo", "bar", "baz", 12, Sex.MALE, null)), + Arrays.asList(new String[] { "firstName", "lastName", "age" })); + ((TextField) form.getField("firstName")) + .setDescription("Fields own tooltip"); + + form.setComponentError(new UserError("Form error")); + addComponent(form); + + } + + @Override + protected String getTestDescription() { + return "The 'first name' should show its own tooltip, the other fields should show no tooltip"; + } + + @Override + protected Integer getTicketNumber() { + return 9173; + } + +} diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/form/FormTooltips.java b/uitest/src/main/java/com/vaadin/v7/tests/components/form/FormTooltips.java deleted file mode 100644 index 78d26dd7ac..0000000000 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/form/FormTooltips.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2012 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.v7.tests.components.form; - -import java.util.Arrays; - -import com.vaadin.server.UserError; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractReindeerTestUI; -import com.vaadin.tests.data.bean.Person; -import com.vaadin.tests.data.bean.Sex; -import com.vaadin.v7.data.util.BeanItem; -import com.vaadin.v7.ui.Form; -import com.vaadin.v7.ui.TextField; - -public class FormTooltips extends AbstractReindeerTestUI { - - @Override - protected void setup(VaadinRequest request) { - final Form form = new Form(); - form.setId("tooltipForm"); - form.setDescription("Some description"); - form.setItemDataSource( - new BeanItem<>( - new Person("foo", "bar", "baz", 12, Sex.MALE, null)), - Arrays.asList(new String[] { "firstName", "lastName", "age" })); - ((TextField) form.getField("firstName")) - .setDescription("Fields own tooltip"); - - form.setComponentError(new UserError("Form error")); - addComponent(form); - - } - - @Override - protected String getTestDescription() { - return "The 'first name' should show its own tooltip, the other fields should show no tooltip"; - } - - @Override - protected Integer getTicketNumber() { - return 9173; - } - -} diff --git a/uitest/src/test/java/com/vaadin/tests/smoke/FormSmokeTest.java b/uitest/src/test/java/com/vaadin/tests/smoke/FormSmokeTest.java new file mode 100644 index 0000000000..f5916f11bb --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/smoke/FormSmokeTest.java @@ -0,0 +1,60 @@ +/* + * Copyright 2000-2013 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.smoke; + +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.FormElement; +import com.vaadin.testbench.elements.TextFieldElement; +import com.vaadin.tests.tb3.TooltipTest; + +public class FormSmokeTest extends TooltipTest { + + @Test + public void testTooltipConfiguration() throws Exception { + openTestURL(); + // first name tooltip + + WebElement fieldElement = $(FormElement.class).first() + .$(TextFieldElement.class).first(); + checkTooltip(fieldElement, "Fields own tooltip"); + clearTooltip(); + checkTooltipNotPresent(); + + // first name caption tooltip + checkTooltip($(FormElement.class).first() + .findElement(By.className("v-caption")), "Fields own tooltip"); + + clearTooltip(); + checkTooltipNotPresent(); + + // Form should not have a description tooltip + checkTooltip($(FormElement.class).first(), null); + + // Form error message should not have a tooltip + checkTooltip(By.className("v-form-errormessage"), null); + + // last name should have no tooltip + checkTooltip($(TextFieldElement.class).get(1), null); + + // last name caption should have no tooltip + checkTooltip($(FormElement.class).first() + .findElements(By.className("v-caption")).get(1), null); + } + +} diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/form/FormTooltipsTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/form/FormTooltipsTest.java deleted file mode 100644 index cc4f0bd532..0000000000 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/form/FormTooltipsTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2000-2013 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.v7.tests.components.form; - -import org.junit.Test; -import org.openqa.selenium.WebElement; - -import com.vaadin.testbench.By; -import com.vaadin.testbench.elements.FormElement; -import com.vaadin.testbench.elements.TextFieldElement; -import com.vaadin.tests.tb3.TooltipTest; - -public class FormTooltipsTest extends TooltipTest { - - @Test - public void testTooltipConfiguration() throws Exception { - openTestURL(); - // first name tooltip - - WebElement fieldElement = $(FormElement.class).first() - .$(TextFieldElement.class).first(); - checkTooltip(fieldElement, "Fields own tooltip"); - clearTooltip(); - checkTooltipNotPresent(); - - // first name caption tooltip - checkTooltip($(FormElement.class).first() - .findElement(By.className("v-caption")), "Fields own tooltip"); - - clearTooltip(); - checkTooltipNotPresent(); - - // Form should not have a description tooltip - checkTooltip($(FormElement.class).first(), null); - - // Form error message should not have a tooltip - checkTooltip(By.className("v-form-errormessage"), null); - - // last name should have no tooltip - checkTooltip($(TextFieldElement.class).get(1), null); - - // last name caption should have no tooltip - checkTooltip($(FormElement.class).first() - .findElements(By.className("v-caption")).get(1), null); - } - -} -- cgit v1.2.3