diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-04-15 11:06:18 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-04-15 14:00:58 +0300 |
commit | 6b8412033e680ce6e5c7827ac504adf132305726 (patch) | |
tree | 0df05d16c324b285610af8910c126b58f4c490c5 /uitest/src/com/vaadin/tests/tooltip | |
parent | 9192b0bb5e5e699b506b3d3e7df4cf295fbea44a (diff) | |
download | vaadin-framework-6b8412033e680ce6e5c7827ac504adf132305726.tar.gz vaadin-framework-6b8412033e680ce6e5c7827ac504adf132305726.zip |
Build uitest war with maven
Change-Id: I32625901ca27a282253df44c6e776cf9632bacda
Diffstat (limited to 'uitest/src/com/vaadin/tests/tooltip')
25 files changed, 0 insertions, 1437 deletions
diff --git a/uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltips.java b/uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltips.java deleted file mode 100644 index 60167e43b4..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltips.java +++ /dev/null @@ -1,82 +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.tooltip; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.TooltipConfiguration; - -/** - * When moving between adjacent elements, the tooltip replace should obey - * quickOpenDelay - * - * @author Vaadin Ltd - */ -public class AdjacentElementsWithTooltips extends AbstractTestUI { - - private int buttonCount = 0; - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. - * VaadinRequest) - */ - @Override - protected void setup(VaadinRequest request) { - TooltipConfiguration ttc = super.getTooltipConfiguration(); - ttc.setMaxWidth(350); - ttc.setOpenDelay(200); - ttc.setCloseTimeout(200); - ttc.setQuickOpenDelay(1000); - ttc.setQuickOpenTimeout(1000); - HorizontalLayout layout = new HorizontalLayout(); - layout.addComponent(makeButton("first")); - layout.addComponent(makeButton("second")); - addComponent(layout); - - } - - private Component makeButton(String tooltip) { - Button button = new Button("Button " + buttonCount++); - button.setDescription(tooltip); - return button; - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() - */ - @Override - protected String getTestDescription() { - return "Moving between adjacent elements with tooltips should open quickOpenDelay"; - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() - */ - @Override - protected Integer getTicketNumber() { - return 13998; - } - -} diff --git a/uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java b/uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java deleted file mode 100644 index af7a303629..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java +++ /dev/null @@ -1,74 +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.tooltip; - -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.lessThan; -import static org.junit.Assert.assertThat; - -import java.util.List; - -import org.junit.Test; -import org.openqa.selenium.interactions.HasInputDevices; -import org.openqa.selenium.interactions.Mouse; -import org.openqa.selenium.interactions.internal.Coordinates; -import org.openqa.selenium.internal.Locatable; -import org.openqa.selenium.remote.DesiredCapabilities; - -import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.tests.tb3.MultiBrowserTest; - -/** - * Test to see if tooltips obey quickOpenDelay when moving between directly - * adjacent elements. - * - * @author Vaadin Ltd - */ -public class AdjacentElementsWithTooltipsTest extends MultiBrowserTest { - - @Override - public List<DesiredCapabilities> getBrowsersToTest() { - return getBrowsersExcludingIE(); - } - - @Test - public void tooltipsHaveQuickOpenDelay() throws InterruptedException { - openTestURL(); - Coordinates button0Coordinates = getButtonCoordinates("Button 0"); - Coordinates button1Coordinates = getButtonCoordinates("Button 1"); - - Mouse mouse = getMouse(); - mouse.mouseMove(button0Coordinates, 10, 10); - sleep(1000); - assertThat(getTooltipElement().getLocation().x, is(greaterThan(0))); - - mouse.mouseMove(button1Coordinates, 10, 10); - assertThat(getTooltipElement().getLocation().x, is(lessThan(-1000))); - - sleep(1000); - assertThat(getTooltipElement().getLocation().x, - is(greaterThan(button1Coordinates.onPage().x))); - } - - private Coordinates getButtonCoordinates(String caption) { - return getCoordinates(getButton(caption)); - } - - private ButtonElement getButton(String caption) { - return $(ButtonElement.class).caption(caption).first(); - } -} diff --git a/uitest/src/com/vaadin/tests/tooltip/ButtonTooltips.java b/uitest/src/com/vaadin/tests/tooltip/ButtonTooltips.java deleted file mode 100644 index c341aa689b..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/ButtonTooltips.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.vaadin.tests.tooltip; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Alignment; -import com.vaadin.ui.Button; -import com.vaadin.ui.VerticalLayout; - -public class ButtonTooltips extends AbstractTestUI { - - public static final String shortDescription = "Another"; - public static final String longDescription = "long descidescidescpription"; - - @Override - protected String getTestDescription() { - return "Button tooltip's size gets messed up if moving from one tooltip to another before a timer expires."; - } - - @Override - protected Integer getTicketNumber() { - return 8454; - } - - @Override - protected void setup(VaadinRequest request) { - VerticalLayout vl = new VerticalLayout(); - Button button = new Button("One"); - button.setDescription(longDescription); - Button button2 = new Button("Two"); - button2.setDescription(shortDescription); - vl.addComponent(button); - vl.addComponent(button2); - vl.setComponentAlignment(button, Alignment.TOP_RIGHT); - vl.setComponentAlignment(button2, Alignment.TOP_RIGHT); - addComponent(vl); - - } -} diff --git a/uitest/src/com/vaadin/tests/tooltip/ButtonTooltipsTest.java b/uitest/src/com/vaadin/tests/tooltip/ButtonTooltipsTest.java deleted file mode 100644 index 08436b1332..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/ButtonTooltipsTest.java +++ /dev/null @@ -1,53 +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.tooltip; - -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - -import org.junit.Test; -import org.openqa.selenium.WebElement; - -import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.tests.tb3.TooltipTest; - -/** - * Tests that tooltip sizes do not change when moving between adjacent elements - * - * @author Vaadin Ltd - */ -public class ButtonTooltipsTest extends TooltipTest { - - @Test - public void tooltipSizeWhenMovingBetweenElements() throws Exception { - openTestURL(); - - WebElement buttonOne = $(ButtonElement.class).caption("One").first(); - WebElement buttonTwo = $(ButtonElement.class).caption("Two").first(); - - checkTooltip(buttonOne, ButtonTooltips.longDescription); - int originalWidth = getTooltipElement().getSize().getWidth(); - int originalHeight = getTooltipElement().getSize().getHeight(); - - clearTooltip(); - checkTooltip(buttonTwo, ButtonTooltips.shortDescription); - moveMouseTo(buttonOne, 5, 5); - sleep(100); - assertThat(getTooltipElement().getSize().getWidth(), is(originalWidth)); - assertThat(getTooltipElement().getSize().getHeight(), - is(originalHeight)); - } -} diff --git a/uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltips.java b/uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltips.java deleted file mode 100644 index 606a773141..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltips.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.vaadin.tests.tooltip; - -import java.util.Iterator; - -import com.vaadin.event.Transferable; -import com.vaadin.event.TransferableImpl; -import com.vaadin.event.dd.DragAndDropEvent; -import com.vaadin.event.dd.DropHandler; -import com.vaadin.event.dd.DropTarget; -import com.vaadin.event.dd.TargetDetails; -import com.vaadin.event.dd.acceptcriteria.AcceptAll; -import com.vaadin.event.dd.acceptcriteria.AcceptCriterion; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.tests.util.TestUtils; -import com.vaadin.ui.Component; -import com.vaadin.ui.CssLayout; -import com.vaadin.ui.DragAndDropWrapper; -import com.vaadin.ui.Label; -import com.vaadin.ui.VerticalLayout; - -public class DragAndDropWrapperTooltips extends AbstractTestUI { - - private final String BASE = ".v-widget.greenblock {vertical-align: middle; float:left; width:60px;height:60px;background: green !important; padding:0; margin:2px;-webkit-transition: width 0.3s ease-in-out;color: white;}"; - private final String B2 = ".v-widget.b2 {background-color: red !important;}"; - private final String B3 = ".v-widget.b3 {background-color: yellow !important;color: black;}"; - private final String B4 = ".v-widget.b4 {background-color: blue !important;}"; - private final String HIDEDRAGSOURCE = ".v-active-drag-source { overflow:hidden; width:0px !important;}"; - private DragAndDropWrapper dragAndDropWrapper; - - @Override - protected void setup(VaadinRequest request) { - TestUtils.injectCSS(this, BASE + B4 + B2 + B3 + HIDEDRAGSOURCE); - - VerticalLayout l = new VerticalLayout(); - l.setWidth("400px"); - l.setHeight("100px"); - dragAndDropWrapper = new DragAndDropWrapper(cssLayout); - dragAndDropWrapper - .setDescription("Tooltip for the wrapper wrapping all the draggable layouts"); - dragAndDropWrapper.setSizeFull(); - l.addComponent(dragAndDropWrapper); - - addComponent(l); - - for (int i = 1; i <= 4; i++) { - WrappedLabel wl = new WrappedLabel("Block"); - wl.setId("wrapper" + i); - wl.addStyleName("b" + i); - cssLayout.addComponent(wl); - } - getTooltipConfiguration().setOpenDelay(300); - } - - int count; - - private CssLayout cssLayout = new CssLayout() { - }; - - class WrappedLabel extends DragAndDropWrapper { - - private static final long serialVersionUID = 1L; - - public WrappedLabel(String content) { - super(new Label(content + " " + ++count)); - getCompositionRoot().setSizeUndefined(); - setHeight("60px"); // FIXME custom component seems to be broken: - // can't set height with css only - setWidth("60px"); - setDragStartMode(DragStartMode.WRAPPER); - addStyleName("greenblock"); - } - - @Override - public DropHandler getDropHandler() { - return dh; - } - - } - - private DropHandler dh = new DropHandler() { - - @Override - public AcceptCriterion getAcceptCriterion() { - return AcceptAll.get(); - } - - @Override - public void drop(DragAndDropEvent dropEvent) { - Transferable transferable = dropEvent.getTransferable(); - if (transferable instanceof TransferableImpl) { - TransferableImpl ct = (TransferableImpl) transferable; - Component sourceComponent = ct.getSourceComponent(); - if (sourceComponent instanceof WrappedLabel) { - int index = 1; - Iterator<Component> componentIterator = cssLayout - .getComponentIterator(); - Component next = componentIterator.next(); - TargetDetails dropTargetData = dropEvent.getTargetDetails(); - DropTarget target = dropTargetData.getTarget(); - while (next != target) { - if (next != sourceComponent) { - index++; - } - next = componentIterator.next(); - } - if (dropTargetData.getData("horizontalLocation").equals( - "LEFT")) { - index--; - if (index < 0) { - index = 0; - } - } - - cssLayout.removeComponent(sourceComponent); - cssLayout.addComponent(sourceComponent, index); - - dragAndDropWrapper - .setDescription("Drag was performed and tooltip was changed"); - } - } - } - }; - - @Override - protected String getTestDescription() { - return "A tooltip should be shown when hovering the DragAndDropWrapper containing all the draggable layouts"; - } - - @Override - protected Integer getTicketNumber() { - return 7708; - } -} diff --git a/uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltipsTest.java b/uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltipsTest.java deleted file mode 100644 index d913c8cc12..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltipsTest.java +++ /dev/null @@ -1,44 +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.tooltip; - -import org.junit.Test; -import org.openqa.selenium.interactions.Actions; - -import com.vaadin.testbench.elements.LabelElement; -import com.vaadin.tests.tb3.TooltipTest; - -/** - * - * - * @author Vaadin Ltd - */ -public class DragAndDropWrapperTooltipsTest extends TooltipTest { - @Test - public void testDragAndDropTooltips() throws Exception { - openTestURL(); - LabelElement element = $(LabelElement.class).get(4); - LabelElement targetElement = $(LabelElement.class).get(1); - checkTooltip(element, - "Tooltip for the wrapper wrapping all the draggable layouts"); - new Actions(getDriver()).clickAndHold(element) - .moveToElement(targetElement).perform(); - sleep(500); - checkTooltipNotPresent(); - new Actions(getDriver()).release().perform(); - checkTooltip(element, "Drag was performed and tooltip was changed"); - } -} diff --git a/uitest/src/com/vaadin/tests/tooltip/LongTooltip.java b/uitest/src/com/vaadin/tests/tooltip/LongTooltip.java deleted file mode 100644 index 0eee9d4976..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/LongTooltip.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.vaadin.tests.tooltip; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.tests.util.LoremIpsum; -import com.vaadin.ui.Alignment; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.TextField; - -public class LongTooltip extends TestBase { - private int tooltipCount = 0; - - @Override - public void setup() { - - GridLayout gl = new GridLayout(2, 2); - gl.setSizeFull(); - TextField f1 = createField(); - TextField f2 = createField(); - TextField f3 = createField(); - TextField f4 = createField(); - gl.addComponent(f1); - gl.addComponent(f2); - gl.addComponent(f3); - gl.addComponent(f4); - - gl.setComponentAlignment(f1, Alignment.TOP_LEFT); - gl.setComponentAlignment(f2, Alignment.TOP_RIGHT); - gl.setComponentAlignment(f3, Alignment.BOTTOM_LEFT); - gl.setComponentAlignment(f4, Alignment.BOTTOM_RIGHT); - - getLayout().setSizeFull(); - getLayout().addComponent(gl); - - } - - private TextField createField() { - final TextField field = new TextField(); - field.setDescription("Tooltip " + Integer.toString(tooltipCount++) - + ": " + LoremIpsum.get(1000)); - return field; - } - - @Override - protected String getDescription() { - return "For a given cursor position the tooltip should always appear with the same size in the same position. The tooltip should also always be completely on screen and not cause any scrollbars to appear."; - } - - @Override - protected Integer getTicketNumber() { - return 7100; - } -} diff --git a/uitest/src/com/vaadin/tests/tooltip/LongTooltipTest.java b/uitest/src/com/vaadin/tests/tooltip/LongTooltipTest.java deleted file mode 100644 index 191ce6ffec..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/LongTooltipTest.java +++ /dev/null @@ -1,47 +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.tooltip; - -import java.util.List; - -import org.junit.Test; - -import com.vaadin.testbench.elements.TextFieldElement; -import com.vaadin.tests.tb3.TooltipTest; -import com.vaadin.tests.util.LoremIpsum; - -/** - * Test to see if long tooltips behave appropriately - * - * @author Vaadin Ltd - */ -public class LongTooltipTest extends TooltipTest { - - @Test - public void tooltipsDontOverflow() throws Exception { - openTestURL(); - List<TextFieldElement> elements = $(TextFieldElement.class).all(); - checkTooltipNotPresent(); - int i = 0; - for (TextFieldElement element : elements) { - checkTooltip(element, "Tooltip " + Integer.toString(i++) + ": " - + LoremIpsum.get(1000)); - clearTooltip(); - checkTooltipNotPresent(); - } - } - -} diff --git a/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltip.java b/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltip.java deleted file mode 100644 index ff470336f5..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltip.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.vaadin.tests.tooltip; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.MenuBar; - -public class MenuBarTooltip extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - MenuBar menubar = new MenuBar(); - - MenuBar.MenuItem menuitem = menubar.addItem("Menu item", null, null); - menuitem.setDescription("Menu item description"); - - MenuBar.MenuItem submenuitem1 = menuitem.addItem("Submenu item 1", null, null); - submenuitem1.setDescription("Submenu item 1 description"); - - MenuBar.MenuItem submenuitem2 = menuitem.addItem("Submenu item 2", null, null); - submenuitem2.setDescription("Submenu item 2 description"); - - addComponent(menubar); - } - - @Override - protected Integer getTicketNumber() { - return 14854; - } - - @Override - protected String getTestDescription() { - return "MenuItem tooltip should have a larger z-index than MenuBar/MenuItem."; - } -} diff --git a/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltipTest.java b/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltipTest.java deleted file mode 100644 index 9b2f7d13d6..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltipTest.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.vaadin.tests.tooltip; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.greaterThan; - -import org.junit.Test; -import org.openqa.selenium.By; - -import com.vaadin.testbench.elements.MenuBarElement; -import com.vaadin.tests.tb3.MultiBrowserTest; -import com.vaadin.ui.themes.ChameleonTheme; -import com.vaadin.ui.themes.Reindeer; -import com.vaadin.ui.themes.Runo; -import com.vaadin.ui.themes.ValoTheme; - -public class MenuBarTooltipTest extends MultiBrowserTest { - - @Test - public void toolTipShouldBeOnTopOfMenuItem() { - String[] themes = new String[] { - ValoTheme.THEME_NAME, - Reindeer.THEME_NAME, - Runo.THEME_NAME, - ChameleonTheme.THEME_NAME - }; - - for(String theme : themes) { - assertZIndices(theme); - } - } - - public void assertZIndices(String theme) { - openTestURL("theme=" + theme); - - $(MenuBarElement.class).first().clickItem("Menu item"); - - assertThat(String.format("Invalid z-index for theme %s.", theme), - getZIndex("v-tooltip"), greaterThan(getZIndex("v-menubar-popup"))); - } - - private int getZIndex(String className) { - return Integer.parseInt( - findElement(By.className(className)).getCssValue("z-index")); - } - -}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/tooltip/SliderTooltip.java b/uitest/src/com/vaadin/tests/tooltip/SliderTooltip.java deleted file mode 100644 index 8cf7232fab..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/SliderTooltip.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.vaadin.tests.tooltip; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Slider; - -public class SliderTooltip extends AbstractTestUI { - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. - * VaadinRequest) - */ - @Override - protected void setup(VaadinRequest request) { - Slider slider = new Slider(); - slider.setDescription("Tooltip"); - addComponent(slider); - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() - */ - @Override - protected String getTestDescription() { - return "Testing that sliders have tooltips."; - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() - */ - @Override - protected Integer getTicketNumber() { - return 14019; - } - -} diff --git a/uitest/src/com/vaadin/tests/tooltip/SliderTooltipTest.java b/uitest/src/com/vaadin/tests/tooltip/SliderTooltipTest.java deleted file mode 100644 index 743b7c2ab5..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/SliderTooltipTest.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.tooltip; - -import org.junit.Test; -import org.openqa.selenium.WebElement; - -import com.vaadin.testbench.elements.SliderElement; -import com.vaadin.tests.tb3.TooltipTest; - -/** - * Test that sliders can have tooltips - * - * @author Vaadin Ltd - */ -public class SliderTooltipTest extends TooltipTest { - - @Test - public void sliderHasTooltip() throws Exception { - openTestURL(); - WebElement slider = $(SliderElement.class).first(); - checkTooltipNotPresent(); - checkTooltip(slider, "Tooltip"); - clearTooltip(); - checkTooltipNotPresent(); - } -} diff --git a/uitest/src/com/vaadin/tests/tooltip/StationaryTooltip.java b/uitest/src/com/vaadin/tests/tooltip/StationaryTooltip.java deleted file mode 100644 index 5c7b52d96f..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/StationaryTooltip.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.vaadin.tests.tooltip; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button; -import com.vaadin.ui.VerticalLayout; - -public class StationaryTooltip extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - VerticalLayout vl = new VerticalLayout(); - Button button = new Button("Button"); - button.setDescription("description"); - - button.setWidth("200px"); - vl.addComponent(button); - - addComponent(vl); - } - - @Override - protected String getTestDescription() { - return null; - } - - @Override - protected Integer getTicketNumber() { - return null; - } -} diff --git a/uitest/src/com/vaadin/tests/tooltip/StationaryTooltipTest.java b/uitest/src/com/vaadin/tests/tooltip/StationaryTooltipTest.java deleted file mode 100644 index 6b751e7a6b..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/StationaryTooltipTest.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.vaadin.tests.tooltip; - -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - -import java.util.List; - -import org.junit.Test; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.interactions.Mouse; -import org.openqa.selenium.interactions.internal.Coordinates; -import org.openqa.selenium.remote.DesiredCapabilities; - -import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class StationaryTooltipTest extends MultiBrowserTest { - - @Override - public List<DesiredCapabilities> getBrowsersToTest() { - // With IEDriver, the cursor seems to jump to default position after the - // mouse move, - // so we are not able to test the tooltip behaviour properly. - return getBrowsersExcludingIE(); - } - - @Test - public void tooltipShouldBeStationary() throws InterruptedException { - openTestURL(); - - Mouse mouse = getMouse(); - - moveMouseToButtonUpperLeftCorner(mouse); - sleep(3000); // wait for the tooltip to become visible - int originalTooltipLocationX = getTooltipLocationX(); - - moveMouseToButtonBottomRightCorner(mouse); - int actualTooltipLocationX = getTooltipLocationX(); - - assertThat(actualTooltipLocationX, is(greaterThan(0))); - assertThat(actualTooltipLocationX, is(originalTooltipLocationX)); - } - - private Coordinates getButtonCoordinates() { - return getCoordinates(getButtonElement()); - } - - private ButtonElement getButtonElement() { - return $(ButtonElement.class).first(); - } - - private void moveMouseToButtonBottomRightCorner(Mouse mouse) { - Coordinates buttonCoordinates = getButtonCoordinates(); - Dimension buttonDimensions = getButtonDimensions(); - - mouse.mouseMove(buttonCoordinates, buttonDimensions.getWidth() - 1, - buttonDimensions.getHeight() - 1); - } - - private void moveMouseToButtonUpperLeftCorner(Mouse mouse) { - Coordinates buttonCoordinates = getButtonCoordinates(); - - mouse.mouseMove(buttonCoordinates, 0, 0); - } - - private org.openqa.selenium.Dimension getButtonDimensions() { - ButtonElement buttonElement = getButtonElement(); - - return buttonElement.getWrappedElement().getSize(); - } - - private int getTooltipLocationX() { - return getTooltipElement().getLocation().getX(); - } - -}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/tooltip/TooltipAndJavascript.java b/uitest/src/com/vaadin/tests/tooltip/TooltipAndJavascript.java deleted file mode 100644 index 2ada6e819a..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/TooltipAndJavascript.java +++ /dev/null @@ -1,48 +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.tooltip; - -import com.vaadin.annotations.JavaScript; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button; - -public class TooltipAndJavascript extends AbstractTestUI { - - @JavaScript("tooltipandjavascript.js") - public static class MyButton extends Button { - - } - - @Override - protected void setup(VaadinRequest request) { - MyButton b = new MyButton(); - b.setCaption("Hover for tooltip"); - b.setDescription("Tooltip for the button"); - addComponent(b); - } - - @Override - protected String getTestDescription() { - return "Hover the button for a tooltip. It should be styled correctly"; - } - - @Override - protected Integer getTicketNumber() { - return 14028; - } - -} diff --git a/uitest/src/com/vaadin/tests/tooltip/TooltipAndJavascriptTest.java b/uitest/src/com/vaadin/tests/tooltip/TooltipAndJavascriptTest.java deleted file mode 100644 index cc9309ac2c..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/TooltipAndJavascriptTest.java +++ /dev/null @@ -1,54 +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.tooltip; - -import org.junit.Assert; -import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.WebElement; - -import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class TooltipAndJavascriptTest extends MultiBrowserTest { - - @Test - public void ensureTooltipInOverlay() throws InterruptedException { - openTestURL(); - $(ButtonElement.class).first().showTooltip(); - WebElement tooltip = findElement(By - .cssSelector(".v-overlay-container .v-tooltip")); - WebElement overlayContainer = getParent(tooltip); - Assert.assertTrue("v-overlay-container did not receive theme", - hasClass(overlayContainer, "reindeer")); - } - - private boolean hasClass(WebElement element, String classname) { - String[] classes = element.getAttribute("class").split(" "); - for (String classString : classes) { - if (classname.equals(classString)) { - return true; - } - } - return false; - } - - private WebElement getParent(WebElement element) { - return (WebElement) ((JavascriptExecutor) getDriver()).executeScript( - "return arguments[0].parentNode;", element); - } -} diff --git a/uitest/src/com/vaadin/tests/tooltip/TooltipConfiguration.java b/uitest/src/com/vaadin/tests/tooltip/TooltipConfiguration.java deleted file mode 100644 index f67db4219f..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/TooltipConfiguration.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.vaadin.tests.tooltip; - -import com.vaadin.data.Property; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.tests.util.LoremIpsum; -import com.vaadin.ui.NativeButton; -import com.vaadin.ui.TextField; - -public class TooltipConfiguration extends AbstractTestUIWithLog { - - private TextField closeTimeout; - private TextField quickOpenTimeout; - private TextField maxWidth; - private TextField openDelay; - private TextField quickOpenDelay; - - @Override - protected void setup(VaadinRequest request) { - NativeButton componentWithShortTooltip = new NativeButton( - "Short tooltip"); - componentWithShortTooltip.setDescription("This is a short tooltip"); - componentWithShortTooltip.setId("shortTooltip"); - - NativeButton componentWithLongTooltip = new NativeButton("Long tooltip"); - componentWithLongTooltip.setId("longTooltip"); - componentWithLongTooltip.setDescription(LoremIpsum.get(5000)); - - closeTimeout = createIntegerTextField("Close timeout", - getState().tooltipConfiguration.closeTimeout); - closeTimeout.addValueChangeListener(new Property.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - if (closeTimeout.getConvertedValue() != null) { - getTooltipConfiguration().setCloseTimeout( - (Integer) closeTimeout.getConvertedValue()); - } - } - }); - maxWidth = createIntegerTextField("Max width", - getState().tooltipConfiguration.maxWidth); - maxWidth.addValueChangeListener(new Property.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - if (maxWidth.getConvertedValue() != null) { - getTooltipConfiguration().setMaxWidth( - (Integer) maxWidth.getConvertedValue()); - } - } - }); - openDelay = createIntegerTextField("Open delay", - getState().tooltipConfiguration.openDelay); - openDelay.addValueChangeListener(new Property.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - if (openDelay.getConvertedValue() != null) { - getTooltipConfiguration().setOpenDelay( - (Integer) openDelay.getConvertedValue()); - } - } - }); - - quickOpenDelay = createIntegerTextField("Quick open delay", - getState().tooltipConfiguration.quickOpenDelay); - quickOpenDelay - .addValueChangeListener(new Property.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - if (quickOpenDelay.getConvertedValue() != null) { - getTooltipConfiguration().setQuickOpenDelay( - (Integer) quickOpenDelay - .getConvertedValue()); - } - } - }); - - quickOpenTimeout = createIntegerTextField("Quick open timeout", - getState().tooltipConfiguration.quickOpenTimeout); - quickOpenTimeout - .addValueChangeListener(new Property.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - if (quickOpenTimeout.getConvertedValue() != null) { - getTooltipConfiguration().setQuickOpenTimeout( - (Integer) quickOpenTimeout - .getConvertedValue()); - } - } - }); - - getLayout().addComponents(closeTimeout, openDelay, quickOpenDelay, - quickOpenTimeout, maxWidth); - - getLayout().addComponents(componentWithShortTooltip, - componentWithLongTooltip); - - } - - private TextField createIntegerTextField(String caption, int initialValue) { - TextField tf = new TextField(caption); - tf.setId(caption); - tf.setConverter(Integer.class); - tf.setImmediate(true); - tf.setConvertedValue(initialValue); - // makes TB3 tests simpler - no "null" added when clearing a field - tf.setNullRepresentation(""); - return tf; - } - - @Override - protected String getTestDescription() { - return "Tests that tooltip delays can be configured"; - } - - @Override - protected Integer getTicketNumber() { - return 8065; - } - -} diff --git a/uitest/src/com/vaadin/tests/tooltip/TooltipConfigurationTest.java b/uitest/src/com/vaadin/tests/tooltip/TooltipConfigurationTest.java deleted file mode 100644 index 8f84444400..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/TooltipConfigurationTest.java +++ /dev/null @@ -1,73 +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.tests.tooltip; - -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - -import org.junit.Test; -import org.openqa.selenium.Keys; -import org.openqa.selenium.WebElement; - -import com.vaadin.testbench.By; -import com.vaadin.tests.tb3.TooltipTest; - -public class TooltipConfigurationTest extends TooltipTest { - - @Test - public void testTooltipConfiguration() throws Exception { - openTestURL(); - - WebElement uiRoot = getDriver().findElement(By.vaadin("Root")); - WebElement closeTimeout = vaadinElementById("Close timeout"); - WebElement shortTooltip = vaadinElementById("shortTooltip"); - WebElement longTooltip = vaadinElementById("longTooltip"); - WebElement maxWidth = vaadinElementById("Max width"); - - selectAndType(closeTimeout, "0"); - - checkTooltip(shortTooltip, "This is a short tooltip"); - - moveToRoot(); - - checkTooltipNotPresent(); - - selectAndType(closeTimeout, "3000"); - checkTooltip(shortTooltip, "This is a short tooltip"); - - moveToRoot(); - - // The tooltip should still be there despite being "cleared", as the - // timeout hasn't expired yet. - checkTooltip("This is a short tooltip"); - - // assert that tooltip is present - selectAndType(closeTimeout, "0"); - selectAndType(maxWidth, "100"); - - testBenchElement(longTooltip).showTooltip(); - assertThat(getDriver().findElement(By.className("popupContent")) - .getSize().getWidth(), is(100)); - } - - private void selectAndType(WebElement element, String value) { - // select and replace text - element.clear(); - // if null representation not set as "", need to move cursor to end and - // remove text "null" - element.sendKeys(value + Keys.ENTER); - } -}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/tooltip/TooltipInWindow.java b/uitest/src/com/vaadin/tests/tooltip/TooltipInWindow.java deleted file mode 100644 index 690b65432a..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/TooltipInWindow.java +++ /dev/null @@ -1,57 +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.tooltip; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.TextField; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; - -public class TooltipInWindow extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - VerticalLayout layout = new VerticalLayout(); - layout.setMargin(true); - Window window = new Window("Window", layout); - layout.setSizeUndefined(); - window.center(); - layout.addComponent(createTextField("tf1")); - - addWindow(window); - addComponent(createTextField("tf2")); - } - - private TextField createTextField(String id) { - TextField tf = new TextField("TextField with a tooltip"); - tf.setDescription("My tooltip"); - tf.setId(id); - return tf; - } - - @Override - protected String getTestDescription() { - return "Tooltips should also work in a Window (as well as in other overlays)"; - } - - @Override - protected Integer getTicketNumber() { - return 9172; - } - -} diff --git a/uitest/src/com/vaadin/tests/tooltip/TooltipInWindowTest.java b/uitest/src/com/vaadin/tests/tooltip/TooltipInWindowTest.java deleted file mode 100644 index 1c50bf5486..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/TooltipInWindowTest.java +++ /dev/null @@ -1,66 +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.tooltip; - -import org.junit.Test; -import org.openqa.selenium.WebElement; - -import com.vaadin.testbench.By; -import com.vaadin.tests.tb3.TooltipTest; - -/** - * Test if tooltips in subwindows behave correctly - * - * @author Vaadin Ltd - */ -public class TooltipInWindowTest extends TooltipTest { - - @Test - public void testTooltipsInSubWindow() throws Exception { - openTestURL(); - - WebElement textfield = vaadinElementById("tf1"); - - checkTooltip(textfield, "My tooltip"); - - ensureVisibleTooltipPositionedCorrectly(textfield); - - clearTooltip(); - - checkTooltip(textfield, "My tooltip"); - - clearTooltip(); - } - - private WebElement getTooltipContainerElement() { - return getDriver().findElement(By.className("v-tooltip")); - } - - private void ensureVisibleTooltipPositionedCorrectly(WebElement textfield) - throws InterruptedException { - int tooltipX = getTooltip().getLocation().getX(); - int textfieldX = textfield.getLocation().getX(); - assertGreaterOrEqual("Tooltip should be positioned on the textfield (" - + tooltipX + " < " + textfieldX + ")", tooltipX, textfieldX); - } - - private void ensureHiddenTooltipPositionedCorrectly() { - int tooltipX = getTooltipContainerElement().getLocation().getX(); - assertLessThanOrEqual( - "Tooltip should be positioned outside of viewport (was at " - + tooltipX + ")", tooltipX, -1000); - } -} diff --git a/uitest/src/com/vaadin/tests/tooltip/TooltipWidthUpdating.java b/uitest/src/com/vaadin/tests/tooltip/TooltipWidthUpdating.java deleted file mode 100644 index c5e49d1af3..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/TooltipWidthUpdating.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.vaadin.tests.tooltip; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.tests.util.LoremIpsum; -import com.vaadin.ui.NativeButton; -import com.vaadin.ui.TextField; -import com.vaadin.ui.VerticalLayout; - -/** - * Test to see if the width of the tooltip element is updated if a narrower - * tooltip is opened to replace a tooltip with wider content. - * - * @author Vaadin Ltd - */ -public class TooltipWidthUpdating extends AbstractTestUI { - - private static final long serialVersionUID = 1L; - protected static final String SHORT_TOOLTIP_TEXT = "This is a short tooltip"; - protected static final String LONG_TOOLTIP_TEXT = LoremIpsum.get(5000); - protected static final Integer MAX_WIDTH = 500; - - @Override - protected void setup(VaadinRequest request) { - NativeButton componentWithShortTooltip = new NativeButton( - "Short tooltip"); - componentWithShortTooltip.setDescription(SHORT_TOOLTIP_TEXT); - componentWithShortTooltip.setId("shortTooltip"); - - getTooltipConfiguration().setMaxWidth(MAX_WIDTH); - getTooltipConfiguration().setCloseTimeout(200); - - NativeButton componentWithLongTooltip = new NativeButton("Long tooltip"); - componentWithLongTooltip.setId("longTooltip"); - componentWithLongTooltip.setDescription(LONG_TOOLTIP_TEXT); - - VerticalLayout vl = new VerticalLayout(); - - TextField component1 = new TextField("TextField"); - component1.setId("component1"); - TextField component2 = new TextField("TextField"); - TextField component3 = new TextField("TextField"); - TextField component4 = new TextField("TextField"); - TextField component5 = new TextField("TextField"); - TextField component6 = new TextField("TextField"); - TextField component7 = new TextField("TextField"); - TextField component8 = new TextField("TextField"); - - // some count of any components should be added before (between) buttons - // to make defect reproducible - vl.addComponents(component1, component2, component2, component3, - component4, component5, component5, component6, component7, - component8); - - getLayout().addComponents(componentWithShortTooltip, vl, - componentWithLongTooltip); - } - - @Override - protected String getTestDescription() { - return "Tests that tooltip element width is updated if a narrower tooltip is opened to replace a tooltip with wider content"; - } - - @Override - protected Integer getTicketNumber() { - return 11871; - } - -} diff --git a/uitest/src/com/vaadin/tests/tooltip/TooltipWidthUpdatingTest.java b/uitest/src/com/vaadin/tests/tooltip/TooltipWidthUpdatingTest.java deleted file mode 100644 index 150d0e070e..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/TooltipWidthUpdatingTest.java +++ /dev/null @@ -1,46 +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.tests.tooltip; - -import static org.hamcrest.Matchers.lessThan; -import static org.junit.Assert.assertThat; - -import org.junit.Test; -import org.openqa.selenium.WebElement; - -import com.vaadin.testbench.By; -import com.vaadin.tests.tb3.TooltipTest; - -public class TooltipWidthUpdatingTest extends TooltipTest { - - @Test - public void testTooltipWidthUpdating() { - openTestURL(); - - WebElement btnLongTooltip = vaadinElementById("longTooltip"); - WebElement btnShortTooltip = vaadinElementById("shortTooltip"); - - moveMouseToTopLeft(btnLongTooltip); - testBenchElement(btnLongTooltip).showTooltip(); - - moveMouseToTopLeft(btnShortTooltip); - testBenchElement(btnShortTooltip).showTooltip(); - - assertThat(getDriver().findElement(By.className("popupContent")) - .getSize().getWidth(), lessThan(TooltipWidthUpdating.MAX_WIDTH)); - } - -}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltip.java b/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltip.java deleted file mode 100644 index 20dc514c10..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltip.java +++ /dev/null @@ -1,62 +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.tooltip; - -import com.vaadin.data.validator.IntegerRangeValidator; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.TextField; - -/** - * - * UI test class for Tooltip with integer range validator. - */ -public class ValidatorCaptionTooltip extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - TextField fieldWithError = new TextField(); - int min = 0; - int max = 100; - String errorMessage = "Valid value is between " + min + " and " + max - + ". {0} is not."; - IntegerRangeValidator validator = new IntegerRangeValidator( - errorMessage, min, max); - fieldWithError.setValue("142"); - - fieldWithError.addValidator(validator); - fieldWithError.setConverter(Integer.class); - fieldWithError.setImmediate(true); - - TextField fieldWithoutError = new TextField(); - fieldWithoutError.addValidator(validator); - fieldWithoutError.setConverter(Integer.class); - fieldWithoutError.setValue("42"); - addComponent(fieldWithError); - addComponent(fieldWithoutError); - } - - @Override - protected String getTestDescription() { - return "Valid value is from 0 to 100.When the value is not valid. An error tooltip should appear"; - } - - @Override - protected Integer getTicketNumber() { - return 14046; - } - -} diff --git a/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltipTest.java b/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltipTest.java deleted file mode 100644 index 9603b1df36..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltipTest.java +++ /dev/null @@ -1,46 +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.tooltip; - -import org.junit.Test; - -import com.vaadin.testbench.elements.TextFieldElement; -import com.vaadin.tests.tb3.TooltipTest; - -/** - * Test to see if validators create error tooltips correctly. - * - * @author Vaadin Ltd - */ -public class ValidatorCaptionTooltipTest extends TooltipTest { - @Test - public void validatorWithError() throws Exception { - openTestURL(); - - TextFieldElement field = $(TextFieldElement.class).get(0); - String fieldValue = field.getAttribute("value"); - String expected = "Valid value is between 0 and 100. " + fieldValue - + " is not."; - checkTooltip(field, expected); - } - - @Test - public void validatorWithoutError() throws Exception { - openTestURL(); - TextFieldElement field = $(TextFieldElement.class).get(1); - checkTooltip(field, null); - } -} diff --git a/uitest/src/com/vaadin/tests/tooltip/tooltipandjavascript.js b/uitest/src/com/vaadin/tests/tooltip/tooltipandjavascript.js deleted file mode 100644 index f6aea090ba..0000000000 --- a/uitest/src/com/vaadin/tests/tooltip/tooltipandjavascript.js +++ /dev/null @@ -1 +0,0 @@ -window.console.log("tooltipandjavascript.js executing")
\ No newline at end of file |