diff options
author | Artur Signell <artur@vaadin.com> | 2013-03-12 12:58:05 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2013-03-12 12:58:07 +0200 |
commit | 0f3ac51ed4c34c9233463c1274c7107580faa1f9 (patch) | |
tree | 11a1de6982ca79c96c787cf395fe4f1fc51deeb9 /uitest | |
parent | 1853dea1b9277f2d5a8911bd2d20277158e221b7 (diff) | |
parent | 6922bc5b49c5551b289a5025ccd5901e2ac3aafc (diff) | |
download | vaadin-framework-0f3ac51ed4c34c9233463c1274c7107580faa1f9.tar.gz vaadin-framework-0f3ac51ed4c34c9233463c1274c7107580faa1f9.zip |
Merge commit '6922bc5b49c5551b289a5025ccd5901e2ac3aafc'
Change-Id: Id118fd9bae1fdf7e7ce2efd660ade5ba7bbc5109
Diffstat (limited to 'uitest')
15 files changed, 269 insertions, 17 deletions
diff --git a/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.html b/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.html new file mode 100644 index 0000000000..e5b1f47f2d --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.html @@ -0,0 +1,52 @@ +<?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="http://localhost:8888/" /> +<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.table.TableRowScrolledBottom?restartApplication</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableTableRowScrolledBottom::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td>500</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableTableRowScrolledBottom::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[44]/VLabel[0]</td> + <td>This is a test item with long text so that there is something to see Nr. 100. This text must be long otherwise the timing issue on Firefox does not occur. This works fine in IE</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableTableRowScrolledBottom::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td>500</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableTableRowScrolledBottom::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[44]/VLabel[0]</td> + <td>This is a test item with long text so that there is something to see Nr. 200. This text must be long otherwise the timing issue on Firefox does not occur. This works fine in IE</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java b/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java new file mode 100644 index 0000000000..9823fc1859 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java @@ -0,0 +1,55 @@ +package com.vaadin.tests.components.table; + +import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Label; +import com.vaadin.ui.Table; +import com.vaadin.ui.VerticalLayout; + +public class TableRowScrolledBottom extends TestBase { + + @Override + protected void setup() { + + final Table table = new Table(); + table.setSizeFull(); + table.addContainerProperty("Test", Label.class, null); + table.setHeight("100%"); + + Button button = new Button("Add 100 items"); + button.addClickListener(new Button.ClickListener() { + int i = 0; + + @Override + public void buttonClick(Button.ClickEvent event) { + for (int j = 0; j < 100; j++) { + ++i; + table.addItem( + new Object[] { new Label( + "This is a test item with long text so that there is something to see Nr. <b>" + + i + + "</b>. This text must be long otherwise the timing issue on Firefox does not occur. This works fine in IE", + ContentMode.HTML) }, i); + table.setCurrentPageFirstItemIndex(table + .getContainerDataSource().size() - 1); + } + } + }); + + addComponent(table); + addComponent(button); + getLayout().setExpandRatio(table, 1f); + } + + @Override + protected String getDescription() { + return "Table should be scrolled to bottom when adding rows and updating currentPageFirstItemIndex to last item"; + } + + @Override + protected Integer getTicketNumber() { + return 10970; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/ui/CustomUITest.html b/uitest/src/com/vaadin/tests/components/ui/CustomUITest.html new file mode 100644 index 0000000000..90f7df44d2 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/CustomUITest.html @@ -0,0 +1,27 @@ +<?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.CustomUITest?restartApplication&debug=</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//span</td> + <td>This is the CustomUIConnector</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/ui/CustomUITest.java b/uitest/src/com/vaadin/tests/components/ui/CustomUITest.java new file mode 100644 index 0000000000..3542806a92 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/CustomUITest.java @@ -0,0 +1,43 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.tests.components.ui; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.widgetset.TestingWidgetSet; +import com.vaadin.tests.widgetset.client.CustomUIConnectorRpc; + +@Widgetset(TestingWidgetSet.NAME) +public class CustomUITest extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + getRpcProxy(CustomUIConnectorRpc.class).test(); + } + + @Override + protected String getTestDescription() { + return "It should be possible to change the implementation of the UIConnector class"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(10867); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/uitest/base_theme_test.html b/uitest/src/com/vaadin/tests/components/uitest/base_theme_test.html index 99051a9e7b..0308a09a16 100644 --- a/uitest/src/com/vaadin/tests/components/uitest/base_theme_test.html +++ b/uitest/src/com/vaadin/tests/components/uitest/base_theme_test.html @@ -202,9 +202,9 @@ <td>tables</td> </tr> <tr> - <td>contextmenu</td> + <td>contextMenuAt</td> <td>//div[@id='table0']/div[2]/div[1]/table/tbody/tr[2]/td[1]/div</td> - <td></td> + <td>0,0</td> </tr> <tr> <td>screenCapture</td> diff --git a/uitest/src/com/vaadin/tests/components/uitest/chameleon_theme_test.html b/uitest/src/com/vaadin/tests/components/uitest/chameleon_theme_test.html index c4534b8064..fb00029d8f 100644 --- a/uitest/src/com/vaadin/tests/components/uitest/chameleon_theme_test.html +++ b/uitest/src/com/vaadin/tests/components/uitest/chameleon_theme_test.html @@ -202,9 +202,9 @@ <td>tables</td> </tr> <tr> - <td>contextmenu</td> + <td>contextMenuAt</td> <td>//div[@id='table0']/div[2]/div[1]/table/tbody/tr[2]/td[1]/div</td> - <td></td> + <td>0,0</td> </tr> <tr> <td>screenCapture</td> diff --git a/uitest/src/com/vaadin/tests/components/uitest/liferay_theme_test.html b/uitest/src/com/vaadin/tests/components/uitest/liferay_theme_test.html index 0a073b5384..193c648916 100644 --- a/uitest/src/com/vaadin/tests/components/uitest/liferay_theme_test.html +++ b/uitest/src/com/vaadin/tests/components/uitest/liferay_theme_test.html @@ -202,9 +202,9 @@ <td>tables</td> </tr> <tr> - <td>contextmenu</td> + <td>contextMenuAt</td> <td>//div[@id='table0']/div[2]/div[1]/table/tbody/tr[2]/td[1]/div</td> - <td></td> + <td>0,0</td> </tr> <tr> <td>screenCapture</td> diff --git a/uitest/src/com/vaadin/tests/components/uitest/reindeer_theme_test.html b/uitest/src/com/vaadin/tests/components/uitest/reindeer_theme_test.html index 441a87a088..b1340831bc 100644 --- a/uitest/src/com/vaadin/tests/components/uitest/reindeer_theme_test.html +++ b/uitest/src/com/vaadin/tests/components/uitest/reindeer_theme_test.html @@ -202,9 +202,9 @@ <td>tables</td> </tr> <tr> - <td>contextmenu</td> + <td>contextMenuAt</td> <td>//div[@id='table0']/div[2]/div[1]/table/tbody/tr[2]/td[1]/div</td> - <td></td> + <td>0,0</td> </tr> <tr> <td>screenCapture</td> diff --git a/uitest/src/com/vaadin/tests/components/uitest/runo_theme_test.html b/uitest/src/com/vaadin/tests/components/uitest/runo_theme_test.html index 33939ef076..fadc503abd 100644 --- a/uitest/src/com/vaadin/tests/components/uitest/runo_theme_test.html +++ b/uitest/src/com/vaadin/tests/components/uitest/runo_theme_test.html @@ -202,9 +202,9 @@ <td>tables</td> </tr> <tr> - <td>contextmenu</td> + <td>contextMenuAt</td> <td>//div[@id='table0']/div[2]/div[1]/table/tbody/tr[2]/td[1]/div</td> - <td></td> + <td>0,0</td> </tr> <tr> <td>screenCapture</td> diff --git a/uitest/src/com/vaadin/tests/extensions/BasicExtensionTest.html b/uitest/src/com/vaadin/tests/extensions/BasicExtensionTest.html index c57882b3f4..85a5900b74 100644 --- a/uitest/src/com/vaadin/tests/extensions/BasicExtensionTest.html +++ b/uitest/src/com/vaadin/tests/extensions/BasicExtensionTest.html @@ -24,7 +24,7 @@ <tr> <td>assertText</td> <td>//div[2]</td> - <td>BasicExtensionTestConnector extending UIConnector</td> + <td>BasicExtensionTestConnector extending CustomUIConnector</td> </tr> <tr> <td>click</td> @@ -34,7 +34,7 @@ <tr> <td>assertText</td> <td>//div[1]</td> - <td>BasicExtensionTestConnector removed for UIConnector</td> + <td>BasicExtensionTestConnector removed for CustomUIConnector</td> </tr> </tbody></table> </body> diff --git a/uitest/src/com/vaadin/tests/performance/BasicPerformanceTest.java b/uitest/src/com/vaadin/tests/performance/BasicPerformanceTest.java index b0047d6b62..04fe18fc08 100644 --- a/uitest/src/com/vaadin/tests/performance/BasicPerformanceTest.java +++ b/uitest/src/com/vaadin/tests/performance/BasicPerformanceTest.java @@ -22,13 +22,14 @@ public class BasicPerformanceTest extends UI { private int clientLimit; private int serverLimit; + private boolean reportBootstap = true; private String performanceTopic; private final Button reportPerformanceButton = new Button( "Report some performance", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { TestUtils.reportPerformance(performanceTopic, serverLimit, - clientLimit); + clientLimit, reportBootstap); event.getButton().setEnabled(false); } }); @@ -37,6 +38,7 @@ public class BasicPerformanceTest extends UI { public void init(VaadinRequest request) { setContent(buildMainLayout()); updatePerformanceReporting("first load", 100, 100); + reportBootstap = true; } private void updatePerformanceReporting(String performanceTopic, @@ -47,6 +49,7 @@ public class BasicPerformanceTest extends UI { reportPerformanceButton.setCaption("Report performance for " + performanceTopic); reportPerformanceButton.setEnabled(true); + reportBootstap = false; } private ComponentContainer buildMainLayout() { diff --git a/uitest/src/com/vaadin/tests/util/TestUtils.java b/uitest/src/com/vaadin/tests/util/TestUtils.java index 6cb6e79c1c..5c6315a23a 100644 --- a/uitest/src/com/vaadin/tests/util/TestUtils.java +++ b/uitest/src/com/vaadin/tests/util/TestUtils.java @@ -120,20 +120,23 @@ public class TestUtils { public static void installPerformanceReporting(TextArea targetTextArea) { targetTextArea.setId("performanceTestTarget"); JavaScript - .eval("window.reportVaadinPerformance = function(topic, serverLimit, clientLimit) {" + .eval("window.reportVaadinPerformance = function(topic, serverLimit, clientLimit, bootstrapTime) {" + "var element = document.getElementById('performanceTestTarget');" + "var text = topic + ': \\n';" + "for(var k in window.vaadin.clients) {" + "var p = window.vaadin.clients[k].getProfilingData();" + "text += ' Server time: ' + (p[3] > serverLimit?'FAIL':'OK') + ' (' + p[3] +')\\n';" + "text += ' Client time: ' + (p[0] > clientLimit?'FAIL':'OK') + ' (' + p[0] +')\\n';" + + "if (bootstrapTime) text += ' Bootstrap time: ' + (p[4] > clientLimit?'FAIL':'OK') + ' (' + p[4] +')\\n';" + "}" + "element.value = text;" + "}"); } public static void reportPerformance(String topic, int serverLimit, - int totalLimit) { - JavaScript.eval("window.reportVaadinPerformance(\"" + topic + "\", " - + serverLimit + ", " + totalLimit + ");"); + int clientLimit, boolean bootstrapTime) { + JavaScript + .eval("window.reportVaadinPerformance(\"" + topic + "\", " + + serverLimit + ", " + clientLimit + "," + + bootstrapTime + ");"); } public static IndexedContainer getISO3166Container() { diff --git a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml index c127d3bb21..919a4a5d69 100644 --- a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml +++ b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml @@ -3,4 +3,9 @@ <!-- Inherit the DefaultWidgetSet --> <inherits name="com.vaadin.DefaultWidgetSet" /> + + <replace-with class="com.vaadin.tests.widgetset.client.CustomUIConnector"> + <when-type-is class="com.vaadin.client.ui.ui.UIConnector" /> + </replace-with> + </module> diff --git a/uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnector.java new file mode 100644 index 0000000000..ddf6763f1b --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnector.java @@ -0,0 +1,41 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.tests.widgetset.client; + +import com.google.gwt.dom.client.Document; +import com.google.gwt.dom.client.SpanElement; +import com.vaadin.client.Util; +import com.vaadin.client.ui.ui.UIConnector; +import com.vaadin.shared.ui.Connect; +import com.vaadin.ui.UI; + +@Connect(UI.class) +public class CustomUIConnector extends UIConnector { + @Override + protected void init() { + super.init(); + registerRpc(CustomUIConnectorRpc.class, new CustomUIConnectorRpc() { + @Override + public void test() { + SpanElement span = Document.get().createSpanElement(); + span.setInnerText("This is the " + + Util.getSimpleName(CustomUIConnector.this)); + Document.get().getBody().insertFirst(span); + } + }); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnectorRpc.java b/uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnectorRpc.java new file mode 100644 index 0000000000..217d906137 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnectorRpc.java @@ -0,0 +1,23 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.tests.widgetset.client; + +import com.vaadin.shared.communication.ClientRpc; + +public interface CustomUIConnectorRpc extends ClientRpc { + public void test(); +} |