From 386593f390fbb6f7db0fee6e2c26057a16b7ff95 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Wed, 1 Jul 2015 14:04:54 +0300 Subject: Make checkboxes immediate in tests. AudioTest was broken by the fix for #18102 as CheckBox is no longer immediate by default. Change-Id: Ic545359b6638814a2c7cf53abdb5ffc72cb5251e --- uitest/src/com/vaadin/tests/components/media/AudioTest.java | 4 ++++ uitest/src/com/vaadin/tests/tickets/Ticket1710.java | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/uitest/src/com/vaadin/tests/components/media/AudioTest.java b/uitest/src/com/vaadin/tests/components/media/AudioTest.java index c77583096d..1e1e26346c 100644 --- a/uitest/src/com/vaadin/tests/components/media/AudioTest.java +++ b/uitest/src/com/vaadin/tests/components/media/AudioTest.java @@ -50,15 +50,19 @@ public class AudioTest extends TestBase { CheckBox checkBox = new CheckBox("Show controls", new MethodProperty(audio, "showControls")); + checkBox.setImmediate(true); addComponent(checkBox); checkBox = new CheckBox("HtmlContentAllowed", new MethodProperty(audio, "htmlContentAllowed")); + checkBox.setImmediate(true); addComponent(checkBox); checkBox = new CheckBox("muted", new MethodProperty(audio, "muted")); + checkBox.setImmediate(true); addComponent(checkBox); checkBox = new CheckBox("autoplay", new MethodProperty(audio, "autoplay")); + checkBox.setImmediate(true); addComponent(checkBox); Button b = new Button("Change", new Button.ClickListener() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1710.java b/uitest/src/com/vaadin/tests/tickets/Ticket1710.java index e4687b6e37..3dda830607 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1710.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1710.java @@ -270,13 +270,17 @@ public class Ticket1710 extends com.vaadin.server.LegacyApplication { controls.addComponent(new Label("width")); controls.addComponent(new TextField(new MethodProperty( testedLayout, "width"))); - controls.addComponent(new CheckBox("%", - new MethodProperty(this, "widthPercents"))); + CheckBox widthPercentsCheckBox = new CheckBox("%", + new MethodProperty(this, "widthPercents")); + widthPercentsCheckBox.setImmediate(true); + controls.addComponent(widthPercentsCheckBox); controls.addComponent(new Label("height")); controls.addComponent(new TextField(new MethodProperty( testedLayout, "height"))); - controls.addComponent(new CheckBox("%", - new MethodProperty(this, "heightPercents"))); + CheckBox heightPercentsCheckBox = new CheckBox("%", + new MethodProperty(this, "heightPercents")); + heightPercentsCheckBox.setImmediate(true); + controls.addComponent(heightPercentsCheckBox); controls.addComponent(marginLeft); controls.addComponent(marginRight); controls.addComponent(marginTop); -- cgit v1.2.3 From bab0975e1288af9079780a030c439b0c2be832ac Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Wed, 1 Jul 2015 16:18:42 +0300 Subject: Migrate ComboBoxNoTextInput test from TB2 to TB4 Change-Id: I6e474b2306c6957d428117802ffda330b4809a6d --- .../components/combobox/ComboBoxNoTextInput.java | 46 +++++++++++++ .../combobox/ComboBoxNoTextInputTest.java | 61 ++++++++++++++++++ .../components/combobox/ComboBoxNoTextInput.html | 75 ---------------------- 3 files changed, 107 insertions(+), 75 deletions(-) create mode 100644 uitest/src/com/vaadin/tests/components/combobox/ComboBoxNoTextInput.java create mode 100644 uitest/src/com/vaadin/tests/components/combobox/ComboBoxNoTextInputTest.java delete mode 100644 uitest/tb2/com/vaadin/tests/components/combobox/ComboBoxNoTextInput.html diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxNoTextInput.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxNoTextInput.java new file mode 100644 index 0000000000..6b0e42666f --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxNoTextInput.java @@ -0,0 +1,46 @@ +/* + * 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.combobox; + +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.CheckBox; + +public class ComboBoxNoTextInput extends ComboBoxSelecting { + + @Override + protected void setup(VaadinRequest request) { + super.setup(request); + comboBox.setTextInputAllowed(true); + + final CheckBox textInputCheckBox = new CheckBox("Text Input", true); + textInputCheckBox.setId("textInput"); + textInputCheckBox.addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + comboBox.setTextInputAllowed(textInputCheckBox.getValue()); + } + }); + addComponent(textInputCheckBox); + } + + @Override + protected String getTestDescription() { + return "ComboBox should open popup on click when text input is not allowed."; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxNoTextInputTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxNoTextInputTest.java new file mode 100644 index 0000000000..cb4cd54559 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxNoTextInputTest.java @@ -0,0 +1,61 @@ +/* + * 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.combobox; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.commands.TestBenchElementCommands; +import com.vaadin.testbench.elements.CheckBoxElement; +import com.vaadin.testbench.elements.ComboBoxElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class ComboBoxNoTextInputTest extends MultiBrowserTest { + + @Test + public void testComboBoxNoTextInputPopupOpensOnClick() throws Exception { + openTestURL(); + + // deactivate text input + click($(CheckBoxElement.class).id("textInput")); + + // click and check that popup appears + ComboBoxElement cb = $(ComboBoxElement.class).first(); + click(cb); + // popup is opened lazily + waitForElementPresent(By.vaadin("//com.vaadin.ui.ComboBox[0]#popup")); + } + + @Test + public void testComboBoxWithTextInputNoPopupOpensOnClick() throws Exception { + openTestURL(); + + // click and check that no popup appears + ComboBoxElement cb = $(ComboBoxElement.class).first(); + click(cb); + // popup is opened lazily + sleep(1000); + Assert.assertFalse(cb.isElementPresent(By.vaadin("#popup"))); + } + + private void click(ComboBoxElement cb) throws Exception { + WebElement element = cb.findElement(By.vaadin("#textbox")); + ((TestBenchElementCommands) element).click(8, 7); + } + +} diff --git a/uitest/tb2/com/vaadin/tests/components/combobox/ComboBoxNoTextInput.html b/uitest/tb2/com/vaadin/tests/components/combobox/ComboBoxNoTextInput.html deleted file mode 100644 index 2066da47c1..0000000000 --- a/uitest/tb2/com/vaadin/tests/components/combobox/ComboBoxNoTextInput.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.components.combobox.ComboBoxes2?restartApplication
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxes2::PID_Smenu#item034,8
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxes2::Root/VOverlay[0]/VMenuBar[0]#item021,3
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxes2::Root/VOverlay[1]/VMenuBar[0]#item852,7
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxes2::PID_StestComponent/domChild[0]37,8
assertElementPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxes2::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item0
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxes2::PID_Smenu#item035,5
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxes2::Root/VOverlay[0]/VMenuBar[0]#item014,10
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxes2::Root/VOverlay[1]/VMenuBar[0]#item834,6
mouseClickvaadin=runcomvaadintestscomponentscomboboxComboBoxes2::PID_StestComponent/domChild[0]42,9
assertElementNotPresentvaadin=runcomvaadintestscomponentscomboboxComboBoxes2::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item0
- - -- cgit v1.2.3