From 8c061294630ba608fbc6a507f9bffe5c24bcfa40 Mon Sep 17 00:00:00 2001 From: Alexey Fansky Date: Fri, 13 Mar 2015 12:06:48 -0700 Subject: Re-showed tab is displayed if there is room for it (#17096) Change-Id: I52c9a47e2b9eed3a3f73f34e4c3e770b915509bf --- .../FirstTabNotVisibleWhenTabsheetNotClipped.java | 130 +++++++++++++++++++++ ...rstTabNotVisibleWhenTabsheetNotClippedTest.java | 56 +++++++++ 2 files changed, 186 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleWhenTabsheetNotClipped.java create mode 100644 uitest/src/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleWhenTabsheetNotClippedTest.java (limited to 'uitest/src/com') diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleWhenTabsheetNotClipped.java b/uitest/src/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleWhenTabsheetNotClipped.java new file mode 100644 index 0000000000..6d66f1d295 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleWhenTabsheetNotClipped.java @@ -0,0 +1,130 @@ +package com.vaadin.tests.components.tabsheet; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.*; + +import java.util.HashMap; +import java.util.Map; + +public class FirstTabNotVisibleWhenTabsheetNotClipped extends AbstractTestUI { + + private TabSheet.Tab firstNotClippedTab; + private TabSheet.Tab firstClippedTab; + + @Override + protected void setup(VaadinRequest request) { + addButton("Toggle first not clipped tab", new Button.ClickListener() { + @Override + public void buttonClick(Button.ClickEvent event) { + firstNotClippedTab.setVisible(!firstNotClippedTab.isVisible()); + } + }); + addComponent(createNotClippedTabSheet()); + + addButton("Toggle first clipped tab", new Button.ClickListener() { + @Override + public void buttonClick(Button.ClickEvent event) { + firstClippedTab.setVisible(!firstClippedTab.isVisible()); + } + }); + addComponent(createClippedTabSheet()); + + addComponent(new Label("VerticalLayout:")); + addBlock(new VerticalLayout()); + addComponent(new Label("HorizontalLayout:")); + addBlock(new HorizontalLayout()); + } + + private TabSheet createNotClippedTabSheet() { + TabSheet notClippedTabSheet = new TabSheet(); + for (int i = 0; i < 2; i++) { + notClippedTabSheet.addTab(createTabContent(i), "Tab " + i); + } + firstNotClippedTab = notClippedTabSheet.getTab(0); + return notClippedTabSheet; + } + + private TabSheet createClippedTabSheet() { + TabSheet clippedTabSheet = new TabSheet(); + for (int i = 0; i < 50; i++) { + clippedTabSheet.addTab(createTabContent(i), "Tab " + i); + } + firstClippedTab = clippedTabSheet.getTab(0); + return clippedTabSheet; + } + + private VerticalLayout createTabContent(int index) { + VerticalLayout layout = new VerticalLayout(); + layout.addComponent(new Label("Tab " + index + " Content")); + return layout; + } + + private void addBlock(Layout layout) { + layout.setWidth("300px"); + + TabSheet tabsheet = new TabSheet(); + String[] letters = { "A", "B", "C", "D" }; + HashMap tabMap = new HashMap(); + + for (String letter : letters) { + VerticalLayout vLayout = new VerticalLayout(); + vLayout.addComponent(new Label(letter + 1)); + vLayout.addComponent(new Label(letter + 2)); + vLayout.addComponent(new Label(letter + 3)); + + tabsheet.addTab(vLayout); + tabsheet.getTab(vLayout).setCaption("tab " + letter); + + tabMap.put("tab " + letter, tabsheet.getTab(vLayout)); + } + + VerticalLayout vtabLayout = new VerticalLayout(); + + for (String letter : letters) { + Button btntab = new Button("show tab " + letter); + btntab.setId("tab " + letter); + btntab.addClickListener(createTabListener(tabMap, tabsheet)); + vtabLayout.addComponent(btntab); + } + + layout.addComponent(vtabLayout); + layout.addComponent(tabsheet); + addComponent(layout); + } + + private Button.ClickListener createTabListener(final HashMap map, + final TabSheet tabsheet) { + + Button.ClickListener clickListener = new Button.ClickListener() { + + @Override + public void buttonClick(Button.ClickEvent event) { + // id of the button is the same as the tab's caption + String tabName = event.getComponent().getId(); + + for (Map.Entry entry : map.entrySet()) { + TabSheet.Tab tab = entry.getValue(); + + if (entry.getKey().equals(tabName)) { + tab.setVisible(true); + tabsheet.setSelectedTab(tab.getComponent()); + } else { + tab.setVisible(false); + } + } + } + }; + return clickListener; + } + + @Override + protected Integer getTicketNumber() { + return 17096; + } + + @Override + public String getDescription() { + return "TabSheet should display re-shown tab if there's room for it"; + } +} diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleWhenTabsheetNotClippedTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleWhenTabsheetNotClippedTest.java new file mode 100644 index 0000000000..74a725f5ed --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleWhenTabsheetNotClippedTest.java @@ -0,0 +1,56 @@ +package com.vaadin.tests.components.tabsheet; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.TabSheetElement; +import com.vaadin.tests.tb3.MultiBrowserTest; +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebElement; + +public class FirstTabNotVisibleWhenTabsheetNotClippedTest extends MultiBrowserTest { + @Test + public void testNotClippedTabIsVisible() throws InterruptedException { + openTestURL(); + + ButtonElement toggleNotClipped = $(ButtonElement.class) + .caption("Toggle first not clipped tab").first(); + + toggleNotClipped.click(); + TabSheetElement notClippedTabSheet = $(TabSheetElement.class).get(0); + WebElement firstTab = notClippedTabSheet.findElement( + By.className("v-tabsheet-tabitemcell-first")); + String caption = firstTab.findElement(By.className("v-captiontext")).getText(); + Assert.assertEquals("Tab with -first style should be Tab 1", "Tab 1", caption); + + toggleNotClipped.click(); + firstTab = notClippedTabSheet.findElement( + By.className("v-tabsheet-tabitemcell-first")); + caption = firstTab.findElement(By.className("v-captiontext")).getText(); + Assert.assertEquals("Tab with -first style should be Tab 0", "Tab 0", caption); + } + + + @Test + public void testShowPreviouslyHiddenTab() { + openTestURL(); + + $(ButtonElement.class).caption("show tab D").get(0).click(); + $(ButtonElement.class).caption("show tab C").get(0).click(); + + WebElement firstTab = $(TabSheetElement.class).get(2) + .findElement(By.className("v-tabsheet-tabitemcell-first")); + String firstCaption = firstTab.findElement(By.className("v-captiontext")).getText(); + + org.junit.Assert.assertEquals("tab C", firstCaption); + + $(ButtonElement.class).caption("show tab D").get(1).click(); + $(ButtonElement.class).caption("show tab C").get(1).click(); + + WebElement secondTab = $(TabSheetElement.class).get(3) + .findElement(By.className("v-tabsheet-tabitemcell-first")); + String secondCaption = secondTab.findElement(By.className("v-captiontext")).getText(); + + org.junit.Assert.assertEquals("tab C", secondCaption); + } +} -- cgit v1.2.3 From ebe86ba3bcfe44cdc1d87a55cfd100ff0c489049 Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Wed, 15 Apr 2015 13:33:55 +0300 Subject: Fix Grid editor area calculation without scrollbars (#17471) Change-Id: I55791e0bf46b00ea90daaeb1af8b4ca2748ff9d1 --- WebContent/VAADIN/themes/base/grid/grid.scss | 2 + client/src/com/vaadin/client/widgets/Grid.java | 9 ++-- .../grid/GridEditingWithNoScrollBars.java | 53 ++++++++++++++++++++++ .../grid/GridEditingWithNoScrollBarsTest.java | 36 +++++++++++++++ 4 files changed, 94 insertions(+), 6 deletions(-) create mode 100644 uitest/src/com/vaadin/tests/components/grid/GridEditingWithNoScrollBars.java create mode 100644 uitest/src/com/vaadin/tests/components/grid/GridEditingWithNoScrollBarsTest.java (limited to 'uitest/src/com') diff --git a/WebContent/VAADIN/themes/base/grid/grid.scss b/WebContent/VAADIN/themes/base/grid/grid.scss index e4a4a1d920..8a1497dda8 100644 --- a/WebContent/VAADIN/themes/base/grid/grid.scss +++ b/WebContent/VAADIN/themes/base/grid/grid.scss @@ -228,6 +228,8 @@ $v-grid-editor-background-color: $v-grid-row-background-color !default; left: 0; right: 0; border: $v-grid-border; + box-sizing: border-box; + -moz-box-sizing: border-box; margin-top: nth($v-grid-border, 1) * -1; @include box-shadow(0 0 9px rgba(0,0,0,.2)); } diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index 3aaac14f10..5eabbec621 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -1473,10 +1473,8 @@ public class Grid extends ResizeComposite implements } // Do not render over the vertical scrollbar - int nativeScrollbarSize = WidgetUtil.getNativeScrollbarSize(); - if (nativeScrollbarSize > 0) { - editorOverlay.getStyle().setRight(nativeScrollbarSize, Unit.PX); - } + editorOverlay.getStyle().setWidth(grid.escalator.getInnerWidth(), + Unit.PX); } private boolean buttonsShouldBeRenderedBelow(TableRowElement tr) { @@ -2200,8 +2198,7 @@ public class Grid extends ResizeComposite implements // If selection cell already contains a widget do not // create a new CheckBox HeaderCell selectionCell = header.getDefaultRow().getCell(this); - if (selectionCell.getType() - .equals(GridStaticCellType.WIDGET) + if (selectionCell.getType().equals(GridStaticCellType.WIDGET) && selectionCell.getWidget() instanceof CheckBox) { return; } diff --git a/uitest/src/com/vaadin/tests/components/grid/GridEditingWithNoScrollBars.java b/uitest/src/com/vaadin/tests/components/grid/GridEditingWithNoScrollBars.java new file mode 100644 index 0000000000..d3e0a2a7c7 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/grid/GridEditingWithNoScrollBars.java @@ -0,0 +1,53 @@ +/* + * 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.grid; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.Grid; +import com.vaadin.ui.Grid.Column; +import com.vaadin.ui.Grid.SelectionMode; + +public class GridEditingWithNoScrollBars extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + Grid grid = new Grid(); + grid.addColumn("foo", String.class); + grid.addColumn("bar", String.class); + for (int i = 0; i < 10; ++i) { + grid.addRow("foo", "" + (i % 3 + 1)); + } + + ComboBox stCombo = new ComboBox(); + stCombo.addItem("" + 1); + stCombo.addItem("" + 2); + stCombo.addItem("" + 3); + stCombo.setNullSelectionAllowed(false); + stCombo.setSizeFull(); + + Column stCol = grid.getColumn("bar"); + stCol.setEditorField(stCombo); + + grid.setSelectionMode(SelectionMode.SINGLE); + grid.setEditorEnabled(true); + grid.setSizeFull(); + + addComponent(grid); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/grid/GridEditingWithNoScrollBarsTest.java b/uitest/src/com/vaadin/tests/components/grid/GridEditingWithNoScrollBarsTest.java new file mode 100644 index 0000000000..6400b17449 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/grid/GridEditingWithNoScrollBarsTest.java @@ -0,0 +1,36 @@ +/* + * 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.grid; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +import com.vaadin.testbench.elements.GridElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class GridEditingWithNoScrollBarsTest extends MultiBrowserTest { + + @Test + public void testEditorWideEnough() { + openTestURL(); + + GridElement grid = $(GridElement.class).first(); + grid.getCell(1, 1).doubleClick(); + assertEquals(grid.getEditor().getSize().width, grid.getTableWrapper() + .getSize().width); + } +} -- cgit v1.2.3 From 8ecdcd9d665acc7e6423aa9493a4302dfb266be2 Mon Sep 17 00:00:00 2001 From: Alexey Fansky Date: Wed, 15 Apr 2015 12:12:11 -0700 Subject: Keeping MenuItem custom classes when updating styles (#17427) Change-Id: I54b7e700148797f0145c4ec5f1802ea999142ab3 --- client/src/com/vaadin/client/ui/VMenuBar.java | 12 ++++++ .../components/menubar/MenuItemStyleRemoved.java | 43 ++++++++++++++++++++++ .../menubar/MenuItemStyleRemovedTest.java | 30 +++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemoved.java create mode 100644 uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemovedTest.java (limited to 'uitest/src/com') diff --git a/client/src/com/vaadin/client/ui/VMenuBar.java b/client/src/com/vaadin/client/ui/VMenuBar.java index 08f70f4dde..823861534d 100644 --- a/client/src/com/vaadin/client/ui/VMenuBar.java +++ b/client/src/com/vaadin/client/ui/VMenuBar.java @@ -912,12 +912,24 @@ public class VMenuBar extends SimpleFocusablePanel implements SUBMENU_CLASSNAME_PREFIX, ""); } + String currentStyles = super.getStyleName(); + List customStyles = new ArrayList(); + for(String style : currentStyles.split(" ")) { + if(!style.isEmpty() && !style.startsWith(primaryStyleName)) { + customStyles.add(style); + } + } + if (isSeparator) { super.setStyleName(primaryStyleName + "-separator"); } else { super.setStyleName(primaryStyleName + "-menuitem"); } + for (String customStyle : customStyles) { + super.addStyleName(customStyle); + } + if (styleName != null) { addStyleDependentName(styleName); } diff --git a/uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemoved.java b/uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemoved.java new file mode 100644 index 0000000000..ea8bf5aec7 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemoved.java @@ -0,0 +1,43 @@ +package com.vaadin.tests.components.menubar; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.JavaScript; +import com.vaadin.ui.MenuBar; + +public class MenuItemStyleRemoved extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + MenuBar menuBar = new MenuBar(); + + MenuBar.MenuItem first = menuBar.addItem("first", null, null); + first.addItem("first sub-item 1", null, null); + first.addItem("first sub-item 2", null, null); + MenuBar.MenuItem second = menuBar.addItem("second", null, null); + second.addItem("second sub-item 2", null, null); + second.addItem("second sub-item 2", null, null); + + addComponent(menuBar); + addButton("Add styles", new Button.ClickListener() { + @Override + public void buttonClick(Button.ClickEvent event) { + JavaScript.getCurrent().execute( + "var x=document.getElementsByClassName('v-menubar-menuitem');" + + " var i; for(i=0; i < x.length; i++)" + + " {x[i].className += ' custom-menu-item'};"); + } + }); + } + + @Override + protected Integer getTicketNumber() { + return 17242; + } + + @Override + public String getDescription() { + return "MenuItem's custom class names removed when hovering"; + } +} diff --git a/uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemovedTest.java b/uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemovedTest.java new file mode 100644 index 0000000000..2ba63587fe --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemovedTest.java @@ -0,0 +1,30 @@ +package com.vaadin.tests.components.menubar; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.MenuBarElement; +import com.vaadin.tests.tb3.MultiBrowserTest; +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import java.util.List; + +public class MenuItemStyleRemovedTest extends MultiBrowserTest { + + @Test + public void testCustomStyleShouldStayAfterMenuSelect() { + openTestURL(); + + $(ButtonElement.class).caption("Add styles").first().click(); + + MenuBarElement menu = $(MenuBarElement.class).first(); + List elements = menu.findElements(By.className("custom-menu-item")); + Assert.assertEquals(2, elements.size()); + + menu.clickItem("first"); + menu.clickItem("second"); + elements = menu.findElements(By.className("custom-menu-item")); + Assert.assertEquals(2, elements.size()); + } +} -- cgit v1.2.3 From ab8a0268652b81b20be8d5dbf0deeb7029e9edec Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Thu, 16 Apr 2015 09:19:16 +0300 Subject: Iterate over copies of listener lists (#17477) Allows adding/removing view change listeners from listeners. Change-Id: Idb2227e1423c0297887f01f6df03b74e633ad917 --- server/src/com/vaadin/navigator/Navigator.java | 11 ++- .../NavigatorListenerModifiesListeners.java | 100 +++++++++++++++++++++ .../NavigatorListenerModifiesListenersTest.java | 68 ++++++++++++++ 3 files changed, 177 insertions(+), 2 deletions(-) create mode 100644 uitest/src/com/vaadin/tests/navigator/NavigatorListenerModifiesListeners.java create mode 100644 uitest/src/com/vaadin/tests/navigator/NavigatorListenerModifiesListenersTest.java (limited to 'uitest/src/com') diff --git a/server/src/com/vaadin/navigator/Navigator.java b/server/src/com/vaadin/navigator/Navigator.java index ef5c61a294..65b3fec488 100644 --- a/server/src/com/vaadin/navigator/Navigator.java +++ b/server/src/com/vaadin/navigator/Navigator.java @@ -32,6 +32,7 @@ package com.vaadin.navigator; */ import java.io.Serializable; +import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -597,7 +598,10 @@ public class Navigator implements Serializable { * block the navigation operation */ protected boolean fireBeforeViewChange(ViewChangeEvent event) { - for (ViewChangeListener l : listeners) { + // a copy of the listener list is needed to avoid + // ConcurrentModificationException as a listener can add/remove + // listeners + for (ViewChangeListener l : new ArrayList(listeners)) { if (!l.beforeViewChange(event)) { return false; } @@ -647,7 +651,10 @@ public class Navigator implements Serializable { * view change event (not null) */ protected void fireAfterViewChange(ViewChangeEvent event) { - for (ViewChangeListener l : listeners) { + // a copy of the listener list is needed to avoid + // ConcurrentModificationException as a listener can add/remove + // listeners + for (ViewChangeListener l : new ArrayList(listeners)) { l.afterViewChange(event); } } diff --git a/uitest/src/com/vaadin/tests/navigator/NavigatorListenerModifiesListeners.java b/uitest/src/com/vaadin/tests/navigator/NavigatorListenerModifiesListeners.java new file mode 100644 index 0000000000..139dbaefb6 --- /dev/null +++ b/uitest/src/com/vaadin/tests/navigator/NavigatorListenerModifiesListeners.java @@ -0,0 +1,100 @@ +package com.vaadin.tests.navigator; + +import com.vaadin.navigator.Navigator; +import com.vaadin.navigator.View; +import com.vaadin.navigator.ViewChangeListener; +import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Label; +import com.vaadin.ui.VerticalLayout; + +public class NavigatorListenerModifiesListeners extends AbstractTestUI { + + private Navigator navigator; + + protected static final String LABEL_MAINVIEW_ID = "LABEL_MAINVIEW_ID"; + protected static final String LABEL_ANOTHERVIEW_ID = "LABEL_ANOTHERVIEW_ID"; + + // NOP view change listener + private class MyViewChangeListener implements ViewChangeListener { + @Override + public boolean beforeViewChange(ViewChangeEvent event) { + navigator.removeViewChangeListener(listener1); + navigator.addViewChangeListener(listener2); + return true; + } + + @Override + public void afterViewChange(ViewChangeEvent event) { + navigator.removeViewChangeListener(listener2); + navigator.addViewChangeListener(listener1); + } + } + + private MyViewChangeListener listener1 = new MyViewChangeListener(); + private MyViewChangeListener listener2 = new MyViewChangeListener(); + + @Override + protected void setup(VaadinRequest request) { + navigator = new Navigator(this, this); + navigator.addView(MainView.NAME, new MainView()); + navigator.addView(AnotherView.NAME, new AnotherView()); + navigator.addViewChangeListener(listener1); + navigator.navigateTo(MainView.NAME); + } + + class MainView extends VerticalLayout implements View { + + public static final String NAME = "mainview"; + + public MainView() { + Label label = new Label("MainView content"); + label.setId(LABEL_MAINVIEW_ID); + addComponent(label); + + Button buttonNavToAnotherView = new Button( + "Navigate to another view", new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + navigator.navigateTo(AnotherView.NAME); + } + }); + addComponent(buttonNavToAnotherView); + } + + @Override + public void enter(ViewChangeEvent event) { + } + + } + + class AnotherView extends VerticalLayout implements View { + + public static final String NAME = "another"; + + public AnotherView() { + Label label = new Label("AnotherView content"); + label.setId(LABEL_ANOTHERVIEW_ID); + addComponent(label); + } + + @Override + public void enter(ViewChangeEvent event) { + } + } + + @Override + protected String getTestDescription() { + return "Adding and removing view change listeners from view change listeners should not cause a ConcurrentModificationException"; + } + + @Override + protected Integer getTicketNumber() { + return 17477; + } +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/navigator/NavigatorListenerModifiesListenersTest.java b/uitest/src/com/vaadin/tests/navigator/NavigatorListenerModifiesListenersTest.java new file mode 100644 index 0000000000..d11ab790a8 --- /dev/null +++ b/uitest/src/com/vaadin/tests/navigator/NavigatorListenerModifiesListenersTest.java @@ -0,0 +1,68 @@ +/* + * 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.navigator; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.tests.tb3.SingleBrowserTest; + +public class NavigatorListenerModifiesListenersTest extends SingleBrowserTest { + + @Test + public void testIfConfirmBack() { + openTestURL(); + + // keep URL of main view + final String initialUrl = driver.getCurrentUrl(); + + // do it 2 times to verify that this is not broken after first time + for (int i = 0; i < 2; i++) { + // go to prompted view + WebElement button = $(ButtonElement.class).first(); + button.click(); + + // verify we are in another view and url is correct + waitForElementPresent(By + .id(NavigatorListenerModifiesListeners.LABEL_ANOTHERVIEW_ID)); + String currentUrl = driver.getCurrentUrl(); + assertEquals( + "Current URL should be equal to another view URL", + initialUrl + .replace( + NavigatorListenerModifiesListeners.MainView.NAME, + NavigatorListenerModifiesListeners.AnotherView.NAME), + currentUrl); + + // click back button + driver.navigate().back(); + + // verify we are in main view and url is correct + // without the fix for #17477, we get + // ConcurrentModificationException + waitForElementPresent(By + .id(NavigatorListenerModifiesListeners.LABEL_MAINVIEW_ID)); + currentUrl = driver.getCurrentUrl(); + assertEquals("Current URL should be equal to the initial view URL", + initialUrl, currentUrl); + } + } + +} -- cgit v1.2.3 From 522c3dd8f3b64e772f7e41205308fc24a56426f4 Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Thu, 5 Mar 2015 13:28:51 +0200 Subject: Convert some TB2 tests to TB4 - components/ui/CurrentUiRetainedTest - components/ui/InitiallyEmptyFragmentTest - components/ui/PollListeningTest - components/ui/RpcInvocationHandlerToStringTest - components/ui/UIAccessExceptionHandlingTest - components/ui/UIInitBrowserDetailsTest - components/ui/UIInitExceptionTest - components/ui/UIPollingTest - components/ui/UITabIndexTest - components/ui/UIsInMultipleTabsTest - components/window/CloseSubWindowTest - components/window/ExtraWindowShownTest - components/window/RepaintWindowContentsTest - components/window/WindowShouldRemoveActionHandlerTest - components/window/WindowWithInvalidCloseListenerTest - containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKeyTest - converter/ConverterThatEnforcesAFormatTest - dd/DnDOnSubtreeTest - fieldgroup/BasicPersonFormTest - fieldgroup/CommitHandlerFailuresTest - fieldgroup/CommitWithValidationOrConversionErrorTest - fieldgroup/DateFormTest - fieldgroup/FieldGroupDiscardTest - fields/TabIndexesTest renamed: - components/ui/PollListenerTest -> PollListening Change-Id: Iac3c153709f6edca28d9f75a85246f1a70176963 --- .../tests/components/ui/CurrentUiRetainedTest.java | 24 ++ .../tests/components/ui/InitialFragmentEvent.java | 45 ++- .../components/ui/InitiallyEmptyFragmentTest.java | 30 ++ .../tests/components/ui/PollListenerTest.java | 54 --- .../vaadin/tests/components/ui/PollListening.java | 54 +++ .../tests/components/ui/PollListeningTest.java | 32 ++ .../ui/RpcInvocationHandlerToString.java | 22 +- .../ui/RpcInvocationHandlerToStringTest.java | 27 ++ .../components/ui/UIAccessExceptionHandling.java | 20 +- .../ui/UIAccessExceptionHandlingTest.java | 39 +++ .../tests/components/ui/UIInitBrowserDetails.java | 13 +- .../components/ui/UIInitBrowserDetailsTest.java | 58 ++++ .../tests/components/ui/UIInitExceptionTest.java | 15 + .../vaadin/tests/components/ui/UIPollingTest.java | 39 +++ .../com/vaadin/tests/components/ui/UITabIndex.java | 15 +- .../vaadin/tests/components/ui/UITabIndexTest.java | 28 ++ .../tests/components/ui/UIsInMultipleTabsTest.java | 25 ++ .../tests/components/window/CloseSubWindow.java | 31 +- .../components/window/CloseSubWindowTest.java | 47 +++ .../tests/components/window/ExtraWindowShown.java | 18 +- .../components/window/ExtraWindowShownTest.java | 37 ++ .../components/window/RepaintWindowContents.java | 4 +- .../window/RepaintWindowContentsTest.java | 36 ++ .../window/WindowShouldRemoveActionHandler.java | 95 +++--- .../WindowShouldRemoveActionHandlerTest.java | 50 +++ .../window/WindowWithInvalidCloseListenerTest.java | 19 ++ .../TableQueryWithNonUniqueFirstPrimaryKey.java | 27 +- ...TableQueryWithNonUniqueFirstPrimaryKeyTest.java | 45 +++ .../converter/ConverterThatEnforcesAFormat.java | 17 +- .../ConverterThatEnforcesAFormatTest.java | 90 +++++ uitest/src/com/vaadin/tests/dd/DDTest8.java | 86 ++--- .../src/com/vaadin/tests/dd/DnDOnSubtreeTest.java | 52 +++ .../vaadin/tests/fieldgroup/BasicPersonForm.java | 24 +- .../tests/fieldgroup/BasicPersonFormTest.java | 173 ++++++++++ .../fieldgroup/CommitHandlerFailuresTest.java | 60 ++++ .../CommitWithValidationOrConversionErrorTest.java | 74 ++++ .../src/com/vaadin/tests/fieldgroup/DateForm.java | 21 +- .../com/vaadin/tests/fieldgroup/DateFormTest.java | 47 +++ .../tests/fieldgroup/FieldGroupDiscardTest.java | 32 ++ uitest/src/com/vaadin/tests/fields/TabIndexes.java | 19 +- .../com/vaadin/tests/fields/TabIndexesTest.java | 164 +++++++++ .../tests/components/ui/CurrentUiRetained.html | 52 --- .../components/ui/InitiallyEmptyFragment.html | 47 --- .../tests/components/ui/PollListenerTest.html | 32 -- .../ui/RpcInvocationHandlerToString.html | 51 --- .../components/ui/UIAccessExceptionHandling.html | 67 ---- .../tests/components/ui/UIInitBrowserDetails.html | 112 ------ .../tests/components/ui/UIInitException.html | 26 -- .../com/vaadin/tests/components/ui/UIPolling.html | 53 --- .../com/vaadin/tests/components/ui/UITabIndex.html | 57 ---- .../tests/components/ui/UIsInMultipleTabs.html | 47 --- .../tests/components/window/CloseSubWindow.html | 53 --- .../tests/components/window/ExtraWindowShown.html | 61 ---- .../components/window/RepaintWindowContents.html | 57 ---- .../window/WindowShouldRemoveActionHandler.html | 107 ------ .../window/WindowWithInvalidCloseListener.html | 32 -- .../TableQueryWithNonUniqueFirstPrimaryKey.html | 67 ---- .../converter/ConverterThatEnforcesAFormat.html | 62 ---- uitest/tb2/com/vaadin/tests/dd/DnDOnSubtree.html | 51 --- .../tests/fieldgroup/CommitHandlerFailures.html | 215 ------------ .../CommitWithValidationOrConversionError.html | 148 -------- .../tb2/com/vaadin/tests/fieldgroup/DateForm.html | 42 --- .../vaadin/tests/fieldgroup/FieldGroupDiscard.html | 164 --------- uitest/tb2/com/vaadin/tests/fields/TabIndexes.html | 376 --------------------- 64 files changed, 1516 insertions(+), 2271 deletions(-) create mode 100644 uitest/src/com/vaadin/tests/components/ui/CurrentUiRetainedTest.java create mode 100644 uitest/src/com/vaadin/tests/components/ui/InitiallyEmptyFragmentTest.java delete mode 100644 uitest/src/com/vaadin/tests/components/ui/PollListenerTest.java create mode 100644 uitest/src/com/vaadin/tests/components/ui/PollListening.java create mode 100644 uitest/src/com/vaadin/tests/components/ui/PollListeningTest.java create mode 100644 uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToStringTest.java create mode 100644 uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandlingTest.java create mode 100644 uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetailsTest.java create mode 100644 uitest/src/com/vaadin/tests/components/ui/UIInitExceptionTest.java create mode 100644 uitest/src/com/vaadin/tests/components/ui/UIPollingTest.java create mode 100644 uitest/src/com/vaadin/tests/components/ui/UITabIndexTest.java create mode 100644 uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabsTest.java create mode 100644 uitest/src/com/vaadin/tests/components/window/CloseSubWindowTest.java create mode 100644 uitest/src/com/vaadin/tests/components/window/ExtraWindowShownTest.java create mode 100644 uitest/src/com/vaadin/tests/components/window/RepaintWindowContentsTest.java create mode 100644 uitest/src/com/vaadin/tests/components/window/WindowShouldRemoveActionHandlerTest.java create mode 100644 uitest/src/com/vaadin/tests/components/window/WindowWithInvalidCloseListenerTest.java create mode 100644 uitest/src/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKeyTest.java create mode 100644 uitest/src/com/vaadin/tests/converter/ConverterThatEnforcesAFormatTest.java create mode 100644 uitest/src/com/vaadin/tests/dd/DnDOnSubtreeTest.java create mode 100644 uitest/src/com/vaadin/tests/fieldgroup/BasicPersonFormTest.java create mode 100644 uitest/src/com/vaadin/tests/fieldgroup/CommitHandlerFailuresTest.java create mode 100644 uitest/src/com/vaadin/tests/fieldgroup/CommitWithValidationOrConversionErrorTest.java create mode 100644 uitest/src/com/vaadin/tests/fieldgroup/DateFormTest.java create mode 100644 uitest/src/com/vaadin/tests/fieldgroup/FieldGroupDiscardTest.java create mode 100644 uitest/src/com/vaadin/tests/fields/TabIndexesTest.java delete mode 100644 uitest/tb2/com/vaadin/tests/components/ui/CurrentUiRetained.html delete mode 100644 uitest/tb2/com/vaadin/tests/components/ui/InitiallyEmptyFragment.html delete mode 100644 uitest/tb2/com/vaadin/tests/components/ui/PollListenerTest.html delete mode 100644 uitest/tb2/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.html delete mode 100644 uitest/tb2/com/vaadin/tests/components/ui/UIAccessExceptionHandling.html delete mode 100644 uitest/tb2/com/vaadin/tests/components/ui/UIInitBrowserDetails.html delete mode 100644 uitest/tb2/com/vaadin/tests/components/ui/UIInitException.html delete mode 100644 uitest/tb2/com/vaadin/tests/components/ui/UIPolling.html delete mode 100644 uitest/tb2/com/vaadin/tests/components/ui/UITabIndex.html delete mode 100644 uitest/tb2/com/vaadin/tests/components/ui/UIsInMultipleTabs.html delete mode 100644 uitest/tb2/com/vaadin/tests/components/window/CloseSubWindow.html delete mode 100644 uitest/tb2/com/vaadin/tests/components/window/ExtraWindowShown.html delete mode 100644 uitest/tb2/com/vaadin/tests/components/window/RepaintWindowContents.html delete mode 100644 uitest/tb2/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.html delete mode 100644 uitest/tb2/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html delete mode 100644 uitest/tb2/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKey.html delete mode 100644 uitest/tb2/com/vaadin/tests/converter/ConverterThatEnforcesAFormat.html delete mode 100644 uitest/tb2/com/vaadin/tests/dd/DnDOnSubtree.html delete mode 100644 uitest/tb2/com/vaadin/tests/fieldgroup/CommitHandlerFailures.html delete mode 100644 uitest/tb2/com/vaadin/tests/fieldgroup/CommitWithValidationOrConversionError.html delete mode 100644 uitest/tb2/com/vaadin/tests/fieldgroup/DateForm.html delete mode 100644 uitest/tb2/com/vaadin/tests/fieldgroup/FieldGroupDiscard.html delete mode 100644 uitest/tb2/com/vaadin/tests/fields/TabIndexes.html (limited to 'uitest/src/com') diff --git a/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetainedTest.java b/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetainedTest.java new file mode 100644 index 0000000000..d4e1ecb5ce --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetainedTest.java @@ -0,0 +1,24 @@ +package com.vaadin.tests.components.ui; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class CurrentUiRetainedTest extends MultiBrowserTest { + @Test + public void testCurrentUiRetained() throws Exception { + openTestURL(); + $(ButtonElement.class).first().click(); + assertLogText(3, "1. Correct UI.getCurrent before GC: true"); + assertLogText(2, "2. Correct UI.getCurrent after GC: true"); + assertLogText(1, "3. GC probe available before GC: true"); + assertLogText(0, "4. GC probe available after GC: false"); + } + + private void assertLogText(int index, String expected) { + Assert.assertEquals("Unexpected log contents,", expected, + getLogRow(index)); + } +} diff --git a/uitest/src/com/vaadin/tests/components/ui/InitialFragmentEvent.java b/uitest/src/com/vaadin/tests/components/ui/InitialFragmentEvent.java index ce8ca8e083..d8d197c881 100644 --- a/uitest/src/com/vaadin/tests/components/ui/InitialFragmentEvent.java +++ b/uitest/src/com/vaadin/tests/components/ui/InitialFragmentEvent.java @@ -3,15 +3,13 @@ package com.vaadin.tests.components.ui; import com.vaadin.server.Page.UriFragmentChangedEvent; import com.vaadin.server.Page.UriFragmentChangedListener; import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.tests.util.Log; +import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; -public class InitialFragmentEvent extends AbstractTestUI { +public class InitialFragmentEvent extends AbstractTestUIWithLog { private String lastKnownFragment = "\"no event received\""; - private Log log = new Log(5); @Override protected void setup(VaadinRequest request) { @@ -22,28 +20,25 @@ public class InitialFragmentEvent extends AbstractTestUI { public void uriFragmentChanged( UriFragmentChangedEvent source) { String newFragment = source.getUriFragment(); - log.log("Fragment changed from " + lastKnownFragment + log("Fragment changed from " + lastKnownFragment + " to " + newFragment); lastKnownFragment = newFragment; } }); - addComponent(log); - addComponent(new Button("Set fragment to 'foo'", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - setFragment("foo"); - } - })); - addComponent(new Button("Set fragment to 'bar'", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - setFragment("bar"); - } - })); + addButton("Set fragment to 'foo'", new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + setFragment("foo"); + } + }); + addButton("Set fragment to 'bar'", new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + setFragment("bar"); + } + }); } protected void setFragment(String fragment) { @@ -52,14 +47,12 @@ public class InitialFragmentEvent extends AbstractTestUI { @Override protected Integer getTicketNumber() { - // TODO Auto-generated method stub - return null; + return 9558; } @Override protected String getTestDescription() { - // TODO Auto-generated method stub - return null; + return "URI fragment handling should fire for initial fragment change"; } } diff --git a/uitest/src/com/vaadin/tests/components/ui/InitiallyEmptyFragmentTest.java b/uitest/src/com/vaadin/tests/components/ui/InitiallyEmptyFragmentTest.java new file mode 100644 index 0000000000..fc948ab3db --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/InitiallyEmptyFragmentTest.java @@ -0,0 +1,30 @@ +package com.vaadin.tests.components.ui; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class InitiallyEmptyFragmentTest extends MultiBrowserTest { + + @Override + protected Class getUIClass() { + return InitialFragmentEvent.class; + } + + @Test + public void testNoFragmentChangeEventWhenInitiallyEmpty() throws Exception { + openTestURL(); + /* + * There is no fragment change event when the fragment is initially + * empty + */ + assertLogText(" "); + executeScript("window.location.hash='bar'"); + assertLogText("1. Fragment changed from \"no event received\" to bar"); + } + + private void assertLogText(String expected) { + Assert.assertEquals("Unexpected log contents,", expected, getLogRow(0)); + } +} diff --git a/uitest/src/com/vaadin/tests/components/ui/PollListenerTest.java b/uitest/src/com/vaadin/tests/components/ui/PollListenerTest.java deleted file mode 100644 index c5861147a5..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/PollListenerTest.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.components.ui; - -import com.vaadin.event.UIEvents.PollEvent; -import com.vaadin.event.UIEvents.PollListener; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Label; - -public class PollListenerTest extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - final Label statusLabel = new Label("Default Label"); - addComponent(statusLabel); - - setPollInterval(2000); - addPollListener(new PollListener() { - @Override - public void poll(PollEvent event) { - setPollInterval(-1); - statusLabel.setValue(event.getClass().getSimpleName() - + " received"); - removePollListener(this); - } - }); - } - - @Override - protected String getTestDescription() { - return "Polling should fire a PollEvent on the server-side"; - } - - @Override - protected Integer getTicketNumber() { - return 12466; - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/PollListening.java b/uitest/src/com/vaadin/tests/components/ui/PollListening.java new file mode 100644 index 0000000000..1ec4f4d9f7 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/PollListening.java @@ -0,0 +1,54 @@ +/* + * 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.ui; + +import com.vaadin.event.UIEvents.PollEvent; +import com.vaadin.event.UIEvents.PollListener; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Label; + +public class PollListening extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final Label statusLabel = new Label("Default Label"); + addComponent(statusLabel); + + setPollInterval(2000); + addPollListener(new PollListener() { + @Override + public void poll(PollEvent event) { + setPollInterval(-1); + statusLabel.setValue(event.getClass().getSimpleName() + + " received"); + removePollListener(this); + } + }); + } + + @Override + protected String getTestDescription() { + return "Polling should fire a PollEvent on the server-side"; + } + + @Override + protected Integer getTicketNumber() { + return 12466; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/ui/PollListeningTest.java b/uitest/src/com/vaadin/tests/components/ui/PollListeningTest.java new file mode 100644 index 0000000000..5770570ed1 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/PollListeningTest.java @@ -0,0 +1,32 @@ +package com.vaadin.tests.components.ui; + +import org.junit.Test; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.ui.ExpectedCondition; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class PollListeningTest extends MultiBrowserTest { + + @Test + public void testReceivePollEvent() { + openTestURL(); + waitUntilPollEventReceived(); + } + + private void waitUntilPollEventReceived() { + waitUntil(new ExpectedCondition() { + private String expected = "PollEvent received"; + + @Override + public Boolean apply(WebDriver arg0) { + return driver.getPageSource().contains(expected); + } + + @Override + public String toString() { + return String.format("page to contain text '%s'", expected); + } + }); + } +} diff --git a/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.java b/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.java index 40ec51cf1f..1dbcc0ab2b 100644 --- a/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.java +++ b/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.java @@ -17,48 +17,42 @@ package com.vaadin.tests.components.ui; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.ui.PageClientRpc; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.tests.util.Log; +import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; -public class RpcInvocationHandlerToString extends AbstractTestUI { +public class RpcInvocationHandlerToString extends AbstractTestUIWithLog { - private Log log = new Log(5); PageClientRpc dummyProxy = getRpcProxy(PageClientRpc.class); @Override protected void setup(VaadinRequest request) { - addComponent(log); - Button b = new Button("Exec toString() for an invocation proxy", + addButton("Exec toString() for an invocation proxy", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { - log.log("An invoation proxy: " + dummyProxy.toString()); + log("An invoation proxy: " + dummyProxy.toString()); } }); - addComponent(b); - b = new Button("Exec hashCode() for an invocation proxy", + addButton("Exec hashCode() for an invocation proxy", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { - log.log("Invocation proxy.hashCode(): " + log("Invocation proxy.hashCode(): " + dummyProxy.hashCode()); } }); - addComponent(b); - b = new Button("Exec equals(false) for an invocation proxy", + addButton("Exec equals(false) for an invocation proxy", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { - log.log("Invocation proxy.equals(false): " + log("Invocation proxy.equals(false): " + dummyProxy.equals(false)); } }); - addComponent(b); } @Override diff --git a/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToStringTest.java b/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToStringTest.java new file mode 100644 index 0000000000..10a297d47b --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToStringTest.java @@ -0,0 +1,27 @@ +package com.vaadin.tests.components.ui; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.NotificationElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class RpcInvocationHandlerToStringTest extends MultiBrowserTest { + @Test + public void testMethodsOnInvocationProxy() throws Exception { + openTestURL(); + execMethodForProxy("toString()"); + execMethodForProxy("hashCode()"); + execMethodForProxy("equals(false)"); + } + + private void execMethodForProxy(String method) { + $(ButtonElement.class) + .caption("Exec " + method + " for an invocation proxy").first() + .click(); + Assert.assertFalse(method + + " for invocation proxy caused a notification", + $(NotificationElement.class).exists()); + } +} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandling.java b/uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandling.java index 7fb5f9cd9d..bd18d93328 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandling.java +++ b/uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandling.java @@ -128,13 +128,22 @@ public class UIAccessExceptionHandling extends AbstractTestUIWithLog implements } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { - log("Exception catched on get: " + e.getClass().getName()); + log("Exception caught on get: " + e.getClass().getName()); } finally { future = null; } } } + @Override + public void error(com.vaadin.server.ErrorEvent event) { + log("Exception caught on execution with " + + event.getClass().getSimpleName() + " : " + + event.getThrowable().getClass().getName()); + + DefaultErrorHandler.doDefault(event); + } + @Override protected String getTestDescription() { return "Test for handling exceptions in UI.access and Session.access"; @@ -145,13 +154,4 @@ public class UIAccessExceptionHandling extends AbstractTestUIWithLog implements return Integer.valueOf(12703); } - @Override - public void error(com.vaadin.server.ErrorEvent event) { - log("Exception catched on execution with " - + event.getClass().getSimpleName() + " : " - + event.getThrowable().getClass().getName()); - - DefaultErrorHandler.doDefault(event); - } - } diff --git a/uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandlingTest.java b/uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandlingTest.java new file mode 100644 index 0000000000..b49de55a56 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandlingTest.java @@ -0,0 +1,39 @@ +package com.vaadin.tests.components.ui; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class UIAccessExceptionHandlingTest extends MultiBrowserTest { + + @Test + public void testExceptionHandlingOnUIAccess() throws Exception { + openTestURL(); + $(ButtonElement.class).first().click(); + assertLogTexts( + "1. Exception caught on get: java.util.concurrent.ExecutionException", + "0. Exception caught on execution with ConnectorErrorEvent : java.util.concurrent.ExecutionException"); + + $(ButtonElement.class).get(1).click(); + assertLogTexts( + "1. Exception caught on get: java.util.concurrent.ExecutionException", + "0. Exception caught on execution with ErrorEvent : java.util.concurrent.ExecutionException"); + + $(ButtonElement.class).get(2).click(); + assertLogTexts( + "1. Exception caught on get: java.util.concurrent.ExecutionException", + "0. Exception caught on execution with ConnectorErrorEvent : java.util.concurrent.ExecutionException"); + } + + private void assertLogTexts(String first, String second) { + assertLogText(0, first); + assertLogText(1, second); + } + + private void assertLogText(int index, String expected) { + Assert.assertEquals("Unexpected log contents,", expected, + getLogRow(index)); + } +} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.java b/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.java index df537145cf..130d432940 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.java +++ b/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.java @@ -39,6 +39,14 @@ public class UIInitBrowserDetails extends AbstractTestUI { addDetail("current date", "v-curdate", wb.getCurrentDate()); } + private void addDetail(String name, String param, Object value) { + Label requestLabel = new Label(r.getParameter(param)); + requestLabel.setId(param); + Label browserLabel = new Label("" + value); + browserLabel.setId(name); + l.addComponents(new Label(name), requestLabel, browserLabel); + } + @Override public String getTestDescription() { return "Browser details should be available in UI init"; @@ -48,9 +56,4 @@ public class UIInitBrowserDetails extends AbstractTestUI { protected Integer getTicketNumber() { return Integer.valueOf(9037); } - - private void addDetail(String name, String param, Object value) { - l.addComponents(new Label(name), new Label(r.getParameter(param)), - new Label("" + value)); - } } diff --git a/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetailsTest.java b/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetailsTest.java new file mode 100644 index 0000000000..1e69662935 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetailsTest.java @@ -0,0 +1,58 @@ +package com.vaadin.tests.components.ui; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.testbench.elements.LabelElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class UIInitBrowserDetailsTest extends MultiBrowserTest { + + @Test + public void testBrowserDetails() throws Exception { + openTestURL(); + /* location */ + compareRequestAndBrowserValue("v-loc", "location", "null"); + /* browser window width */ + compareRequestAndBrowserValue("v-cw", "browser window width", "-1"); + /* browser window height */ + compareRequestAndBrowserValue("v-ch", "browser window height", "-1"); + /* screen width */ + compareRequestAndBrowserValue("v-sw", "screen width", "-1"); + /* screen height */ + compareRequestAndBrowserValue("v-sh", "screen height", "-1"); + /* timezone offset */ + assertTextNotNull("timezone offset"); + /* raw timezone offset */ + assertTextNotNull("raw timezone offset"); + /* dst saving */ + assertTextNotNull("dst saving"); + /* dst in effect */ + assertTextNotNull("dst in effect"); + /* current date */ + assertTextNotNull("v-curdate"); + assertTextNotNull("current date"); + } + + private void compareRequestAndBrowserValue(String paramName, + String browserName, String errorValue) { + assertTextNotEquals(browserName, errorValue); + Assert.assertEquals(String.format( + "Browser and request values differ in '%s',", browserName), + getLabelText(paramName), getLabelText(browserName)); + } + + private String getLabelText(String id) { + return $(LabelElement.class).id(id).getText(); + } + + private void assertTextNotNull(String id) { + assertTextNotEquals(id, "null"); + } + + private void assertTextNotEquals(String id, String notExpected) { + String actual = getLabelText(id); + Assert.assertNotEquals(String.format("Unexpected value for '%s'", id), + notExpected, actual); + } +} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIInitExceptionTest.java b/uitest/src/com/vaadin/tests/components/ui/UIInitExceptionTest.java new file mode 100644 index 0000000000..d002642a74 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/UIInitExceptionTest.java @@ -0,0 +1,15 @@ +package com.vaadin.tests.components.ui; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class UIInitExceptionTest extends MultiBrowserTest { + @Test + public void testExceptionOnUIInit() throws Exception { + openTestURL(); + Assert.assertTrue("Page does not contain the given text", driver + .getPageSource().contains("Catch me if you can")); + } +} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIPollingTest.java b/uitest/src/com/vaadin/tests/components/ui/UIPollingTest.java new file mode 100644 index 0000000000..c4a41d135a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/UIPollingTest.java @@ -0,0 +1,39 @@ +package com.vaadin.tests.components.ui; + +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.remote.DesiredCapabilities; + +import com.vaadin.testbench.elements.TextFieldElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class UIPollingTest extends MultiBrowserTest { + + @Override + public List getBrowsersToTest() { + // Manually testing IE8 stops polling with -1, but with automated test + // it seems to be highly unpredictable. + return super.getBrowsersExcludingIE8(); + } + + @Test + public void testPolling() throws Exception { + openTestURL(); + getTextField().setValue("500"); + sleep(2000); + /* Ensure polling has taken place */ + Assert.assertTrue("Page does not contain the given text", driver + .getPageSource().contains("2. 1000ms has passed")); + getTextField().setValue("-1"); + sleep(2000); + /* Ensure polling has stopped */ + Assert.assertFalse("Page contains the given text", driver + .getPageSource().contains("20. 10000ms has passed")); + } + + public TextFieldElement getTextField() { + return $(TextFieldElement.class).first(); + } +} diff --git a/uitest/src/com/vaadin/tests/components/ui/UITabIndex.java b/uitest/src/com/vaadin/tests/components/ui/UITabIndex.java index 083eaf3f7d..c3bb036966 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UITabIndex.java +++ b/uitest/src/com/vaadin/tests/components/ui/UITabIndex.java @@ -2,7 +2,6 @@ package com.vaadin.tests.components.ui; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -10,32 +9,24 @@ public class UITabIndex extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - Button b; - - b = new Button("Set tabIndex to -1"); - b.addClickListener(new ClickListener() { + addButton("Set tabIndex to -1", new ClickListener() { @Override public void buttonClick(ClickEvent event) { setTabIndex(-1); } }); - addComponent(b); - b = new Button("Set tabIndex to 0"); - b.addClickListener(new ClickListener() { + addButton("Set tabIndex to 0", new ClickListener() { @Override public void buttonClick(ClickEvent event) { setTabIndex(0); } }); - addComponent(b); - b = new Button("Set tabIndex to 1"); - b.addClickListener(new ClickListener() { + addButton("Set tabIndex to 1", new ClickListener() { @Override public void buttonClick(ClickEvent event) { setTabIndex(1); } }); - addComponent(b); } @Override diff --git a/uitest/src/com/vaadin/tests/components/ui/UITabIndexTest.java b/uitest/src/com/vaadin/tests/components/ui/UITabIndexTest.java new file mode 100644 index 0000000000..390907ee8a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/UITabIndexTest.java @@ -0,0 +1,28 @@ +package com.vaadin.tests.components.ui; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.UIElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class UITabIndexTest extends MultiBrowserTest { + + @Test + public void testTabIndexOnUIRoot() throws Exception { + openTestURL(); + assertTabIndex("1"); + $(ButtonElement.class).first().click(); + assertTabIndex("-1"); + $(ButtonElement.class).get(1).click(); + assertTabIndex("0"); + $(ButtonElement.class).get(2).click(); + assertTabIndex("1"); + } + + private void assertTabIndex(String expected) { + Assert.assertEquals("Unexpected tab index,", expected, + $(UIElement.class).first().getAttribute("tabIndex")); + } +} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabsTest.java b/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabsTest.java new file mode 100644 index 0000000000..e703deb634 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabsTest.java @@ -0,0 +1,25 @@ +package com.vaadin.tests.components.ui; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.testbench.elements.LabelElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class UIsInMultipleTabsTest extends MultiBrowserTest { + + @Test + public void testPageReloadChangesUI() throws Exception { + openTestURL(); + assertUI(1); + openTestURL(); + assertUI(2); + openTestURL("restartApplication"); + assertUI(1); + } + + private void assertUI(int i) { + Assert.assertEquals("Unexpected UI found,", "This is UI number " + i, + $(LabelElement.class).first().getText()); + } +} diff --git a/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java b/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java index 6aad3e9170..83eebc4531 100644 --- a/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java +++ b/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java @@ -1,7 +1,7 @@ package com.vaadin.tests.components.window; -import com.vaadin.tests.components.TestBase; -import com.vaadin.tests.util.Log; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -10,23 +10,20 @@ import com.vaadin.ui.Window; import com.vaadin.ui.Window.CloseEvent; import com.vaadin.ui.Window.CloseListener; -public class CloseSubWindow extends TestBase { - - private Log log = new Log(5); +public class CloseSubWindow extends AbstractTestUIWithLog { @Override - protected void setup() { + protected void setup(VaadinRequest request) { Button openWindowButton = new Button("Open sub-window"); openWindowButton.setId("opensub"); - openWindowButton.addListener(new ClickListener() { + openWindowButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { Window sub = createClosableSubWindow("Sub-window"); - getMainWindow().addWindow(sub); + getUI().addWindow(sub); } }); - addComponent(log); addComponent(openWindowButton); } @@ -39,7 +36,7 @@ public class CloseSubWindow extends TestBase { window.setClosable(true); Button closeButton = new Button("Close"); - closeButton.addListener(new ClickListener() { + closeButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { event.getButton().findAncestor(Window.class).close(); @@ -47,19 +44,19 @@ public class CloseSubWindow extends TestBase { }); layout.addComponent(closeButton); - Button removeButton = new Button("Remove from parent"); - removeButton.addListener(new ClickListener() { + Button removeButton = new Button("Remove from UI"); + removeButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { - window.close(); + getUI().removeWindow(window); } }); - layout.addComponent(closeButton); + layout.addComponent(removeButton); - window.addListener(new CloseListener() { + window.addCloseListener(new CloseListener() { @Override public void windowClose(CloseEvent e) { - log.log("Window '" + title + "' closed"); + log("Window '" + title + "' closed"); } }); @@ -67,7 +64,7 @@ public class CloseSubWindow extends TestBase { } @Override - protected String getDescription() { + protected String getTestDescription() { return "Close sub-windows both from code and with the close button in the window title bar, and check for close events. Contains an ugly workaround for the Opera bug (Opera does not send close events)"; } diff --git a/uitest/src/com/vaadin/tests/components/window/CloseSubWindowTest.java b/uitest/src/com/vaadin/tests/components/window/CloseSubWindowTest.java new file mode 100644 index 0000000000..48ac923082 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/CloseSubWindowTest.java @@ -0,0 +1,47 @@ +package com.vaadin.tests.components.window; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.WindowElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class CloseSubWindowTest extends MultiBrowserTest { + + @Override + public void setup() throws Exception { + super.setup(); + openTestURL(); + openSubWindow(); + } + + @Test + public void testClosingFromClickHandler() throws Exception { + $(WindowElement.class).$(ButtonElement.class).first().click(); + assertLogText(); + } + + @Test + public void testClosingFromTitleBar() throws Exception { + $(WindowElement.class).first() + .findElement(By.className("v-window-closebox")).click(); + assertLogText(); + } + + @Test + public void testClosingByRemovingFromUI() throws Exception { + $(WindowElement.class).$(ButtonElement.class).get(1).click(); + assertLogText(); + } + + private void openSubWindow() { + $(ButtonElement.class).id("opensub").click(); + } + + private void assertLogText() { + Assert.assertEquals("Unexpected log contents,", + "1. Window 'Sub-window' closed", getLogRow(0)); + } +} diff --git a/uitest/src/com/vaadin/tests/components/window/ExtraWindowShown.java b/uitest/src/com/vaadin/tests/components/window/ExtraWindowShown.java index 35a4b8c761..92fbcffd01 100644 --- a/uitest/src/com/vaadin/tests/components/window/ExtraWindowShown.java +++ b/uitest/src/com/vaadin/tests/components/window/ExtraWindowShown.java @@ -1,17 +1,18 @@ package com.vaadin.tests.components.window; import com.vaadin.server.ThemeResource; -import com.vaadin.tests.components.TestBase; +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.Button.ClickEvent; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.Window; -public class ExtraWindowShown extends TestBase { +public class ExtraWindowShown extends AbstractTestUI { @Override - protected void setup() { + protected void setup(VaadinRequest request) { Button b = new Button("Open window", new Button.ClickListener() { @Override @@ -37,21 +38,20 @@ public class ExtraWindowShown extends TestBase { } }); - getLayout().setHeight("100%"); + getLayout().getParent().setSizeFull(); + getLayout().setSizeFull(); getLayout().addComponent(b); getLayout().setComponentAlignment(b, Alignment.MIDDLE_CENTER); } @Override - protected String getDescription() { - // TODO Auto-generated method stub - return null; + protected String getTestDescription() { + return "Sub window shouldn't reappear after closing."; } @Override protected Integer getTicketNumber() { - // TODO Auto-generated method stub - return null; + return 5987; } } diff --git a/uitest/src/com/vaadin/tests/components/window/ExtraWindowShownTest.java b/uitest/src/com/vaadin/tests/components/window/ExtraWindowShownTest.java new file mode 100644 index 0000000000..abbc7ddac0 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/ExtraWindowShownTest.java @@ -0,0 +1,37 @@ +package com.vaadin.tests.components.window; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.WindowElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class ExtraWindowShownTest extends MultiBrowserTest { + + @Test + public void testNoExtraWindowAfterClosing() throws Exception { + openTestURL(); + + openWindow(); + closeWindow(); + assertNoWindow(); + + openWindow(); + closeWindow(); + assertNoWindow(); + } + + private void openWindow() { + $(ButtonElement.class).first().click(); + } + + private void closeWindow() { + $(WindowElement.class).$(ButtonElement.class).first().click(); + } + + private void assertNoWindow() { + Assert.assertFalse("Window found when there should be none.", + $(WindowElement.class).exists()); + } +} diff --git a/uitest/src/com/vaadin/tests/components/window/RepaintWindowContents.java b/uitest/src/com/vaadin/tests/components/window/RepaintWindowContents.java index 99aa15b47d..18fe8f2fac 100644 --- a/uitest/src/com/vaadin/tests/components/window/RepaintWindowContents.java +++ b/uitest/src/com/vaadin/tests/components/window/RepaintWindowContents.java @@ -28,7 +28,7 @@ public class RepaintWindowContents extends AbstractTestUI { window.setContent(layout1); - button1.addListener(new ClickListener() { + button1.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { @@ -36,7 +36,7 @@ public class RepaintWindowContents extends AbstractTestUI { } }); - button2.addListener(new ClickListener() { + button2.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { diff --git a/uitest/src/com/vaadin/tests/components/window/RepaintWindowContentsTest.java b/uitest/src/com/vaadin/tests/components/window/RepaintWindowContentsTest.java new file mode 100644 index 0000000000..d097aa183c --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/RepaintWindowContentsTest.java @@ -0,0 +1,36 @@ +package com.vaadin.tests.components.window; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.WindowElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class RepaintWindowContentsTest extends MultiBrowserTest { + + @Test + public void testRepaintWindowContents() throws Exception { + openTestURL(); + assertWindowContents("Button 1"); + toggleWindowContents(); + assertWindowContents("Button 2"); + toggleWindowContents(); + assertWindowContents("Button 1"); + toggleWindowContents(); + assertWindowContents("Button 2"); + } + + private void toggleWindowContents() { + getWindowButton().click(); + } + + private void assertWindowContents(String expected) { + Assert.assertEquals("Unexpected window contents,", expected, + getWindowButton().getText()); + } + + private ButtonElement getWindowButton() { + return $(WindowElement.class).$(ButtonElement.class).first(); + } +} diff --git a/uitest/src/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.java b/uitest/src/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.java index fa01706c56..ba991eebec 100644 --- a/uitest/src/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.java +++ b/uitest/src/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.java @@ -7,15 +7,19 @@ import com.vaadin.event.Action; import com.vaadin.event.Action.Handler; import com.vaadin.event.ShortcutAction; import com.vaadin.event.ShortcutAction.ModifierKey; -import com.vaadin.tests.components.TestBase; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.MarginInfo; +import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Label; +import com.vaadin.ui.Notification; import com.vaadin.ui.TextField; -public class WindowShouldRemoveActionHandler extends TestBase { +public class WindowShouldRemoveActionHandler extends AbstractTestUI { @Override - protected String getDescription() { + protected String getTestDescription() { return "Adding action handlers to the window should make them appear on the client side. Removing the action handlers should remove them also from the client side, also if all action handlers are removed."; } @@ -24,54 +28,49 @@ public class WindowShouldRemoveActionHandler extends TestBase { return 2941; } + private Label state; + @Override - protected void setup() { - addComponent(new TextField()); - Button add = new Button("Add an action handler", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - add(); - } - - }); - Button addAnother = new Button("Add another action handler", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - addAnother(); - } - - }); - Button remove = new Button("Remove an action handler", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - remove(); - } - - }); - - addComponent(add); - addComponent(addAnother); - addComponent(remove); + protected void setup(VaadinRequest request) { + getLayout().setMargin(new MarginInfo(true, false, false, false)); + state = new Label("An UI with no action handlers."); + state.setId("state"); + addComponents(state, new TextField()); + + addButton("Add an action handler", new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + add(); + } + + }); + addButton("Add another action handler", new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + addAnother(); + } + + }); + addButton("Remove an action handler", new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + remove(); + } + + }); } public void remove() { - getMainWindow().setCaption( - getMainWindow().getCaption() + " - Removed handler"); - getMainWindow().removeActionHandler( - actionHandlers.remove(actionHandlers.size() - 1)); + state.setValue(state.getValue() + " - Removed handler"); + removeActionHandler(actionHandlers.remove(actionHandlers.size() - 1)); } private List actionHandlers = new ArrayList(); public void add() { - getMainWindow().setCaption( - getMainWindow().getCaption() + " - Added handler"); Handler actionHandler = new Handler() { @Override @@ -83,8 +82,7 @@ public class WindowShouldRemoveActionHandler extends TestBase { @Override public void handleAction(Action action, Object sender, Object target) { - getMainWindow().showNotification( - "Handling action " + action.getCaption()); + Notification.show("Handling action " + action.getCaption()); } }; @@ -104,8 +102,7 @@ public class WindowShouldRemoveActionHandler extends TestBase { @Override public void handleAction(Action action, Object sender, Object target) { - getMainWindow().showNotification( - "Handling action " + action.getCaption()); + Notification.show("Handling action " + action.getCaption()); } }; @@ -115,9 +112,9 @@ public class WindowShouldRemoveActionHandler extends TestBase { private void addHandler(Handler actionHandler) { actionHandlers.add(actionHandler); - getMainWindow().addActionHandler(actionHandler); - getMainWindow().setCaption( - "A panel with " + actionHandlers.size() + " action handlers"); + addActionHandler(actionHandler); + state.setValue("An UI with " + actionHandlers.size() + + " action handlers"); } } diff --git a/uitest/src/com/vaadin/tests/components/window/WindowShouldRemoveActionHandlerTest.java b/uitest/src/com/vaadin/tests/components/window/WindowShouldRemoveActionHandlerTest.java new file mode 100644 index 0000000000..755a4242ed --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/WindowShouldRemoveActionHandlerTest.java @@ -0,0 +1,50 @@ +package com.vaadin.tests.components.window; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.LabelElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class WindowShouldRemoveActionHandlerTest extends MultiBrowserTest { + + @Test + public void testRemovingActionHandlers() { + openTestURL(); + + addActionHandler(); + addAnotherActionHandler(); + + assertState("An UI with 2 action handlers"); + addActionHandler(); + + assertState("An UI with 3 action handlers"); + removeActionHandler(); + removeActionHandler(); + + assertState("An UI with 3 action handlers - Removed handler - Removed handler"); + addActionHandler(); + + assertState("An UI with 2 action handlers"); + } + + private void removeActionHandler() { + $(ButtonElement.class).caption("Remove an action handler").first() + .click(); + } + + private void addAnotherActionHandler() { + $(ButtonElement.class).caption("Add another action handler").first() + .click(); + } + + private void addActionHandler() { + $(ButtonElement.class).caption("Add an action handler").first().click(); + } + + private void assertState(String expected) { + Assert.assertEquals("Unexpected state,", expected, + $(LabelElement.class).id("state").getText()); + } +} diff --git a/uitest/src/com/vaadin/tests/components/window/WindowWithInvalidCloseListenerTest.java b/uitest/src/com/vaadin/tests/components/window/WindowWithInvalidCloseListenerTest.java new file mode 100644 index 0000000000..b77eced9cc --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/WindowWithInvalidCloseListenerTest.java @@ -0,0 +1,19 @@ +package com.vaadin.tests.components.window; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; + +import com.vaadin.testbench.elements.WindowElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class WindowWithInvalidCloseListenerTest extends MultiBrowserTest { + @Test + public void testWindowClosesCorrectly() throws Exception { + openTestURL(); + $(WindowElement.class).first() + .findElement(By.className("v-window-closebox")).click(); + Assert.assertFalse("Window found when there should be none.", + $(WindowElement.class).exists()); + } +} diff --git a/uitest/src/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKey.java b/uitest/src/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKey.java index da3476610b..2ff74a76ef 100644 --- a/uitest/src/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKey.java +++ b/uitest/src/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKey.java @@ -12,17 +12,15 @@ import com.vaadin.data.util.sqlcontainer.SQLContainer; import com.vaadin.data.util.sqlcontainer.connection.JDBCConnectionPool; import com.vaadin.data.util.sqlcontainer.connection.SimpleJDBCConnectionPool; import com.vaadin.data.util.sqlcontainer.query.TableQuery; -import com.vaadin.server.LegacyApplication; +import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.combobox.FilteringMode; +import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.ComboBox; -import com.vaadin.ui.LegacyWindow; -import com.vaadin.ui.VerticalLayout; -public class TableQueryWithNonUniqueFirstPrimaryKey extends LegacyApplication { +public class TableQueryWithNonUniqueFirstPrimaryKey extends AbstractTestUI { + @Override - public void init() { - LegacyWindow mainWindow = new LegacyWindow("Test Application"); - setMainWindow(mainWindow); + public void setup(VaadinRequest request) { try { JDBCConnectionPool connectionPool = new SimpleJDBCConnectionPool( @@ -41,9 +39,6 @@ public class TableQueryWithNonUniqueFirstPrimaryKey extends LegacyApplication { myContainer.removeAllContainerFilters(); myContainer.addContainerFilter(new Equal("PFX", "C")); - VerticalLayout layout = new VerticalLayout(); - mainWindow.setContent(layout); - final ComboBox myCombo = new ComboBox("MyCaption"); myCombo.setDescription("Description"); myCombo.setContainerDataSource(myContainer); @@ -64,7 +59,7 @@ public class TableQueryWithNonUniqueFirstPrimaryKey extends LegacyApplication { } } }); - layout.addComponent(myCombo); + addComponent(myCombo); } catch (Exception ex) { ex.printStackTrace(); } @@ -122,4 +117,14 @@ public class TableQueryWithNonUniqueFirstPrimaryKey extends LegacyApplication { connectionPool.releaseConnection(conn); } } + + @Override + protected String getTestDescription() { + return "Ensure unique ordering when using TableQuery with multiple primary key columns."; + } + + @Override + protected Integer getTicketNumber() { + return 10878; + } } diff --git a/uitest/src/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKeyTest.java b/uitest/src/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKeyTest.java new file mode 100644 index 0000000000..172d83e645 --- /dev/null +++ b/uitest/src/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKeyTest.java @@ -0,0 +1,45 @@ +package com.vaadin.tests.containers.sqlcontainer; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.ComboBoxElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class TableQueryWithNonUniqueFirstPrimaryKeyTest extends + MultiBrowserTest { + + private static final String[] DATA = { "TARUSCIO GIOVANNI", + "RUSSO GAETANO AUTORICAMBI", "AMORUSO LUIGI SRL", "CARUSO ROCCO", + "F.LLI RUSSO DI GAETANO RUSSO & C", "RUSSO GIUSEPPE", + "TRUSCELLI ANTONIO", "CARUSO CALOGERO" }; + + @Test + public void testComboBoxSuggestionsListedCorrectly() throws Exception { + openTestURL(); + $(ComboBoxElement.class).first().findElement(By.vaadin("#textbox")) + .sendKeys("rus", Keys.ENTER); + + List result = new ArrayList(); + + // pick list items that are shown in suggestion popup + List elems = findElements(By + .cssSelector("td[role=\"listitem\"]")); + Assert.assertEquals("not enough suggestions shown", DATA.length, + elems.size()); + + for (WebElement elem : elems) { + result.add(elem.getText()); + } + + Assert.assertArrayEquals("popup items not what they should be", DATA, + result.toArray()); + + } +} diff --git a/uitest/src/com/vaadin/tests/converter/ConverterThatEnforcesAFormat.java b/uitest/src/com/vaadin/tests/converter/ConverterThatEnforcesAFormat.java index a37aa521ba..9d0c835c68 100644 --- a/uitest/src/com/vaadin/tests/converter/ConverterThatEnforcesAFormat.java +++ b/uitest/src/com/vaadin/tests/converter/ConverterThatEnforcesAFormat.java @@ -4,24 +4,24 @@ import java.util.Locale; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.tests.components.TestBase; -import com.vaadin.tests.util.Log; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.TextField; -public class ConverterThatEnforcesAFormat extends TestBase { - - private Log log = new Log(5); +public class ConverterThatEnforcesAFormat extends AbstractTestUIWithLog { @Override - protected void setup() { + protected void setup(VaadinRequest request) { final TextField tf = new TextField( "This field should always be formatted with 3 digits"); tf.setLocale(Locale.ENGLISH); + // this is needed so that IE tests pass + tf.setNullRepresentation(""); tf.setConverter(new StringToDoubleConverterWithThreeFractionDigits()); tf.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { - log.log("Value changed to " + log("Value changed to " + event.getProperty().getValue() + "(converted value is " + tf.getConvertedValue() @@ -33,13 +33,12 @@ public class ConverterThatEnforcesAFormat extends TestBase { } }); tf.setImmediate(true); - addComponent(log); addComponent(tf); tf.setConvertedValue(50.0); } @Override - protected String getDescription() { + protected String getTestDescription() { return "Entering a valid double in the field should always cause the field contents to be formatted to contain 3 digits after the decimal point"; } diff --git a/uitest/src/com/vaadin/tests/converter/ConverterThatEnforcesAFormatTest.java b/uitest/src/com/vaadin/tests/converter/ConverterThatEnforcesAFormatTest.java new file mode 100644 index 0000000000..886e96700a --- /dev/null +++ b/uitest/src/com/vaadin/tests/converter/ConverterThatEnforcesAFormatTest.java @@ -0,0 +1,90 @@ +package com.vaadin.tests.converter; + +import org.junit.Test; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.ui.ExpectedCondition; + +import com.vaadin.testbench.elements.TextFieldElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class ConverterThatEnforcesAFormatTest extends MultiBrowserTest { + + private TextFieldElement field; + + @Override + public void setup() throws Exception { + super.setup(); + openTestURL(); + field = $(TextFieldElement.class).first(); + } + + @Test + public void checkDefault() { + waitUntilValueIs("50.000"); + } + + @Test + public void checkRounding() { + setValue("50.0202", Keys.ENTER); + waitUntilValueIs("50.020"); + } + + @Test + public void checkElaborating() { + setValue("12"); + waitUntilValueIs("12.000"); + } + + @Test + public void checkText() { + setValue("abc", Keys.ENTER); + waitUntilValueIs("abc"); + waitUntilHasCssClass("v-textfield-error"); + } + + private void setValue(String value, CharSequence... keysToSend) { + field.setValue(value); + if (keysToSend.length > 0) { + field.sendKeys(keysToSend); + } else { + field.submit(); + } + } + + private void waitUntilValueIs(final String expected) { + waitUntil(new ExpectedCondition() { + private String actual; + + @Override + public Boolean apply(WebDriver arg0) { + actual = field.getValue(); + return expected.equals(actual); + } + + @Override + public String toString() { + return String.format( + "the field to have value '%s' (was: '%s')", expected, + actual); + } + }); + } + + private void waitUntilHasCssClass(final String className) { + waitUntil(new ExpectedCondition() { + + @Override + public Boolean apply(WebDriver arg0) { + return hasCssClass(field, className); + } + + @Override + public String toString() { + return String.format("the field to have css class '%s'", + className); + } + }); + } + +} diff --git a/uitest/src/com/vaadin/tests/dd/DDTest8.java b/uitest/src/com/vaadin/tests/dd/DDTest8.java index ee7d8d9dc5..beaae4175e 100644 --- a/uitest/src/com/vaadin/tests/dd/DDTest8.java +++ b/uitest/src/com/vaadin/tests/dd/DDTest8.java @@ -10,8 +10,9 @@ import com.vaadin.event.dd.DragAndDropEvent; import com.vaadin.event.dd.DropHandler; import com.vaadin.event.dd.acceptcriteria.AcceptCriterion; import com.vaadin.event.dd.acceptcriteria.Or; +import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.dd.VerticalDropLocation; -import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.AbstractSelect; import com.vaadin.ui.Tree; import com.vaadin.ui.Tree.TreeDragMode; @@ -20,36 +21,48 @@ import com.vaadin.ui.Tree.TreeTargetDetails; /** * DD playground. Better quality example/prototype codes in {@link DDTest2}. */ -public class DDTest8 extends TestBase { +public class DDTest8 extends AbstractTestUI { @Override - protected void setup() { - final Tree t = new Tree( + protected void setup(VaadinRequest request) { + final Tree tree = new Tree( "Tree with criteria from AbstractSelect (OverItem, ContainsItem). Foo can be dragged anywhere, anything can be dropped on Foo or Bar. Bar5 subtree is also valid drop target."); - final HierarchicalContainer idx = new HierarchicalContainer(); - t.setContainerDataSource(idx); - t.addItem("Foo"); - t.addItem("Bar"); - t.addItem("Bar1"); - t.addItem("Bar2"); - t.addItem("Bar3"); - t.addItem("Bar4"); - t.addItem("Bar5"); - t.addItem("Child"); - t.setParent("Child", "Foo"); - t.setSizeFull(); - t.setDragMode(TreeDragMode.NODE); - - /* - * Moves items in tree (and could work in Table too). Also supports - * "building" tree. - * - * TODO fix algorithm, broken in some cases. - */ - DropHandler itemSorter = new DropHandler() { + final HierarchicalContainer container = new HierarchicalContainer(); + tree.setContainerDataSource(container); + tree.addItem("Foo"); + tree.addItem("Bar"); + tree.addItem("Bar1"); + tree.addItem("Bar2"); + tree.addItem("Bar3"); + tree.addItem("Bar4"); + tree.addItem("Bar5"); + tree.addItem("Child"); + tree.setParent("Child", "Foo"); + tree.setSizeFull(); + tree.setDragMode(TreeDragMode.NODE); + tree.setDropHandler(getDropHandler(tree, container)); - @SuppressWarnings("unused") + getLayout().setSizeFull(); + getLayout().getParent().setSizeFull(); + addComponent(tree); + } + + /** + * Moves items in tree (and could work in Table too). Also supports + * "building" tree. + * + * TODO fix algorithm, broken in some cases. + * + * @param tree + * @param container + * @return drop handler + */ + private DropHandler getDropHandler(final Tree tree, + final HierarchicalContainer container) { + return new DropHandler() { + + @SuppressWarnings({ "unused", "unchecked" }) private void populateSubTree(HierarchicalContainer idx, HierarchicalContainer subtree, Object itemId) { Collection children = subtree.getChildren(itemId); @@ -91,6 +104,7 @@ public class DDTest8 extends TestBase { return hierarchicalContainer; } + @SuppressWarnings("unchecked") private void copyChildren(HierarchicalContainer source, HierarchicalContainer target, Object itemId) { Collection children = source.getChildren(itemId); @@ -135,16 +149,16 @@ public class DDTest8 extends TestBase { Object itemIdAfter = details.getItemIdAfter(); if (itemIdOver.equals(itemIdInto)) { // directly on a node - t.setParent(itemId, itemIdOver); + container.setParent(itemId, itemIdOver); return; } - idx.setParent(itemId, itemIdInto); + container.setParent(itemId, itemIdInto); if (dropLocation == null) { System.err.println("No detail of drop place available"); } - idx.moveAfterSibling(itemId, itemIdAfter); + container.moveAfterSibling(itemId, itemIdAfter); } return; @@ -152,23 +166,17 @@ public class DDTest8 extends TestBase { @Override public AcceptCriterion getAcceptCriterion() { - return new Or(new AbstractSelect.TargetItemIs(t, "Foo", "Bar"), - new AbstractSelect.AcceptItem(t, "Foo"), - t.new TargetInSubtree("Bar5") // + return new Or(new AbstractSelect.TargetItemIs(tree, "Foo", + "Bar"), new AbstractSelect.AcceptItem(tree, "Foo"), + tree.new TargetInSubtree("Bar5") // ); } }; - - t.setDropHandler(itemSorter); - - getLayout().setSizeFull(); - addComponent(t); - } @Override - protected String getDescription() { + protected String getTestDescription() { return "Random DD tests"; } diff --git a/uitest/src/com/vaadin/tests/dd/DnDOnSubtreeTest.java b/uitest/src/com/vaadin/tests/dd/DnDOnSubtreeTest.java new file mode 100644 index 0000000000..2bceb905c4 --- /dev/null +++ b/uitest/src/com/vaadin/tests/dd/DnDOnSubtreeTest.java @@ -0,0 +1,52 @@ +package com.vaadin.tests.dd; + +import org.junit.Test; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedCondition; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.TestBenchElement; +import com.vaadin.testbench.elements.TreeElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class DnDOnSubtreeTest extends MultiBrowserTest { + + @Override + protected Class getUIClass() { + return DDTest8.class; + } + + @Test + public void testDragAndDropOnSubTrees() throws Exception { + openTestURL(); + TreeElement tree = $(TreeElement.class).first(); + WebElement bar2 = tree.findElement(By.vaadin("#n[3]")); + WebElement bar5 = tree.findElement(By.vaadin("#n[6]")); + new Actions(driver).moveToElement(bar2, 11, 8).clickAndHold() + .moveByOffset(10, 10).perform(); + /* Drop on Bar5, which is a subtree target */ + new Actions(driver).moveToElement(bar5, 34, 9).release().perform(); + testBenchElement(tree.findElement(By.vaadin("#n[5]/expand"))).click(5, + 5); + /* Assert that the dragged & dropped node is now a child of Bar5 */ + waitUntilElementPresent(tree, "#n[5]/n[0]"); + } + + private void waitUntilElementPresent(final TestBenchElement parent, + final String vaadinSelector) { + waitUntil(new ExpectedCondition() { + + @Override + public Boolean apply(WebDriver arg0) { + return parent.isElementPresent(By.vaadin(vaadinSelector)); + } + + @Override + public String toString() { + return String.format("element to contain '%s'", vaadinSelector); + } + }); + } +} diff --git a/uitest/src/com/vaadin/tests/fieldgroup/BasicPersonForm.java b/uitest/src/com/vaadin/tests/fieldgroup/BasicPersonForm.java index e418116cd5..a223cea6a0 100644 --- a/uitest/src/com/vaadin/tests/fieldgroup/BasicPersonForm.java +++ b/uitest/src/com/vaadin/tests/fieldgroup/BasicPersonForm.java @@ -10,12 +10,12 @@ import com.vaadin.data.util.converter.StringToBooleanConverter; import com.vaadin.data.validator.EmailValidator; import com.vaadin.data.validator.IntegerRangeValidator; import com.vaadin.data.validator.StringLengthValidator; -import com.vaadin.tests.components.TestBase; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.tests.data.bean.Address; import com.vaadin.tests.data.bean.Country; import com.vaadin.tests.data.bean.Person; import com.vaadin.tests.data.bean.Sex; -import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.ComponentContainer; @@ -26,9 +26,8 @@ import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class BasicPersonForm extends TestBase { +public class BasicPersonForm extends AbstractTestUIWithLog { - private Log log = new Log(5); private TextField firstName; private TextArea lastName; private TextField email; @@ -80,7 +79,7 @@ public class BasicPersonForm extends TestBase { } @Override - protected void setup() { + protected void setup(VaadinRequest request) { addComponent(log); Panel confPanel = new ConfigurationPanel(); addComponent(confPanel); @@ -133,7 +132,7 @@ public class BasicPersonForm extends TestBase { msg = "Commit failed: " + e.getMessage(); } Notification.show(msg); - log.log(msg); + log(msg); } }); @@ -143,7 +142,7 @@ public class BasicPersonForm extends TestBase { @Override public void buttonClick(ClickEvent event) { fieldGroup.discard(); - log.log("Discarded changes"); + log("Discarded changes"); } }); @@ -152,7 +151,7 @@ public class BasicPersonForm extends TestBase { @Override public void buttonClick(ClickEvent event) { - log.log(getPerson(fieldGroup).toString()); + log(getPerson(fieldGroup).toString()); } }); @@ -182,20 +181,19 @@ public class BasicPersonForm extends TestBase { fieldGroup.setItemDataSource(new BeanItem(p)); } + @SuppressWarnings("unchecked") public static Person getPerson(FieldGroup binder) { return ((BeanItem) binder.getItemDataSource()).getBean(); } @Override - protected String getDescription() { - // TODO Auto-generated method stub - return null; + public String getDescription() { + return "Basic Person Form"; } @Override protected Integer getTicketNumber() { - // TODO Auto-generated method stub - return null; + return 8094; } } diff --git a/uitest/src/com/vaadin/tests/fieldgroup/BasicPersonFormTest.java b/uitest/src/com/vaadin/tests/fieldgroup/BasicPersonFormTest.java new file mode 100644 index 0000000000..f611325719 --- /dev/null +++ b/uitest/src/com/vaadin/tests/fieldgroup/BasicPersonFormTest.java @@ -0,0 +1,173 @@ +/* + * 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.fieldgroup; + +import org.junit.Assert; + +import com.vaadin.testbench.TestBenchElement; +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.CheckBoxElement; +import com.vaadin.testbench.elements.NotificationElement; +import com.vaadin.testbench.elements.TableElement; +import com.vaadin.testbench.elements.TableRowElement; +import com.vaadin.testbench.elements.TextAreaElement; +import com.vaadin.testbench.elements.TextFieldElement; +import com.vaadin.tests.data.bean.Sex; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public abstract class BasicPersonFormTest extends MultiBrowserTest { + + private static final String BEAN_VALUES = "Person [firstName=John, lastName=Doe, email=john@doe.com, age=64, sex=Male, address=Address [streetAddress=John street, postalCode=11223, city=John's town, country=USA], deceased=false, salary=null, salaryDouble=null, rent=null]"; + private int logCounter = 0; + + @Override + protected Class getUIClass() { + return BasicPersonForm.class; + } + + protected TextFieldElement getFirstNameField() { + return $(TextFieldElement.class).caption("First Name").first(); + } + + protected TextAreaElement getLastNameArea() { + return $(TextAreaElement.class).caption("Last Name").first(); + } + + protected TextFieldElement getEmailField() { + return $(TextFieldElement.class).caption("Email").first(); + } + + protected TextFieldElement getAgeField() { + return $(TextFieldElement.class).caption("Age").first(); + } + + protected TableElement getGenderTable() { + return $(TableElement.class).caption("Sex").first(); + } + + protected TextFieldElement getDeceasedField() { + return $(TextFieldElement.class).caption("Deceased").first(); + } + + protected void showBeanValues() { + $(ButtonElement.class).caption("Show bean values").first().click(); + } + + protected CheckBoxElement getPreCommitFailsCheckBox() { + return $(CheckBoxElement.class).get(1); + } + + protected void commitChanges() { + $(ButtonElement.class).caption("Commit").first().click(); + } + + protected void closeNotification() { + $(NotificationElement.class).first().close(); + } + + protected CheckBoxElement getPostCommitFailsCheckBox() { + return $(CheckBoxElement.class).get(0); + } + + protected void discardChanges() { + $(ButtonElement.class).caption("Discard").first().click(); + } + + protected void assertFirstNameValue(String expected) { + assertFieldValue("First Name", expected, getFirstNameField()); + } + + protected void assertLastNameValue(String expected) { + assertFieldValue("Last Name", expected, getLastNameArea()); + } + + protected void assertEmailValue(String expected) { + assertFieldValue("Email", expected, getEmailField()); + } + + protected void assertAgeValue(String expected) { + assertFieldValue("Age", expected, getAgeField()); + } + + protected void assertDeceasedValue(String expected) { + assertFieldValue("Deceased", expected, getDeceasedField()); + } + + private void assertFieldValue(String caption, String expected, + TestBenchElement field) { + Assert.assertEquals( + String.format("Unexpected value for field '%s',", caption), + expected, field.getAttribute("value")); + } + + protected void assertSelectedSex(Sex sex) { + TableRowElement row = getGenderTable().getRow(getIndex(sex)); + Assert.assertTrue( + String.format("Given sex (%s) isn't selected.", + sex.getStringRepresentation()), + hasCssClass(row, "v-selected")); + } + + private int getIndex(Sex sex) { + switch (sex) { + case MALE: + return 0; + case FEMALE: + return 1; + default: + return 2; + } + } + + protected void assertBeanValuesUnchanged() { + showBeanValues(); + assertLogText(BEAN_VALUES); + } + + protected void assertCommitFails() { + commitChanges(); + closeNotification(); + assertLogText("Commit failed: Commit failed"); + } + + protected void assertCommitSuccessful() { + commitChanges(); + closeNotification(); + assertLogText("Commit succesful"); + } + + protected void assertDiscardResetsFields() { + discardChanges(); + assertLogText("Discarded changes"); + assertDefaults(); + } + + protected void assertLogText(String expected) { + ++logCounter; + Assert.assertEquals("Unexpected log contents,", logCounter + ". " + + expected, getLogRow(0)); + } + + protected void assertDefaults() { + assertFirstNameValue("John"); + assertLastNameValue("Doe"); + assertEmailValue("john@doe.com"); + assertAgeValue("64"); + assertSelectedSex(Sex.MALE); + assertDeceasedValue("NAAAAAH"); + } + +} diff --git a/uitest/src/com/vaadin/tests/fieldgroup/CommitHandlerFailuresTest.java b/uitest/src/com/vaadin/tests/fieldgroup/CommitHandlerFailuresTest.java new file mode 100644 index 0000000000..545c9c2e71 --- /dev/null +++ b/uitest/src/com/vaadin/tests/fieldgroup/CommitHandlerFailuresTest.java @@ -0,0 +1,60 @@ +package com.vaadin.tests.fieldgroup; + +import org.junit.Test; +import org.openqa.selenium.Keys; + +public class CommitHandlerFailuresTest extends BasicPersonFormTest { + + @Override + public void setup() throws Exception { + super.setup(); + openTestURL(); + } + + @Test + public void testDefaults() { + assertDefaults(); + assertBeanValuesUnchanged(); + } + + @Test + public void testUpdatingWithoutCommit() { + updateFields(); + assertBeanValuesUnchanged(); + } + + @Test + public void testPreCommitFails() { + updateFields(); + + getPreCommitFailsCheckBox().click(); + assertCommitFails(); + + assertBeanValuesUnchanged(); + } + + @Test + public void testPostCommitFails() { + updateFields(); + + getPostCommitFailsCheckBox().click(); + assertCommitFails(); + + assertBeanValuesUnchanged(); + } + + @Test + public void testDiscard() { + updateFields(); + assertDiscardResetsFields(); + assertBeanValuesUnchanged(); + } + + private void updateFields() { + getLastNameArea().sendKeys("Doeve", Keys.ENTER); + getFirstNameField().sendKeys("Mike", Keys.ENTER); + getEmailField().sendKeys("me@me.com", Keys.ENTER); + getAgeField().sendKeys("12", Keys.ENTER); + getGenderTable().getCell(2, 0).click(); + } +} diff --git a/uitest/src/com/vaadin/tests/fieldgroup/CommitWithValidationOrConversionErrorTest.java b/uitest/src/com/vaadin/tests/fieldgroup/CommitWithValidationOrConversionErrorTest.java new file mode 100644 index 0000000000..f5c751cd49 --- /dev/null +++ b/uitest/src/com/vaadin/tests/fieldgroup/CommitWithValidationOrConversionErrorTest.java @@ -0,0 +1,74 @@ +package com.vaadin.tests.fieldgroup; + +import org.junit.Test; + +public class CommitWithValidationOrConversionErrorTest extends + BasicPersonFormTest { + + private static final String UPDATED_BEAN_VALUES = "Person [firstName=John, lastName=Doever, email=john@doe.com, age=123, sex=Male, address=Address [streetAddress=John street, postalCode=11223, city=John's town, country=USA], deceased=false, salary=null, salaryDouble=null, rent=null]"; + private static final String UPDATED_NAME_BEAN_VALUES = "Person [firstName=John, lastName=Doever, email=john@doe.com, age=64, sex=Male, address=Address [streetAddress=John street, postalCode=11223, city=John's town, country=USA], deceased=false, salary=null, salaryDouble=null, rent=null]"; + + @Override + public void setup() throws Exception { + super.setup(); + openTestURL(); + } + + @Test + public void testCommitInvalidName() { + getLastNameArea().setValue("Doev"); + assertCommitFails(); + assertBeanValuesUnchanged(); + } + + @Test + public void testCommitInvalidAge() { + // default name invalid, must be fixed or doesn't test the correct error + getLastNameArea().setValue("Doever"); + + getAgeField().setValue("64,2"); + assertCommitFails(); + assertBeanValuesUnchanged(); + } + + @Test + public void testFixValidationError() { + getLastNameArea().setValue("Doev"); + assertCommitFails(); + assertBeanValuesUnchanged(); + + getLastNameArea().setValue("Doever"); + assertCommitSuccessful(); + showBeanValues(); + assertLogText(UPDATED_NAME_BEAN_VALUES); + } + + @Test + public void testFixConversionError() { + // default name invalid, must be fixed as well + getLastNameArea().setValue("Doever"); + + getAgeField().setValue("64,2"); + + assertCommitFails(); + assertBeanValuesUnchanged(); + + getAgeField().setValue("123"); + assertCommitSuccessful(); + + showBeanValues(); + assertLogText(UPDATED_BEAN_VALUES); + } + + @Test + public void testDiscardAfterSuccessfulCommit() { + getLastNameArea().setValue("Doever"); + getAgeField().setValue("123"); + assertCommitSuccessful(); + + discardChanges(); + assertLogText("Discarded changes"); + showBeanValues(); + assertLogText(UPDATED_BEAN_VALUES); + } +} diff --git a/uitest/src/com/vaadin/tests/fieldgroup/DateForm.java b/uitest/src/com/vaadin/tests/fieldgroup/DateForm.java index 3064856db9..6080f18391 100644 --- a/uitest/src/com/vaadin/tests/fieldgroup/DateForm.java +++ b/uitest/src/com/vaadin/tests/fieldgroup/DateForm.java @@ -8,9 +8,9 @@ import com.vaadin.data.fieldgroup.FieldGroup; import com.vaadin.data.fieldgroup.FieldGroup.CommitException; import com.vaadin.data.fieldgroup.PropertyId; import com.vaadin.data.util.BeanItem; -import com.vaadin.tests.components.TestBase; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.tests.data.bean.Person; -import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.DateField; @@ -19,9 +19,8 @@ import com.vaadin.ui.Notification; import com.vaadin.ui.PopupDateField; import com.vaadin.ui.TextField; -public class DateForm extends TestBase { +public class DateForm extends AbstractTestUIWithLog { - private Log log = new Log(5); @PropertyId("date1") private DateField dateField; @PropertyId("date2") @@ -77,8 +76,8 @@ public class DateForm extends TestBase { } @Override - protected void setup() { - getMainWindow().setLocale(Locale.US); + protected void setup(VaadinRequest request) { + setLocale(Locale.US); addComponent(log); final FieldGroup fieldGroup = new BeanFieldGroup( DateObject.class); @@ -102,7 +101,7 @@ public class DateForm extends TestBase { msg = "Commit failed: " + e.getMessage(); } Notification.show(msg); - log.log(msg); + log(msg); } }); @@ -112,8 +111,7 @@ public class DateForm extends TestBase { @Override public void buttonClick(ClickEvent event) { fieldGroup.discard(); - log.log("Discarded changes"); - + log("Discarded changes"); } }); Button showBean = new Button("Show bean values", @@ -121,7 +119,7 @@ public class DateForm extends TestBase { @Override public void buttonClick(ClickEvent event) { - log.log(getPerson(fieldGroup).toString()); + log(getPerson(fieldGroup).toString()); } }); @@ -135,12 +133,13 @@ public class DateForm extends TestBase { fieldGroup.setItemDataSource(new BeanItem(d)); } + @SuppressWarnings("unchecked") public static Person getPerson(FieldGroup binder) { return ((BeanItem) binder.getItemDataSource()).getBean(); } @Override - protected String getDescription() { + public String getDescription() { return "Ensure FieldGroupFieldFactory supports Dates"; } diff --git a/uitest/src/com/vaadin/tests/fieldgroup/DateFormTest.java b/uitest/src/com/vaadin/tests/fieldgroup/DateFormTest.java new file mode 100644 index 0000000000..32d8bcb603 --- /dev/null +++ b/uitest/src/com/vaadin/tests/fieldgroup/DateFormTest.java @@ -0,0 +1,47 @@ +package com.vaadin.tests.fieldgroup; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.DateFieldElement; +import com.vaadin.testbench.elements.InlineDateFieldElement; +import com.vaadin.testbench.elements.PopupDateFieldElement; +import com.vaadin.testbench.elements.TextFieldElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class DateFormTest extends MultiBrowserTest { + + @Test + public void testCorrectDateFormat() throws Exception { + openTestURL(); + Assert.assertEquals("Unexpected DateField value,", "1/20/84", + getDateFieldValue()); + Assert.assertEquals("Unexpected PopupDateField value,", "1/20/84", + getPopupDateFieldValue()); + WebElement day20 = getInlineDateFieldCalendarPanel().findElement( + By.vaadin("#day20")); + Assert.assertTrue( + "Unexpected InlineDateField state, 20th not selected.", + hasCssClass(day20, + "v-inline-datefield-calendarpanel-day-selected")); + Assert.assertEquals("Unexpected TextField contents,", + "Jan 20, 1984 4:34:49 PM", $(TextFieldElement.class).first() + .getValue()); + } + + protected String getDateFieldValue() { + return $(DateFieldElement.class).first().getValue(); + } + + protected String getPopupDateFieldValue() { + return $(PopupDateFieldElement.class).first().getValue(); + } + + protected WebElement getInlineDateFieldCalendarPanel() { + return $(InlineDateFieldElement.class).first().findElement( + By.className("v-inline-datefield-calendarpanel")); + } + +} diff --git a/uitest/src/com/vaadin/tests/fieldgroup/FieldGroupDiscardTest.java b/uitest/src/com/vaadin/tests/fieldgroup/FieldGroupDiscardTest.java new file mode 100644 index 0000000000..7d8beb2106 --- /dev/null +++ b/uitest/src/com/vaadin/tests/fieldgroup/FieldGroupDiscardTest.java @@ -0,0 +1,32 @@ +package com.vaadin.tests.fieldgroup; + +import org.junit.Test; +import org.openqa.selenium.Keys; + +public class FieldGroupDiscardTest extends BasicPersonFormTest { + + @Test + public void testFieldGroupDiscard() throws Exception { + openTestURL(); + assertDefaults(); + + /* make some changes */ + getFirstNameField().sendKeys("John123", Keys.ENTER); + getLastNameArea().sendKeys("Doe123", Keys.ENTER); + getEmailField().sendKeys("john@doe.com123", Keys.ENTER); + getAgeField().sendKeys("64123", Keys.ENTER); + getGenderTable().getCell(2, 0); + getDeceasedField().click(); + getDeceasedField().click(); + getDeceasedField().sendKeys("YAY!", Keys.ENTER); + + assertBeanValuesUnchanged(); + + assertDiscardResetsFields(); + + assertBeanValuesUnchanged(); + + /* we should still be at the state we started from */ + assertDefaults(); + } +} diff --git a/uitest/src/com/vaadin/tests/fields/TabIndexes.java b/uitest/src/com/vaadin/tests/fields/TabIndexes.java index cf2e253d08..32fb36815b 100644 --- a/uitest/src/com/vaadin/tests/fields/TabIndexes.java +++ b/uitest/src/com/vaadin/tests/fields/TabIndexes.java @@ -4,8 +4,7 @@ import java.util.ArrayList; import java.util.List; import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.tests.util.Log; +import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.AbstractField; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -30,14 +29,13 @@ import com.vaadin.ui.Tree; import com.vaadin.ui.TreeTable; import com.vaadin.ui.TwinColSelect; -public class TabIndexes extends AbstractTestUI { +@SuppressWarnings("rawtypes") +public class TabIndexes extends AbstractTestUIWithLog { private List fields; - private Log log = new Log(5); @Override protected void setup(VaadinRequest request) { - addComponent(log); HorizontalLayout buttonLayout = new HorizontalLayout(); addComponent(buttonLayout); Button clearTabIndexes = new Button("Set all tab indexes to 0"); @@ -45,7 +43,7 @@ public class TabIndexes extends AbstractTestUI { @Override public void buttonClick(ClickEvent event) { - log.log("Setting tab indexes to 0"); + log("Setting tab indexes to 0"); for (AbstractField f : fields) { f.setTabIndex(0); } @@ -57,7 +55,7 @@ public class TabIndexes extends AbstractTestUI { @Override public void buttonClick(ClickEvent event) { - log.log("Setting tab indexes to 1"); + log("Setting tab indexes to 1"); for (AbstractField f : fields) { f.setTabIndex(1); } @@ -70,7 +68,7 @@ public class TabIndexes extends AbstractTestUI { @Override public void buttonClick(ClickEvent event) { int tabIndex = 1; - log.log("Setting tab indexes to 1..N"); + log("Setting tab indexes to 1..N"); for (AbstractField f : fields) { f.setTabIndex(tabIndex++); } @@ -84,7 +82,7 @@ public class TabIndexes extends AbstractTestUI { @Override public void buttonClick(ClickEvent event) { int tabIndex = fields.size(); - log.log("Setting tab indexes to N..1"); + log("Setting tab indexes to N..1"); for (AbstractField f : fields) { f.setTabIndex(tabIndex--); } @@ -153,8 +151,7 @@ public class TabIndexes extends AbstractTestUI { @Override protected String getTestDescription() { - // TODO Auto-generated method stub - return null; + return "Tab index should be propagated into html"; } } diff --git a/uitest/src/com/vaadin/tests/fields/TabIndexesTest.java b/uitest/src/com/vaadin/tests/fields/TabIndexesTest.java new file mode 100644 index 0000000000..6bd456c7e2 --- /dev/null +++ b/uitest/src/com/vaadin/tests/fields/TabIndexesTest.java @@ -0,0 +1,164 @@ +package com.vaadin.tests.fields; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class TabIndexesTest extends MultiBrowserTest { + + @Override + public void setup() throws Exception { + super.setup(); + openTestURL(); + } + + @Test + public void testTabIndexesSetToZero() { + // clicked by default + assertLogText("1. Setting tab indexes to 0"); + for (WebElement element : getFieldElements()) { + assertTabIndex("0", element); + } + } + + @Test + public void testTabIndexesSetToOne() { + setTabIndexesTo("1"); + for (WebElement element : getFieldElements()) { + assertTabIndex("1", element); + } + } + + @Test + public void testTabIndexesSetToOneThroughN() { + setTabIndexesTo("1..N"); + int counter = 0; + for (WebElement element : getFieldElements()) { + ++counter; + assertTabIndex(String.valueOf(counter), element); + } + } + + @Test + public void testTabIndexesSetToNThroughOne() { + setTabIndexesTo("N..1"); + List fieldElements = getFieldElements(); + int counter = fieldElements.size(); + for (WebElement element : fieldElements) { + assertTabIndex(String.valueOf(counter), element); + --counter; + } + } + + private void setTabIndexesTo(String expected) { + String caption = String.format("Set %stab indexes to %s", + (expected.contains("N") ? "" : "all "), expected); + $(ButtonElement.class).caption(caption).first().click(); + assertLogText("2. Setting tab indexes to " + expected); + } + + private void assertLogText(String expected) { + Assert.assertEquals("Unexpected log contents,", expected, getLogRow(0)); + } + + private void assertTabIndex(String expected, WebElement element) { + Assert.assertEquals("Unexpected tab index,", expected, + element.getAttribute("tabIndex")); + } + + private List getFieldElements() { + List fieldElements = new ArrayList(); + fieldElements.add(getElement1()); + fieldElements.add(getElement2()); + fieldElements.add(getElement3()); + fieldElements.add(getElement4()); + fieldElements.add(getElement5()); + fieldElements.add(getElement6()); + fieldElements.add(getElement7()); + fieldElements.add(getElement8()); + fieldElements.add(getElement9()); + fieldElements.add(getElement10()); + fieldElements.add(getElement11()); + fieldElements.add(getElement12()); + fieldElements.add(getElement13()); + fieldElements.add(getElement14()); + fieldElements.add(getElement15()); + fieldElements.add(getElement16()); + fieldElements.add(getElement17()); + return fieldElements; + } + + private WebElement getElement1() { + return vaadinElement("PID_Sfield-1/domChild[1]/domChild[1]"); + } + + private WebElement getElement2() { + return vaadinElement("PID_Sfield-2/domChild[0]"); + } + + private WebElement getElement3() { + return vaadinElement("PID_Sfield-3/domChild[0]"); + } + + private WebElement getElement4() { + return vaadinElement("PID_Sfield-4/domChild[0]"); + } + + private WebElement getElement5() { + return vaadinElement("PID_Sfield-5"); + } + + private WebElement getElement6() { + return vaadinElement("PID_Sfield-6/domChild[0]"); + } + + private WebElement getElement7() { + return vaadinElement("PID_Sfield-7/domChild[0]"); + } + + private WebElement getElement8() { + return vaadinElement("PID_Sfield-8/domChild[0]/domChild[0]"); + } + + private WebElement getElement9() { + return vaadinElement("PID_Sfield-9/domChild[1]/domChild[1]"); + } + + private WebElement getElement10() { + return vaadinElement("PID_Sfield-10/domChild[1]"); + } + + private WebElement getElement11() { + return vaadinElement("PID_Sfield-11/domChild[1]"); + } + + private WebElement getElement12() { + return vaadinElement("PID_Sfield-12"); + } + + private WebElement getElement13() { + return vaadinElement("PID_Sfield-13"); + } + + private WebElement getElement14() { + return vaadinElement("PID_Sfield-14"); + } + + private WebElement getElement15() { + return vaadinElement("PID_Sfield-15/domChild[1]"); + } + + private WebElement getElement16() { + return vaadinElement("PID_Sfield-16/domChild[0]"); + } + + private WebElement getElement17() { + return vaadinElement("PID_Sfield-17"); + } +} diff --git a/uitest/tb2/com/vaadin/tests/components/ui/CurrentUiRetained.html b/uitest/tb2/com/vaadin/tests/components/ui/CurrentUiRetained.html deleted file mode 100644 index fe030f2ea7..0000000000 --- a/uitest/tb2/com/vaadin/tests/components/ui/CurrentUiRetained.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.components.ui.CurrentUiRetained?restartApplication
pause2000
clickvaadin=runcomvaadintestscomponentsuiCurrentUiRetained::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentsuiCurrentUiRetained::PID_SLog_row_31. Correct UI.getCurrent before GC: true
assertTextvaadin=runcomvaadintestscomponentsuiCurrentUiRetained::PID_SLog_row_22. Correct UI.getCurrent after GC: true
assertTextvaadin=runcomvaadintestscomponentsuiCurrentUiRetained::PID_SLog_row_13. GC probe available before GC: true
assertTextvaadin=runcomvaadintestscomponentsuiCurrentUiRetained::PID_SLog_row_04. GC probe available after GC: false
- - diff --git a/uitest/tb2/com/vaadin/tests/components/ui/InitiallyEmptyFragment.html b/uitest/tb2/com/vaadin/tests/components/ui/InitiallyEmptyFragment.html deleted file mode 100644 index 933274eae6..0000000000 --- a/uitest/tb2/com/vaadin/tests/components/ui/InitiallyEmptyFragment.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.components.ui.InitialFragmentEvent?restartApplication
assertTextvaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_0
runScriptwindow.location.hash='bar'
pause500
waitForVaadin
assertTextvaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_01. Fragment changed from "no event received" to bar
- - diff --git a/uitest/tb2/com/vaadin/tests/components/ui/PollListenerTest.html b/uitest/tb2/com/vaadin/tests/components/ui/PollListenerTest.html deleted file mode 100644 index ac39d1f03c..0000000000 --- a/uitest/tb2/com/vaadin/tests/components/ui/PollListenerTest.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - -PollListenerTest - - - - - - - - - - - - - - - - - - - - - - -
PollListenerTest
open/run/com.vaadin.tests.components.ui.PollListenerTest?restartApplication
pause5000
verifyTextPresentPollEvent received
- - diff --git a/uitest/tb2/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.html b/uitest/tb2/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.html deleted file mode 100644 index c9d5aa303d..0000000000 --- a/uitest/tb2/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.components.ui.RpcInvocationHandlerToString?restartApplication
clickvaadin=runcomvaadintestscomponentsuiRpcInvocationHandlerToString::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0]
assertElementNotPresentvaadin=runcomvaadintestscomponentsuiRpcInvocationHandlerToString::Root/VNotification[0]/HTML[0]
clickvaadin=runcomvaadintestscomponentsuiRpcInvocationHandlerToString::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[2]/VButton[0]/domChild[0]/domChild[0]
assertElementNotPresentvaadin=runcomvaadintestscomponentsuiRpcInvocationHandlerToString::Root/VNotification[0]/HTML[0]
clickvaadin=runcomvaadintestscomponentsuiRpcInvocationHandlerToString::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VButton[0]/domChild[0]/domChild[0]
assertElementNotPresentvaadin=runcomvaadintestscomponentsuiRpcInvocationHandlerToString::Root/VNotification[0]/HTML[0]
- - diff --git a/uitest/tb2/com/vaadin/tests/components/ui/UIAccessExceptionHandling.html b/uitest/tb2/com/vaadin/tests/components/ui/UIAccessExceptionHandling.html deleted file mode 100644 index 94d8aa2777..0000000000 --- a/uitest/tb2/com/vaadin/tests/components/ui/UIAccessExceptionHandling.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.components.ui.UIAccessExceptionHandling?restartApplication
clickvaadin=runcomvaadintestscomponentsuiUIAccessExceptionHandling::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]
verifyTextvaadin=runcomvaadintestscomponentsuiUIAccessExceptionHandling::PID_SLog_row_01. Exception catched on get: java.util.concurrent.ExecutionException
verifyTextvaadin=runcomvaadintestscomponentsuiUIAccessExceptionHandling::PID_SLog_row_10. Exception catched on execution with ConnectorErrorEvent : java.util.concurrent.ExecutionException
clickvaadin=runcomvaadintestscomponentsuiUIAccessExceptionHandling::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]
verifyTextvaadin=runcomvaadintestscomponentsuiUIAccessExceptionHandling::PID_SLog_row_01. Exception catched on get: java.util.concurrent.ExecutionException
verifyTextvaadin=runcomvaadintestscomponentsuiUIAccessExceptionHandling::PID_SLog_row_10. Exception catched on execution with ErrorEvent : java.util.concurrent.ExecutionException
clickvaadin=runcomvaadintestscomponentsuiUIAccessExceptionHandling::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]
verifyTextvaadin=runcomvaadintestscomponentsuiUIAccessExceptionHandling::PID_SLog_row_01. Exception catched on get: java.util.concurrent.ExecutionException
verifyTextvaadin=runcomvaadintestscomponentsuiUIAccessExceptionHandling::PID_SLog_row_10. Exception catched on execution with ConnectorErrorEvent : java.util.concurrent.ExecutionException
- - diff --git a/uitest/tb2/com/vaadin/tests/components/ui/UIInitBrowserDetails.html b/uitest/tb2/com/vaadin/tests/components/ui/UIInitBrowserDetails.html deleted file mode 100644 index 3fd7a0d560..0000000000 --- a/uitest/tb2/com/vaadin/tests/components/ui/UIInitBrowserDetails.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - -UIInitBrowserDetails - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
UIInitBrowserDetails
open/run/UIInitBrowserDetails?restartApplication
assertNotTextvaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[4]null
assertNotTextvaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[2]null
assertNotTextvaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[4]null
assertNotTextvaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[5]-1
assertNotTextvaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[10]null
assertNotTextvaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[8]-1
assertNotTextvaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[10]null
assertNotTextvaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[11]-1
assertNotTextvaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[13]null
assertNotTextvaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[14]-1
assertNotTextvaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[16]null
assertNotTextvaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[19]null
assertNotTextvaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[22]null
assertNotTextvaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[25]null
assertNotTextvaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[28]null
assertNotTextvaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[29]null
- - diff --git a/uitest/tb2/com/vaadin/tests/components/ui/UIInitException.html b/uitest/tb2/com/vaadin/tests/components/ui/UIInitException.html deleted file mode 100644 index 68b11e7942..0000000000 --- a/uitest/tb2/com/vaadin/tests/components/ui/UIInitException.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.components.ui.UIInitException?restartApplication
assertTextPresentCatch me if you can
- - diff --git a/uitest/tb2/com/vaadin/tests/components/ui/UIPolling.html b/uitest/tb2/com/vaadin/tests/components/ui/UIPolling.html deleted file mode 100644 index f770bae009..0000000000 --- a/uitest/tb2/com/vaadin/tests/components/ui/UIPolling.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - -WindowMaximizeRestoreTest - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
WindowMaximizeRestoreTest
open/run/UIPolling?restartApplication
typevaadin=runUIPolling::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[0]/VTextField[0]500
pause2000
assertTextPresent2. 1000ms has passed
typevaadin=runUIPolling::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[0]/VTextField[0]-1
pause2000
assertTextNotPresent8. 4000ms has passed
- - diff --git a/uitest/tb2/com/vaadin/tests/components/ui/UITabIndex.html b/uitest/tb2/com/vaadin/tests/components/ui/UITabIndex.html deleted file mode 100644 index fa083f1489..0000000000 --- a/uitest/tb2/com/vaadin/tests/components/ui/UITabIndex.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.components.ui.UITabIndex?restartApplication
assertAttributevaadin=runcomvaadintestscomponentsuiUITabIndex::@tabIndex1
clickvaadin=runcomvaadintestscomponentsuiUITabIndex::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]
assertAttributevaadin=runcomvaadintestscomponentsuiUITabIndex::@tabIndex-1
clickvaadin=runcomvaadintestscomponentsuiUITabIndex::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]
assertAttributevaadin=runcomvaadintestscomponentsuiUITabIndex::@tabIndex0
clickvaadin=runcomvaadintestscomponentsuiUITabIndex::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]
assertAttributevaadin=runcomvaadintestscomponentsuiUITabIndex::@tabIndex1
- - diff --git a/uitest/tb2/com/vaadin/tests/components/ui/UIsInMultipleTabs.html b/uitest/tb2/com/vaadin/tests/components/ui/UIsInMultipleTabs.html deleted file mode 100644 index 08561588c4..0000000000 --- a/uitest/tb2/com/vaadin/tests/components/ui/UIsInMultipleTabs.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.components.ui.UIsInMultipleTabs?restartApplication
assertTextvaadin=runcomvaadintestscomponentsuiUIsInMultipleTabs::/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]This is UI number 1
open/run/com.vaadin.tests.components.ui.UIsInMultipleTabs
assertTextvaadin=runcomvaadintestscomponentsuiUIsInMultipleTabs::/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]This is UI number 2
open/run/com.vaadin.tests.components.ui.UIsInMultipleTabs?restartApplication
assertTextvaadin=runcomvaadintestscomponentsuiUIsInMultipleTabs::/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]This is UI number 1
- - diff --git a/uitest/tb2/com/vaadin/tests/components/window/CloseSubWindow.html b/uitest/tb2/com/vaadin/tests/components/window/CloseSubWindow.html deleted file mode 100644 index de5a793909..0000000000 --- a/uitest/tb2/com/vaadin/tests/components/window/CloseSubWindow.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - -CloseSubWindow - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CloseSubWindow
open/run/com.vaadin.tests.components.window.CloseSubWindow?restartApplication
clickvaadin=runcomvaadintestscomponentswindowCloseSubWindow::PID_Sopensub/domChild[0]/domChild[0]
clickvaadin=runcomvaadintestscomponentswindowCloseSubWindow::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentswindowCloseSubWindow::PID_SLog/ChildComponentContainer[0]/VLabel[0]1. Window 'Sub-window' closed
clickvaadin=runcomvaadintestscomponentswindowCloseSubWindow::PID_Sopensub/domChild[0]/domChild[0]
clickvaadin=runcomvaadintestscomponentswindowCloseSubWindow::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]
assertTextvaadin=runcomvaadintestscomponentswindowCloseSubWindow::PID_SLog/ChildComponentContainer[0]/VLabel[0]2. Window 'Sub-window' closed
- - diff --git a/uitest/tb2/com/vaadin/tests/components/window/ExtraWindowShown.html b/uitest/tb2/com/vaadin/tests/components/window/ExtraWindowShown.html deleted file mode 100644 index 65e8b0166b..0000000000 --- a/uitest/tb2/com/vaadin/tests/components/window/ExtraWindowShown.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.components.window.ExtraWindowShown?restartApplication
clickvaadin=runcomvaadintestscomponentswindowExtraWindowShown::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
clickvaadin=runcomvaadintestscomponentswindowExtraWindowShown::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]
pause1000
assertElementNotPresentvaadin=runcomvaadintestscomponentswindowExtraWindowShown::/VWindow[0]
clickvaadin=runcomvaadintestscomponentswindowExtraWindowShown::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
clickvaadin=runcomvaadintestscomponentswindowExtraWindowShown::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]
pause1000
assertElementNotPresentvaadin=runcomvaadintestscomponentswindowExtraWindowShown::/VWindow[0]
- - diff --git a/uitest/tb2/com/vaadin/tests/components/window/RepaintWindowContents.html b/uitest/tb2/com/vaadin/tests/components/window/RepaintWindowContents.html deleted file mode 100644 index 9cbcf1d5ea..0000000000 --- a/uitest/tb2/com/vaadin/tests/components/window/RepaintWindowContents.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.components.window.RepaintWindowContents?restartApplication
assertTextvaadin=runcomvaadintestscomponentswindowRepaintWindowContents::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]Button 1
clickvaadin=runcomvaadintestscomponentswindowRepaintWindowContents::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentswindowRepaintWindowContents::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]Button 2
clickvaadin=runcomvaadintestscomponentswindowRepaintWindowContents::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentswindowRepaintWindowContents::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]Button 1
clickvaadin=runcomvaadintestscomponentswindowRepaintWindowContents::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VButton[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentswindowRepaintWindowContents::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]Button 2
- - diff --git a/uitest/tb2/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.html b/uitest/tb2/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.html deleted file mode 100644 index 4923bff58a..0000000000 --- a/uitest/tb2/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - -WindowShouldRemoveActionHandler - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
WindowShouldRemoveActionHandler
open/run/com.vaadin.tests.components.window.WindowShouldRemoveActionHandler
waitForVaadin
clickvaadin=runcomvaadintestscomponentswindowWindowShouldRemoveActionHandler::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
waitForVaadin
clickvaadin=runcomvaadintestscomponentswindowWindowShouldRemoveActionHandler::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
waitForVaadin
verifyTitleA panel with 2 action handlers
clickvaadin=runcomvaadintestscomponentswindowWindowShouldRemoveActionHandler::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
waitForVaadin
verifyTitleA panel with 3 action handlers
clickvaadin=runcomvaadintestscomponentswindowWindowShouldRemoveActionHandler::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
waitForVaadin
clickvaadin=runcomvaadintestscomponentswindowWindowShouldRemoveActionHandler::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
waitForVaadin
verifyTitleA panel with 3 action handlers - Removed handler - Removed handler
clickvaadin=runcomvaadintestscomponentswindowWindowShouldRemoveActionHandler::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
waitForVaadin
verifyTitleA panel with 2 action handlers
- - diff --git a/uitest/tb2/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html b/uitest/tb2/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html deleted file mode 100644 index ea4d2c3666..0000000000 --- a/uitest/tb2/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.components.window.WindowWithInvalidCloseListener?restartApplication
mouseClickvaadin=runcomvaadintestscomponentswindowWindowWithInvalidCloseListener::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]6,7
assertElementNotPresentvaadin=runcomvaadintestscomponentswindowWindowWithInvalidCloseListener::/VWindow[0]
- - diff --git a/uitest/tb2/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKey.html b/uitest/tb2/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKey.html deleted file mode 100644 index 8b955ce17d..0000000000 --- a/uitest/tb2/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKey.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - -TableQueryWithNonUniqueFirstPrimaryKey - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TableQueryWithNonUniqueFirstPrimaryKey
open/run/com.vaadin.tests.containers.sqlcontainer.TableQueryWithNonUniqueFirstPrimaryKey?restartApplication
enterCharactervaadin=runcomvaadintestscontainerssqlcontainerTableQueryWithNonUniqueFirstPrimaryKey::/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]#textboxrus
assertTextvaadin=runcomvaadintestscontainerssqlcontainerTableQueryWithNonUniqueFirstPrimaryKey::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]/#item0TARUSCIO GIOVANNI
assertTextvaadin=runcomvaadintestscontainerssqlcontainerTableQueryWithNonUniqueFirstPrimaryKey::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item1RUSSO GAETANO AUTORICAMBI
assertTextvaadin=runcomvaadintestscontainerssqlcontainerTableQueryWithNonUniqueFirstPrimaryKey::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item2AMORUSO LUIGI SRL
assertTextvaadin=runcomvaadintestscontainerssqlcontainerTableQueryWithNonUniqueFirstPrimaryKey::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item3CARUSO ROCCO
assertTextvaadin=runcomvaadintestscontainerssqlcontainerTableQueryWithNonUniqueFirstPrimaryKey::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item4F.LLI RUSSO DI GAETANO RUSSO & C
assertTextvaadin=runcomvaadintestscontainerssqlcontainerTableQueryWithNonUniqueFirstPrimaryKey::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item5RUSSO GIUSEPPE
assertTextvaadin=runcomvaadintestscontainerssqlcontainerTableQueryWithNonUniqueFirstPrimaryKey::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item6TRUSCELLI ANTONIO
assertTextvaadin=runcomvaadintestscontainerssqlcontainerTableQueryWithNonUniqueFirstPrimaryKey::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item7CARUSO CALOGERO
- - diff --git a/uitest/tb2/com/vaadin/tests/converter/ConverterThatEnforcesAFormat.html b/uitest/tb2/com/vaadin/tests/converter/ConverterThatEnforcesAFormat.html deleted file mode 100644 index 0bb576d76c..0000000000 --- a/uitest/tb2/com/vaadin/tests/converter/ConverterThatEnforcesAFormat.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.converter.ConverterThatEnforcesAFormat?restartApplication
assertValuevaadin=runcomvaadintestsconverterConverterThatEnforcesAFormat::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VTextField[0]50.000
typevaadin=runcomvaadintestsconverterConverterThatEnforcesAFormat::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VTextField[0]50.0202
assertValuevaadin=runcomvaadintestsconverterConverterThatEnforcesAFormat::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VTextField[0]50.020
typevaadin=runcomvaadintestsconverterConverterThatEnforcesAFormat::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VTextField[0]12
assertValuevaadin=runcomvaadintestsconverterConverterThatEnforcesAFormat::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VTextField[0]12.000
typevaadin=runcomvaadintestsconverterConverterThatEnforcesAFormat::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VTextField[0]abc
assertValuevaadin=runcomvaadintestsconverterConverterThatEnforcesAFormat::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VTextField[0]abc
assertCSSClassvaadin=runcomvaadintestsconverterConverterThatEnforcesAFormat::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VTextField[0]v-textfield-error
- - diff --git a/uitest/tb2/com/vaadin/tests/dd/DnDOnSubtree.html b/uitest/tb2/com/vaadin/tests/dd/DnDOnSubtree.html deleted file mode 100644 index 844636cb02..0000000000 --- a/uitest/tb2/com/vaadin/tests/dd/DnDOnSubtree.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - DnDOnSubtree - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.dd.DDTest8?restartApplication
dragvaadin=runcomvaadintestsddDDTest8::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTree[0]#n[3]11,8
dropvaadin=runcomvaadintestsddDDTest8::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTree[0]#n[6]34,9
mouseClick - vaadin=runcomvaadintestsddDDTest8::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTree[0]#n[5]/expand - 10,8
assertElementPresent - vaadin=runcomvaadintestsddDDTest8::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTree[0]#n[5]/n[0] -
- - diff --git a/uitest/tb2/com/vaadin/tests/fieldgroup/CommitHandlerFailures.html b/uitest/tb2/com/vaadin/tests/fieldgroup/CommitHandlerFailures.html deleted file mode 100644 index aaaa0a6625..0000000000 --- a/uitest/tb2/com/vaadin/tests/fieldgroup/CommitHandlerFailures.html +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.fieldgroup.BasicPersonForm?restartApplication
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextField[0]John
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VTextArea[0]Doe
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTextField[0]john@doe.com
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]64
assertCSSClassvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[6]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]v-selected
assertNotCSSClassvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[6]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]v-selected
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[7]/VTextField[0]NAAAAAH
enterCharactervaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VTextArea[0]Doeve
enterCharactervaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextField[0]Mike
enterCharactervaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTextField[0]me@me.com
enterCharactervaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]12
mouseClickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[6]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]31,10
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[10]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestsfieldgroupBasicPersonForm::PID_SLog_row_01. Person [firstName=John, lastName=Doe, email=john@doe.com, age=64, sex=Male, address=Address [streetAddress=John street, postalCode=11223, city=John's town, country=USA], deceased=false, salary=null, salaryDouble=null, rent=null]
mouseClickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VCheckBox[0]/domChild[0]35,6
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[8]/VButton[0]/domChild[0]/domChild[0]
closeNotificationvaadin=runcomvaadintestsfieldgroupBasicPersonForm::Root/VNotification[0]0,0
assertTextvaadin=runcomvaadintestsfieldgroupBasicPersonForm::PID_SLog_row_02. Commit failed: Commit failed
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[10]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestsfieldgroupBasicPersonForm::PID_SLog_row_03. Person [firstName=John, lastName=Doe, email=john@doe.com, age=64, sex=Male, address=Address [streetAddress=John street, postalCode=11223, city=John's town, country=USA], deceased=false, salary=null, salaryDouble=null, rent=null]
mouseClickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VCheckBox[0]/domChild[0]10,7
mouseClickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VCheckBox[0]/domChild[0]9,7
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[8]/VButton[0]/domChild[0]/domChild[0]
closeNotificationvaadin=runcomvaadintestsfieldgroupBasicPersonForm::Root/VNotification[0]0,0
assertTextvaadin=runcomvaadintestsfieldgroupBasicPersonForm::PID_SLog_row_04. Commit failed: Commit failed
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[10]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestsfieldgroupBasicPersonForm::PID_SLog_row_05. Person [firstName=John, lastName=Doe, email=john@doe.com, age=64, sex=Male, address=Address [streetAddress=John street, postalCode=11223, city=John's town, country=USA], deceased=false, salary=null, salaryDouble=null, rent=null]
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[9]/VButton[0]/domChild[0]/domChild[0]
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextField[0]John
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VTextArea[0]Doe
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTextField[0]john@doe.com
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]64
assertCSSClassvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[6]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]v-selected
assertNotCSSClassvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[6]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]v-selected
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[7]/VTextField[0]NAAAAAH
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[10]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestsfieldgroupBasicPersonForm::PID_SLog_row_07. Person [firstName=John, lastName=Doe, email=john@doe.com, age=64, sex=Male, address=Address [streetAddress=John street, postalCode=11223, city=John's town, country=USA], deceased=false, salary=null, salaryDouble=null, rent=null]
- - - diff --git a/uitest/tb2/com/vaadin/tests/fieldgroup/CommitWithValidationOrConversionError.html b/uitest/tb2/com/vaadin/tests/fieldgroup/CommitWithValidationOrConversionError.html deleted file mode 100644 index 8681c6485e..0000000000 --- a/uitest/tb2/com/vaadin/tests/fieldgroup/CommitWithValidationOrConversionError.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.fieldgroup.BasicPersonForm?restartApplication
enterCharactervaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VTextArea[0]Doev
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[8]/VButton[0]/domChild[0]
closeNotificationvaadin=runcomvaadintestsfieldgroupBasicPersonForm::Root/VNotification[0]0,0
assertTextvaadin=runcomvaadintestsfieldgroupBasicPersonForm::PID_SLog_row_01. Commit failed: Commit failed
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[10]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestsfieldgroupBasicPersonForm::PID_SLog_row_02. Person [firstName=John, lastName=Doe, email=john@doe.com, age=64, sex=Male, address=Address [streetAddress=John street, postalCode=11223, city=John's town, country=USA], deceased=false, salary=null, salaryDouble=null, rent=null]
enterCharactervaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]64,2
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[8]/VButton[0]/domChild[0]/domChild[0]
closeNotificationvaadin=runcomvaadintestsfieldgroupBasicPersonForm::Root/VNotification[0]0,0
assertTextvaadin=runcomvaadintestsfieldgroupBasicPersonForm::PID_SLog_row_03. Commit failed: Commit failed
enterCharactervaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VTextArea[0]Doever
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[8]/VButton[0]/domChild[0]/domChild[0]
closeNotificationvaadin=runcomvaadintestsfieldgroupBasicPersonForm::Root/VNotification[0]0,0
assertTextvaadin=runcomvaadintestsfieldgroupBasicPersonForm::PID_SLog_row_04. Commit failed: Commit failed
enterCharactervaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]123
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[8]/VButton[0]/domChild[0]/domChild[0]
closeNotificationvaadin=runcomvaadintestsfieldgroupBasicPersonForm::Root/VNotification[0]0,0
assertTextvaadin=runcomvaadintestsfieldgroupBasicPersonForm::PID_SLog_row_05. Commit succesful
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[10]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestsfieldgroupBasicPersonForm::PID_SLog_row_06. Person [firstName=John, lastName=Doever, email=john@doe.com, age=123, sex=Male, address=Address [streetAddress=John street, postalCode=11223, city=John's town, country=USA], deceased=false, salary=null, salaryDouble=null, rent=null]
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[9]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestsfieldgroupBasicPersonForm::PID_SLog_row_07. Discarded changes
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[10]/VButton[0]/domChild[0]
assertTextvaadin=runcomvaadintestsfieldgroupBasicPersonForm::PID_SLog_row_08. Person [firstName=John, lastName=Doever, email=john@doe.com, age=123, sex=Male, address=Address [streetAddress=John street, postalCode=11223, city=John's town, country=USA], deceased=false, salary=null, salaryDouble=null, rent=null]
- - - diff --git a/uitest/tb2/com/vaadin/tests/fieldgroup/DateForm.html b/uitest/tb2/com/vaadin/tests/fieldgroup/DateForm.html deleted file mode 100644 index f141091805..0000000000 --- a/uitest/tb2/com/vaadin/tests/fieldgroup/DateForm.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.fieldgroup.DateForm?restartApplication
assertValuevaadin=runcomvaadintestsfieldgroupDateForm::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VPopupCalendar[0]#field1/20/84
assertValuevaadin=runcomvaadintestsfieldgroupDateForm::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VPopupCalendar[0]#field1/20/84
assertCSSClassvaadin=runcomvaadintestsfieldgroupDateForm::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VDateFieldCalendar[0]/VCalendarPanel[0]#day20v-inline-datefield-calendarpanel-day-selected
assertValuevaadin=runcomvaadintestsfieldgroupDateForm::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VTextField[0]Jan 20, 1984 4:34:49 PM
- - diff --git a/uitest/tb2/com/vaadin/tests/fieldgroup/FieldGroupDiscard.html b/uitest/tb2/com/vaadin/tests/fieldgroup/FieldGroupDiscard.html deleted file mode 100644 index a2ac1b748b..0000000000 --- a/uitest/tb2/com/vaadin/tests/fieldgroup/FieldGroupDiscard.html +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.fieldgroup.BasicPersonForm?restartApplication
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextField[0]John
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VTextArea[0]Doe
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTextField[0]john@doe.com
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]64
assertCSSClassvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[6]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]v-selected
assertNotCSSClassvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[6]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]v-selected
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[7]/VTextField[0]NAAAAAH
enterCharactervaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextField[0]John123
enterCharactervaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VTextArea[0]Doe123
enterCharactervaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTextField[0]john@doe.com123
enterCharactervaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]64123
mouseClickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[6]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]33,8
mouseClickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[7]/VTextField[0]72,10
mouseClickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[7]/VTextField[0]-18,15
typevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[7]/VTextField[0]YAY!
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[10]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestsfieldgroupBasicPersonForm::PID_SLog_row_01. Person [firstName=John, lastName=Doe, email=john@doe.com, age=64, sex=Male, address=Address [streetAddress=John street, postalCode=11223, city=John's town, country=USA], deceased=false, salary=null, salaryDouble=null, rent=null]
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[9]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestsfieldgroupBasicPersonForm::PID_SLog_row_02. Discarded changes
clickvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[10]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestsfieldgroupBasicPersonForm::PID_SLog_row_03. Person [firstName=John, lastName=Doe, email=john@doe.com, age=64, sex=Male, address=Address [streetAddress=John street, postalCode=11223, city=John's town, country=USA], deceased=false, salary=null, salaryDouble=null, rent=null]
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VTextField[0]John
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VTextArea[0]Doe
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTextField[0]john@doe.com
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]64
assertCSSClassvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[6]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]v-selected
assertNotCSSClassvaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[6]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]v-selected
assertValuevaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[7]/VTextField[0]NAAAAAH
- - diff --git a/uitest/tb2/com/vaadin/tests/fields/TabIndexes.html b/uitest/tb2/com/vaadin/tests/fields/TabIndexes.html deleted file mode 100644 index a78be3045c..0000000000 --- a/uitest/tb2/com/vaadin/tests/fields/TabIndexes.html +++ /dev/null @@ -1,376 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.fields.TabIndexes?restartApplication
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-1/domChild[1]/domChild[1]@tabIndex0
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-2/domChild[0]@tabIndex0
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-3/domChild[0]@tabIndex0
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-4/domChild[0]@tabIndex0
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-5@tabIndex0
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-6/domChild[0]@tabIndex0
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-7/domChild[0]@tabIndex0
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-8/domChild[0]/domChild[0]@tabIndex0
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-9/domChild[1]/domChild[1]@tabIndex0
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-10/domChild[1]@tabIndex0
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-11/domChild[1]@tabIndex0
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-12@tabIndex0
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-13@tabIndex0
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-14@tabIndex0
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-15/domChild[1]@tabIndex0
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-16/domChild[0]@tabIndex0
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-17@tabIndex0
clickvaadin=runcomvaadintestsfieldsTabIndexes::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VHorizontalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0]
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-1/domChild[1]/domChild[1]@tabIndex1
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-2/domChild[0]@tabIndex1
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-3/domChild[0]@tabIndex1
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-4/domChild[0]@tabIndex1
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-5@tabIndex1
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-6/domChild[0]@tabIndex1
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-7/domChild[0]@tabIndex1
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-8/domChild[0]/domChild[0]@tabIndex1
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-9/domChild[1]/domChild[1]@tabIndex1
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-10/domChild[1]@tabIndex1
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-11/domChild[1]@tabIndex1
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-12@tabIndex1
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-13@tabIndex1
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-14@tabIndex1
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-15/domChild[1]@tabIndex1
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-16/domChild[0]@tabIndex1
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-17@tabIndex1
clickvaadin=runcomvaadintestsfieldsTabIndexes::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VHorizontalLayout[0]/VOrderedLayout$Slot[2]/VButton[0]/domChild[0]/domChild[0]
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-1/domChild[1]/domChild[1]@tabIndex1
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-2/domChild[0]@tabIndex2
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-3/domChild[0]@tabIndex3
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-4/domChild[0]@tabIndex4
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-5@tabIndex5
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-6/domChild[0]@tabIndex6
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-7/domChild[0]@tabIndex7
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-8/domChild[0]/domChild[0]@tabIndex8
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-9/domChild[1]/domChild[1]@tabIndex9
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-10/domChild[1]@tabIndex10
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-11/domChild[1]@tabIndex11
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-12@tabIndex12
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-13@tabIndex13
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-14@tabIndex14
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-15/domChild[1]@tabIndex15
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-16/domChild[0]@tabIndex16
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-17@tabIndex17
clickvaadin=runcomvaadintestsfieldsTabIndexes::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VHorizontalLayout[0]/VOrderedLayout$Slot[3]/VButton[0]/domChild[0]/domChild[0]
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-1/domChild[1]/domChild[1]@tabIndex17
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-2/domChild[0]@tabIndex16
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-3/domChild[0]@tabIndex15
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-4/domChild[0]@tabIndex14
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-5@tabIndex13
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-6/domChild[0]@tabIndex12
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-7/domChild[0]@tabIndex11
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-8/domChild[0]/domChild[0]@tabIndex10
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-9/domChild[1]/domChild[1]@tabIndex9
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-10/domChild[1]@tabIndex8
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-11/domChild[1]@tabIndex7
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-12@tabIndex6
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-13@tabIndex5
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-14@tabIndex4
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-15/domChild[1]@tabIndex3
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-16/domChild[0]@tabIndex2
assertAttributevaadin=runcomvaadintestsfieldsTabIndexes::PID_Sfield-17@tabIndex1
- - -- cgit v1.2.3 From 255da01eb1208ac5b2f0994bb16f9b370d33bfab Mon Sep 17 00:00:00 2001 From: patrik Date: Thu, 16 Apr 2015 11:26:35 +0300 Subject: Create declarative UI test harness (#17484) Change-Id: I8d83830f897b50a73f2fa125d297457f7a90888c --- .../vaadin/tests/components/DeclarativeTestUI.java | 175 +++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/DeclarativeTestUI.java (limited to 'uitest/src/com') diff --git a/uitest/src/com/vaadin/tests/components/DeclarativeTestUI.java b/uitest/src/com/vaadin/tests/components/DeclarativeTestUI.java new file mode 100644 index 0000000000..568c484760 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/DeclarativeTestUI.java @@ -0,0 +1,175 @@ +/* + * 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 java.io.File; +import java.io.FileInputStream; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Component; +import com.vaadin.ui.declarative.Design; + +/** + * Declarative test UI. Provides simple instantiation of HTML designs located + * under {@code uitest/src}. Also provides {@link OnLoad} annotation that lets + * you easily hook up methods to run after the UI has been created. Note: you + * must add the {@link DeclarativeUI} annotation to your subclass; not + * doing this will result in program failure. + */ +@SuppressWarnings("serial") +public class DeclarativeTestUI extends AbstractTestUI { + + private Logger logger; + private Component component; + + /** + * Class marker indicating the design .html file to load + */ + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.TYPE) + public static @interface DeclarativeUI { + String value(); + + /** + * Set this property to true if you provide an absolute path to your + * design; otherwise, the DeclarativeTestUI logic will look for the HTML + * design file under {@code vaadin_project/uitest/src//}. + */ + boolean absolutePath() default false; + } + + /** + * Method marker interface indicating that a method should be run after the + * declarative UI has been created + */ + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.METHOD) + public static @interface OnLoad { + + } + + /** + * Figure out the proper path for the HTML design file + */ + private String getDesignPath() { + Class clazz = getClass(); + String designFilePath = null; + if (clazz.getAnnotation(DeclarativeUI.class).absolutePath()) { + designFilePath = ""; + } else { + // This is rather nasty.. but it works well enough for now. + String userDir = System.getProperty("user.dir"); + designFilePath = userDir + "/uitest/src/" + + clazz.getPackage().getName().replace('.', '/') + "/"; + } + + String designFileName = clazz.getAnnotation(DeclarativeUI.class) + .value(); + + return designFilePath + designFileName; + } + + private Component readDesign() throws Exception { + String path = getDesignPath(); + getLogger().log(Level.INFO, "Reading design from " + path); + + File file = new File(path); + return Design.read(new FileInputStream(file)); + } + + @Override + protected void setup(VaadinRequest request) { + Class clazz = getClass(); + + if (clazz.isAnnotationPresent(DeclarativeUI.class)) { + + // Create component + try { + component = readDesign(); + } catch (Exception e1) { + getLogger().log(Level.SEVERE, "Error reading design", e1); + return; + } + + addComponent(component); + + // Call on-load methods (if applicable) + Method[] methods = clazz.getMethods(); + for (Method m : methods) { + if (m.isAnnotationPresent(OnLoad.class)) { + try { + m.invoke(this, (Object[]) null); + } catch (IllegalAccessException e) { + getLogger().log(Level.SEVERE, + "Error invoking @OnLoad method", e); + return; + } catch (IllegalArgumentException e) { + getLogger().log(Level.SEVERE, + "Error invoking @OnLoad method", e); + return; + } catch (InvocationTargetException e) { + getLogger().log(Level.SEVERE, + "Error invoking @OnLoad method", e); + return; + } + } + } + + } else { + throw new IllegalStateException( + "Cannot find declarative UI annotation"); + } + } + + /** + * Get access to the declaratively created component. This method typecasts + * the component to the receiving type; if there's a mismatch between what + * you expect and what's written in the design, this will fail with a + * ClassCastException. + * + * @return a Vaadin component + */ + @SuppressWarnings("unchecked") + public T getComponent() { + try { + return (T) component; + } catch (ClassCastException ex) { + getLogger().log(Level.SEVERE, + "Component code/design type mismatch", ex); + } + return null; + } + + /** + * Get access to the logger of this class + * + * @return a Logger instance + */ + protected Logger getLogger() { + if (logger == null) { + logger = Logger.getLogger(getClass().getName()); + } + return logger; + } +} -- cgit v1.2.3 From f90d32f230888de7ee684a93bcfbfb6ad2d25293 Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Thu, 16 Apr 2015 14:40:46 +0300 Subject: Add GridItemEditor declarative test UI Change-Id: I4a26d1508cc422bada57626f67f16d118be5f237 --- .../grid/declarative/GridItemEditor.html | 81 ++++++++++++++++++++++ .../grid/declarative/GridItemEditor.java | 23 ++++++ 2 files changed, 104 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/grid/declarative/GridItemEditor.html create mode 100644 uitest/src/com/vaadin/tests/components/grid/declarative/GridItemEditor.java (limited to 'uitest/src/com') diff --git a/uitest/src/com/vaadin/tests/components/grid/declarative/GridItemEditor.html b/uitest/src/com/vaadin/tests/components/grid/declarative/GridItemEditor.html new file mode 100644 index 0000000000..b1532d282a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/grid/declarative/GridItemEditor.html @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
## + Name + Progress + Weight +
00 + Marc Addams + 0.42 + [SparkLine] +
01 + Kenny Black + 0.72 + [SparkLine] +
02 + Sarah McGoff + 0.12 + [SparkLine] +
03 + Jos Jones + 0.62 + [SparkLine] +
04 + Jane Fielding + 0.92 + [SparkLine] +
05 + Marc Einstein + 0.05 + [SparkLine] +
06 + Lenny McGoff + 0.40 + [SparkLine] +
07 + Peter Adams + 0.85 + [SparkLine] +
08 + Tony Stark + 0.22 + [SparkLine] +
09 + Nathan Fillion + 0.15 + [SparkLine] +
+
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/grid/declarative/GridItemEditor.java b/uitest/src/com/vaadin/tests/components/grid/declarative/GridItemEditor.java new file mode 100644 index 0000000000..9673626f45 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/grid/declarative/GridItemEditor.java @@ -0,0 +1,23 @@ +/* + * 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.grid.declarative; + +import com.vaadin.tests.components.DeclarativeTestUI; +import com.vaadin.tests.components.DeclarativeTestUI.DeclarativeUI; + +@DeclarativeUI("GridItemEditor.html") +public class GridItemEditor extends DeclarativeTestUI { +} -- cgit v1.2.3 From 0636e2d177a933dae13e50eb1b1f4609855f735e Mon Sep 17 00:00:00 2001 From: Pekka Hyvönen Date: Fri, 17 Apr 2015 09:10:33 +0300 Subject: Add Grid basic features declarative UI Change-Id: I8bcc14787b4d00361d5ebbb92065632eef47241c --- .../grid/declarative/GridBasicFeatures.html | 499 +++++++++++++++++++++ .../declarative/GridDeclarativeBasicFeatures.java | 27 ++ 2 files changed, 526 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/grid/declarative/GridBasicFeatures.html create mode 100644 uitest/src/com/vaadin/tests/components/grid/declarative/GridDeclarativeBasicFeatures.java (limited to 'uitest/src/com') diff --git a/uitest/src/com/vaadin/tests/components/grid/declarative/GridBasicFeatures.html b/uitest/src/com/vaadin/tests/components/grid/declarative/GridBasicFeatures.html new file mode 100644 index 0000000000..c2de666641 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/grid/declarative/GridBasicFeatures.html @@ -0,0 +1,499 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 2012201320142015
CompanyH1H2H1H2H1H2H1H2
+ + + + + + + + + + +
Deomic$6,063.67$7,116.66$5,879.24$5,270.28$393.65$4,922.45$5,443.97$203.05
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$6,508.00$8,904.53$3,938.05$2,283.44
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$4,543.26$2,004.65$5,961.86$5,753.23
Deomic$6,063.67$7,116.66$5,879.24$5,270.28$393.65$4,922.45$5,443.97$203.05
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$6,508.00$8,904.53$3,938.05$2,283.44
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$4,543.26$2,004.65$5,961.86$5,753.23
Deomic$6,063.67$7,116.66$5,879.24$5,270.28$393.65$4,922.45$5,443.97$203.05
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$6,508.00$8,904.53$3,938.05$2,283.44
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$4,543.26$2,004.65$5,961.86$5,753.23
Deomic$6,063.67$7,116.66$5,879.24$5,270.28$393.65$4,922.45$5,443.97$203.05
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$6,508.00$8,904.53$3,938.05$2,283.44
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$4,543.26$2,004.65$5,961.86$5,753.23
Deomic$6,063.67$7,116.66$5,879.24$5,270.28$393.65$4,922.45$5,443.97$203.05
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$6,508.00$8,904.53$3,938.05$2,283.44
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$4,543.26$2,004.65$5,961.86$5,753.23
Deomic$6,063.67$7,116.66$5,879.24$5,270.28$393.65$4,922.45$5,443.97$203.05
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$6,508.00$8,904.53$3,938.05$2,283.44
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$4,543.26$2,004.65$5,961.86$5,753.23
Deomic$6,063.67$7,116.66$5,879.24$5,270.28$393.65$4,922.45$5,443.97$203.05
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$6,508.00$8,904.53$3,938.05$2,283.44
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$4,543.26$2,004.65$5,961.86$5,753.23
Deomic$6,063.67$7,116.66$5,879.24$5,270.28$393.65$4,922.45$5,443.97$203.05
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$6,508.00$8,904.53$3,938.05$2,283.44
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$4,543.26$2,004.65$5,961.86$5,753.23
Deomic$6,063.67$7,116.66$5,879.24$5,270.28$393.65$4,922.45$5,443.97$203.05
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$6,508.00$8,904.53$3,938.05$2,283.44
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$4,543.26$2,004.65$5,961.86$5,753.23
Deomic$6,063.67$7,116.66$5,879.24$5,270.28$393.65$4,922.45$5,443.97$203.05
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$6,508.00$8,904.53$3,938.05$2,283.44
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$4,543.26$2,004.65$5,961.86$5,753.23
Deomic$6,063.67$7,116.66$5,879.24$5,270.28$393.65$4,922.45$5,443.97$203.05
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$6,508.00$8,904.53$3,938.05$2,283.44
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$4,543.26$2,004.65$5,961.86$5,753.23
Deomic$6,063.67$7,116.66$5,879.24$5,270.28$393.65$4,922.45$5,443.97$203.05
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$6,508.00$8,904.53$3,938.05$2,283.44
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$4,543.26$2,004.65$5,961.86$5,753.23
Deomic$6,063.67$7,116.66$5,879.24$5,270.28$393.65$4,922.45$5,443.97$203.05
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$6,508.00$8,904.53$3,938.05$2,283.44
Deomic$4,802.82$7,083.74$6,418.09$9,964.82$4,543.26$2,004.65$5,961.86$5,753.23
+ $$$$$$$$$$$$$$$$$$$$$$$$
+
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/grid/declarative/GridDeclarativeBasicFeatures.java b/uitest/src/com/vaadin/tests/components/grid/declarative/GridDeclarativeBasicFeatures.java new file mode 100644 index 0000000000..cd4bf4e69b --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/grid/declarative/GridDeclarativeBasicFeatures.java @@ -0,0 +1,27 @@ +/* + * 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.grid.declarative; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.components.DeclarativeTestUI; +import com.vaadin.tests.components.DeclarativeTestUI.DeclarativeUI; + +@SuppressWarnings("serial") +@Theme("valo") +@DeclarativeUI("GridBasicFeatures.html") +public class GridDeclarativeBasicFeatures extends DeclarativeTestUI { + +} -- cgit v1.2.3