diff options
author | Anna Koskinen <anna@vaadin.com> | 2013-01-28 18:07:50 +0200 |
---|---|---|
committer | Anna Koskinen <anna@vaadin.com> | 2013-02-01 14:21:11 +0200 |
commit | 7b2c4418a606918e5af15185c87e1fe14bacd61e (patch) | |
tree | aa4e4569be4deb87d0c59f3067ed87fe9c96c77e /uitest/src/com/vaadin/tests | |
parent | 9c6f83505896145c6d84534c610720ede83993e0 (diff) | |
download | vaadin-framework-7b2c4418a606918e5af15185c87e1fe14bacd61e.tar.gz vaadin-framework-7b2c4418a606918e5af15185c87e1fe14bacd61e.zip |
Merge of (#10609) to Vaadin 7.
Automated test for #9986.
Change-Id: I3ce8b61ac7efd8eaa7a1b16e786ce7c2edbad0a9
Diffstat (limited to 'uitest/src/com/vaadin/tests')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.html | 179 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java | 84 |
2 files changed, 233 insertions, 30 deletions
diff --git a/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.html b/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.html new file mode 100644 index 0000000000..3aecf8bf97 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.html @@ -0,0 +1,179 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="" /> +<title>ValueAfterClearingContainer</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">ValueAfterClearingContainer</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.table.ValueAfterClearingContainer?restartApplication</td> + <td></td> +</tr> +<!-- add items and select one of them --> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SaddItemsButton/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td> + <td>40,13</td> +</tr> +<!-- verify selection --> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td> + <td>1. Value changed to 2</td> +</tr> +<!-- remove items from table --> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveItemsFromTableButton/domChild[0]</td> + <td></td> +</tr> +<!-- verify that removal cleared the selection --> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td> + <td>2. Value changed to null</td> +</tr> +<!-- replace the items and select one of them --> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SaddItemsButton/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td> + <td>40,13</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td> + <td>3. Value changed to 2</td> +</tr> +<!-- remove items from container --> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveItemsFromContainerButton/domChild[0]</td> + <td></td> +</tr> +<!-- verify that removal failed to clear the value --> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SshowValueButton/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td> + <td>4. Table selection: 2</td> +</tr> +<!-- replace the items --> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SaddItemsButton/domChild[0]</td> + <td></td> +</tr> +<!-- verify that selection still exists --> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SshowValueButton/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td> + <td>5. Table selection: 2</td> +</tr> +<!-- remove items from container and sanitize the table --> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveItemsFromContainerAndSanitizeButton/domChild[0]</td> + <td></td> +</tr> +<!-- verify that sanitizing cleared the value --> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td> + <td>6. Value changed to null</td> +</tr> +<!-- replace the items and select one of them --> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SaddItemsButton/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td> + <td>40,13</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td> + <td>7. Value changed to 2</td> +</tr> +<!-- remove selected item from the table --> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveSelectedFromTableButton/domChild[0]</td> + <td></td> +</tr> +<!-- verify that removal cleared the selection --> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td> + <td>8. Value changed to null</td> +</tr> +<!-- select new item and remove it from the container --> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td> + <td>40,13</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td> + <td>9. Value changed to 3</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveSelectedFromContainer/domChild[0]</td> + <td></td> +</tr> +<!-- verify that removal failed to clear the value --> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SshowValueButton/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td> + <td>10. Table selection: 3</td> +</tr> +<!-- verify the item has been removed --> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td> + <td>40,13</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td> + <td>11. Value changed to 4</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java b/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java index 93e7cafa99..f378c146ea 100644 --- a/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java +++ b/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java @@ -19,6 +19,8 @@ public class ValueAfterClearingContainer extends TestBase { @Override protected void setup() { + log.setId("log"); + table.setId("table"); table.setSelectable(true); table.addContainerProperty(PROPERTY_ID, Integer.class, null); table.setImmediate(true); @@ -33,6 +35,7 @@ public class ValueAfterClearingContainer extends TestBase { addComponent(table); final CheckBox multiselect = new CheckBox("Multiselect"); multiselect.setImmediate(true); + multiselect.setId("multiselect"); multiselect.addValueChangeListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { @@ -41,48 +44,64 @@ public class ValueAfterClearingContainer extends TestBase { } }); addComponent(multiselect); - addComponent(new Button("Add table items", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - if (!table.getItemIds().isEmpty()) { - Notification.show("Only possible when the table is empty"); - return; - } else { - for (int i = 0; i < 5; i++) { - table.addItem(new Object[] { Integer.valueOf(i) }, - Integer.valueOf(i)); + Button addItemsButton = new Button("Add table items", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + if (!table.getItemIds().isEmpty()) { + Notification + .show("Only possible when the table is empty"); + return; + } else { + for (int i = 0; i < 5; i++) { + table.addItem( + new Object[] { Integer.valueOf(i) }, + Integer.valueOf(i)); + } + } } - } - } - })); + }); + addItemsButton.setId("addItemsButton"); + addComponent(addItemsButton); - addComponent(new Button("Show value", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - log.log("Table selection: " + table.getValue()); - } - })); - - addComponent(new Button("Remove items from table", + Button showValueButton = new Button("Show value", new Button.ClickListener() { public void buttonClick(ClickEvent event) { + log.log("Table selection: " + table.getValue()); + } + }); + showValueButton.setId("showValueButton"); + addComponent(showValueButton); + + Button removeItemsFromTableButton = new Button( + "Remove items from table", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { table.removeAllItems(); } - })); + }); + removeItemsFromTableButton.setId("removeItemsFromTableButton"); + addComponent(removeItemsFromTableButton); - addComponent(new Button("Remove items from container", - new Button.ClickListener() { + Button removeItemsFromContainerButton = new Button( + "Remove items from container", new Button.ClickListener() { public void buttonClick(ClickEvent event) { table.getContainerDataSource().removeAllItems(); } - })); - addComponent(new Button("Remove items from container and sanitize", + }); + removeItemsFromContainerButton.setId("removeItemsFromContainerButton"); + addComponent(removeItemsFromContainerButton); + Button removeItemsFromContainerAndSanitizeButton = new Button( + "Remove items from container and sanitize", new Button.ClickListener() { public void buttonClick(ClickEvent event) { table.getContainerDataSource().removeAllItems(); table.sanitizeSelection(); } - })); - addComponent(new Button("Remove selected item from table", - new Button.ClickListener() { + }); + removeItemsFromContainerAndSanitizeButton + .setId("removeItemsFromContainerAndSanitizeButton"); + addComponent(removeItemsFromContainerAndSanitizeButton); + Button removeSelectedFromTableButton = new Button( + "Remove selected item from table", new Button.ClickListener() { public void buttonClick(ClickEvent event) { Object selection = table.getValue(); if (selection == null) { @@ -92,8 +111,11 @@ public class ValueAfterClearingContainer extends TestBase { table.removeItem(selection); } } - })); - addComponent(new Button("Remove selected item from container", + }); + removeSelectedFromTableButton.setId("removeSelectedFromTableButton"); + addComponent(removeSelectedFromTableButton); + Button removeSelectedFromContainer = new Button( + "Remove selected item from container", new Button.ClickListener() { public void buttonClick(ClickEvent event) { Object selection = table.getValue(); @@ -105,7 +127,9 @@ public class ValueAfterClearingContainer extends TestBase { .removeItem(selection); } } - })); + }); + removeSelectedFromContainer.setId("removeSelectedFromContainer"); + addComponent(removeSelectedFromContainer); } @Override |