diff options
author | Markus Koivisto <markus@vaadin.com> | 2014-08-04 14:25:16 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-08-05 08:31:02 +0000 |
commit | ae37910f4cb307c929df32e6499b9e1872192377 (patch) | |
tree | 5690abd4b9716b38d3e74f3442993e463b334b09 /uitest | |
parent | f5bb5f33883e31d128fe784b4a0d874b970fb3f4 (diff) | |
download | vaadin-framework-ae37910f4cb307c929df32e6499b9e1872192377.tar.gz vaadin-framework-ae37910f4cb307c929df32e6499b9e1872192377.zip |
Reverting multiple commits that caused 100+ regression tests to fail.
Commits reverted:
* 392e8a0 - Minor refactor to #14147 patch
* 8d470c9 - Context menu is not shown in Table body on mobi... (#13694)
* f7dc719 - Fix Table stuck scroll position after setting ... (#14147)
Change-Id: I3f5ed7fa15a9cfebce7a57662d229bf46118c5d6
Diffstat (limited to 'uitest')
3 files changed, 0 insertions, 410 deletions
diff --git a/uitest/src/com/vaadin/tests/components/table/TableScrollAfterAddRow.java b/uitest/src/com/vaadin/tests/components/table/TableScrollAfterAddRow.java deleted file mode 100644 index d1d6edaa67..0000000000 --- a/uitest/src/com/vaadin/tests/components/table/TableScrollAfterAddRow.java +++ /dev/null @@ -1,167 +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.table; - -/** - * - * @author Vaadin Ltd - */ -import com.vaadin.data.Item; -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Label; -import com.vaadin.ui.NativeButton; -import com.vaadin.ui.Table; -import com.vaadin.ui.VerticalLayout; - -/* - * 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. - */ - -/** - * - * @author Vaadin Ltd - */ -@SuppressWarnings("serial") -public class TableScrollAfterAddRow extends AbstractTestUI { - - /* - * (non-Javadoc) - * - * @see com.vaadin.ui.UI#init(com.vaadin.server.VaadinRequest) - */ - @Override - protected void setup(VaadinRequest request) { - - final int totalRows = 100; - - final VerticalLayout layout = new VerticalLayout(); - - final IndexedContainer datasource = new IndexedContainer(); - - datasource.addContainerProperty("value", Integer.class, -1); - for (int i = 0; i < totalRows; i++) { - addRow(datasource); - } - - final Table table = new Table(); - table.setContainerDataSource(datasource); - layout.addComponent(table); - addComponent(layout); - - final Label label = new Label(""); - layout.addComponent(label); - - NativeButton addRowButton = new NativeButton("Add row", - new NativeButton.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - addRow(datasource); - } - }); - - NativeButton jumpToLastRowButton = new NativeButton("Jump to last row", - new NativeButton.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - jumpToLastRow(table); - } - }); - NativeButton jumpTo15thRowButton = new NativeButton("Jump to 15th row", - new NativeButton.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - jumpToFifteenthRow(table); - } - }); - NativeButton jumpToFirstRowButton = new NativeButton( - "Jump to first row", new NativeButton.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - jumpToFirstRow(table); - } - }); - - NativeButton updateLabelButton = new NativeButton("UpdateLabel", - new NativeButton.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - label.setValue(Integer.toString(table - .getCurrentPageFirstItemIndex())); - } - }); - layout.addComponent(addRowButton); - layout.addComponent(jumpToLastRowButton); - layout.addComponent(jumpTo15thRowButton); - layout.addComponent(jumpToFirstRowButton); - layout.addComponent(updateLabelButton); - } - - private void jumpToFifteenthRow(Table table) { - table.setCurrentPageFirstItemIndex(14); - } - - private void jumpToLastRow(Table table) { - int visibleRows = table.getContainerDataSource().size(); - table.setCurrentPageFirstItemIndex(visibleRows - 1); - } - - private void jumpToFirstRow(Table table) { - table.setCurrentPageFirstItemIndex(0); - } - - private void addRow(IndexedContainer datasource) { - int rowNumber = datasource.size(); - Item row = datasource.addItem(rowNumber); - row.getItemProperty("value").setValue(rowNumber); - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() - */ - @Override - protected String getTestDescription() { - // TODO Auto-generated method stub - return ""; - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() - */ - @Override - protected Integer getTicketNumber() { - return 14147; - } -} diff --git a/uitest/src/com/vaadin/tests/components/table/TableScrollAfterAddRowTest.java b/uitest/src/com/vaadin/tests/components/table/TableScrollAfterAddRowTest.java deleted file mode 100644 index a020ace6b0..0000000000 --- a/uitest/src/com/vaadin/tests/components/table/TableScrollAfterAddRowTest.java +++ /dev/null @@ -1,104 +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.table; - -import static org.junit.Assert.assertEquals; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.WebElement; - -import com.vaadin.testbench.commands.TestBenchCommandExecutor; -import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.testbench.elements.LabelElement; -import com.vaadin.testbench.screenshot.ImageComparison; -import com.vaadin.testbench.screenshot.ReferenceNameGenerator; -import com.vaadin.tests.tb3.MultiBrowserTest; - -/** - * - * @author Vaadin Ltd - */ -public class TableScrollAfterAddRowTest extends MultiBrowserTest { - - @Before - public void init() { - openTestURL(); - } - - @Test - public void testJumpToFirstRow() { - jumpToFifteenthRow(); - jumpToFirstRow(); - assertEquals("0", getCurrentPageFirstItemIndex()); - } - - @Test - public void testAddRowAfterJumpToLastRow() throws InterruptedException { - jumpToLastRow(); - addRow(); - sleep(200); - assertEquals("85", getCurrentPageFirstItemIndex()); - } - - @Test - public void testAddRowAfterJumpingToLastRowAndScrollingUp() - throws InterruptedException { - jumpToLastRow(); - scrollUp(); - addRow(); - sleep(200); - Assert.assertNotEquals("86", getCurrentPageFirstItemIndex()); - } - - private void scrollUp() { - WebElement actualElement = getDriver().findElement( - By.className("v-table-body-wrapper")); - JavascriptExecutor js = new TestBenchCommandExecutor(getDriver(), - new ImageComparison(), new ReferenceNameGenerator()); - js.executeScript("arguments[0].scrollTop = " + 30, actualElement); - } - - private String getCurrentPageFirstItemIndex() { - ButtonElement updateLabelButton = $(ButtonElement.class).get(4); - LabelElement label = $(LabelElement.class).get(1); - updateLabelButton.click(); - return label.getText(); - } - - private void addRow() { - ButtonElement button = $(ButtonElement.class).get(0); - button.click(); - } - - private void jumpToFirstRow() { - ButtonElement button = $(ButtonElement.class).get(3); - button.click(); - } - - private void jumpToFifteenthRow() { - ButtonElement button = $(ButtonElement.class).get(2); - button.click(); - } - - private void jumpToLastRow() { - ButtonElement button = $(ButtonElement.class).get(1); - button.click(); - } -} diff --git a/uitest/src/com/vaadin/tests/components/table/TabletContextMenu.java b/uitest/src/com/vaadin/tests/components/table/TabletContextMenu.java deleted file mode 100644 index 193cb499a7..0000000000 --- a/uitest/src/com/vaadin/tests/components/table/TabletContextMenu.java +++ /dev/null @@ -1,139 +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.table; - -import com.vaadin.event.Action; -import com.vaadin.event.Action.Handler; -import com.vaadin.event.ShortcutAction; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Table; - -/** - * A test UI for context menus on different parts of a VSCrollTable. - * - * This UI has no attached unit test due to the poor support of touch events on - * Selenium. - * - * @since - * @author Vaadin Ltd - */ -public class TabletContextMenu extends AbstractTestUI { - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. - * VaadinRequest) - */ - @Override - protected void setup(VaadinRequest request) { - setSizeFull(); - - HorizontalLayout layout = new HorizontalLayout(); - layout.setSizeFull(); - layout.setSpacing(true); - addComponent(layout); - - Table table1 = createTable("no scrolling, has context menu"); - addActionHandler(table1); - table1.addItem(); - layout.addComponent(table1); - - Table table2 = createTable("should scroll, has context menu"); - for (int i = 0; i < 100; ++i) { - table2.addItem(); - } - addActionHandler(table2); - layout.addComponent(table2); - - Table table3 = createTable("no scrolling, no context menu"); - table3.addItem(); - layout.addComponent(table3); - - Table table4 = createTable("should scroll, no context menu"); - for (int i = 0; i < 100; ++i) { - table4.addItem(); - } - layout.addComponent(table4); - } - - private Table createTable(String caption) { - Table table = new Table(caption); - table.setImmediate(true); - - table.addContainerProperty("column1", String.class, "test"); - table.setSizeFull(); - table.setHeight("500px"); - table.setSelectable(true); - - return table; - } - - private void addActionHandler(Table table) { - table.addActionHandler(new Handler() { - - Action tabNext = new ShortcutAction("Shift", - ShortcutAction.KeyCode.TAB, null); - Action tabPrev = new ShortcutAction("Shift+Tab", - ShortcutAction.KeyCode.TAB, - new int[] { ShortcutAction.ModifierKey.SHIFT }); - Action curDown = new ShortcutAction("Down", - ShortcutAction.KeyCode.ARROW_DOWN, null); - Action curUp = new ShortcutAction("Up", - ShortcutAction.KeyCode.ARROW_UP, null); - Action enter = new ShortcutAction("Enter", - ShortcutAction.KeyCode.ENTER, null); - Action add = new ShortcutAction("Add Below", - ShortcutAction.KeyCode.A, null); - Action delete = new ShortcutAction("Delete", - ShortcutAction.KeyCode.DELETE, null); - - @Override - public void handleAction(Action action, Object sender, Object target) { - System.out.println(action.getCaption()); - } - - @Override - public Action[] getActions(Object target, Object sender) { - return new Action[] { tabNext, tabPrev, curDown, curUp, enter, - add, delete }; - } - }); - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() - */ - @Override - protected String getTestDescription() { - return "Make sure empty table parts have context menu on touch screen devices"; - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() - */ - @Override - protected Integer getTicketNumber() { - return 13694; - } - -} |