diff options
Diffstat (limited to 'uitest/src/com/vaadin/tests/components')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/label/LabelModes.java | 9 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/table/ShowLastItem.html (renamed from uitest/src/com/vaadin/tests/components/label/LabelModes.html) | 23 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/table/ShowLastItem.java | 66 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/ui/UIAccess.java (renamed from uitest/src/com/vaadin/tests/components/ui/UiAccess.java) | 33 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/ui/UiAccessPush.html | 41 |
5 files changed, 123 insertions, 49 deletions
diff --git a/uitest/src/com/vaadin/tests/components/label/LabelModes.java b/uitest/src/com/vaadin/tests/components/label/LabelModes.java index e5bc539f36..1959447a4b 100644 --- a/uitest/src/com/vaadin/tests/components/label/LabelModes.java +++ b/uitest/src/com/vaadin/tests/components/label/LabelModes.java @@ -2,10 +2,19 @@ package com.vaadin.tests.components.label; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.components.ComponentTestCase; +import com.vaadin.tests.tb3.SimpleMultiBrowserTest; import com.vaadin.ui.Label; public class LabelModes extends ComponentTestCase<Label> { + public static class LabelModesTest extends SimpleMultiBrowserTest { + @Override + public void test() throws Exception { + compareScreen("labelmodes"); + } + + } + @Override protected Class<Label> getTestClass() { return Label.class; diff --git a/uitest/src/com/vaadin/tests/components/label/LabelModes.html b/uitest/src/com/vaadin/tests/components/table/ShowLastItem.html index 356688b456..c9c93198fa 100644 --- a/uitest/src/com/vaadin/tests/components/label/LabelModes.html +++ b/uitest/src/com/vaadin/tests/components/table/ShowLastItem.html @@ -3,7 +3,6 @@ <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>New Test</title> </head> <body> @@ -12,14 +11,24 @@ <tr><td rowspan="1" colspan="3">New Test</td></tr> </thead><tbody> <tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.label.LabelModes?restartApplication</td> - <td></td> + <td>open</td> + <td>/run/com.vaadin.tests.components.table.ShowLastItem?restartApplication</td> + <td></td> </tr> <tr> - <td>screenCapture</td> - <td></td> - <td>labelmodes</td> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableShowLastItem::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td>1000</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>row-20-fully-visible</td> </tr> </tbody></table> diff --git a/uitest/src/com/vaadin/tests/components/table/ShowLastItem.java b/uitest/src/com/vaadin/tests/components/table/ShowLastItem.java new file mode 100644 index 0000000000..6d6f744918 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/ShowLastItem.java @@ -0,0 +1,66 @@ +package com.vaadin.tests.components.table; + +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.Table; + +public class ShowLastItem extends AbstractTestUI { + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + final Table table = new Table(); + table.setHeight("210px"); + + table.addContainerProperty("Col", String.class, ""); + + for (int i = 0; i < 20; i++) { + table.addItem(i).getItemProperty("Col") + .setValue("row " + String.valueOf(i)); + } + + Button addItemBtn = new Button("Add item", new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + Object itemId = "row " + table.getItemIds().size(); + + table.addItem(itemId).getItemProperty("Col") + .setValue(String.valueOf(itemId)); + + table.setCurrentPageFirstItemIndex(table.getItemIds().size() - 1); + } + }); + + addComponent(table); + addComponent(addItemBtn); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "Show last item in Table by using setCurrentPageFirstItemId"; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + return 12407; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/ui/UiAccess.java b/uitest/src/com/vaadin/tests/components/ui/UIAccess.java index 09f2fd8816..057dcaa917 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UiAccess.java +++ b/uitest/src/com/vaadin/tests/components/ui/UIAccess.java @@ -21,17 +21,48 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.locks.ReentrantLock; +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.ExpectedConditions; + import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinService; import com.vaadin.server.VaadinSession; import com.vaadin.shared.communication.PushMode; import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.tests.tb3.MultiBrowserTest; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI; import com.vaadin.util.CurrentInstance; -public class UiAccess extends AbstractTestUIWithLog { +public class UIAccess extends AbstractTestUIWithLog { + + public static class UIAccessTest extends MultiBrowserTest { + @Override + protected boolean isPushEnabled() { + return true; + } + + @Test + public void testThreadLocals() { + getCurrentInstanceWhenPushingButton().click(); + waitUntil(ExpectedConditions.textToBePresentInElement( + vaadinLocatorById("Log_row_0"), "1.")); + Assert.assertEquals( + "0. Current UI matches in beforeResponse? true", + vaadinElementById("Log_row_1").getText()); + Assert.assertEquals( + "1. Current session matches in beforeResponse? true", + vaadinElementById("Log_row_0").getText()); + + } + + private WebElement getCurrentInstanceWhenPushingButton() { + return vaadinElement("/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[7]/VButton[0]"); + } + } private volatile boolean checkCurrentInstancesBeforeResponse = false; diff --git a/uitest/src/com/vaadin/tests/components/ui/UiAccessPush.html b/uitest/src/com/vaadin/tests/components/ui/UiAccessPush.html deleted file mode 100644 index bc29534ee4..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UiAccessPush.html +++ /dev/null @@ -1,41 +0,0 @@ -<?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>New Test</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">New Test</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.ui.UiAccess?restartApplication&transport=websocket</td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[7]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForNotText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> - <td>exact:1. Current session matches in beforeResponse? true</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td> - <td>exact:0. Current UI matches in beforeResponse? true</td> -</tr> -</tbody></table> -</body> -</html> |