diff options
author | Henrik Paul <henrik@vaadin.com> | 2013-10-18 15:09:43 +0300 |
---|---|---|
committer | Henrik Paul <henrik@vaadin.com> | 2013-10-18 15:09:53 +0300 |
commit | 7cba636d8938c4491ae4c1995064ed0ef83ccdd7 (patch) | |
tree | da0f777665d1e0a56eb892d02d156b29c6c517b1 /uitest/src/com | |
parent | df3d643b3aaa3112d59e2ae0fb3649dd37e927a7 (diff) | |
parent | 6a99730d898f8e0663d69dbeba6682113c29ca52 (diff) | |
download | vaadin-framework-7cba636d8938c4491ae4c1995064ed0ef83ccdd7.tar.gz vaadin-framework-7cba636d8938c4491ae4c1995064ed0ef83ccdd7.zip |
Merge changes from origin/7.1
377d49e Allow configuring deployment port for TB3 tests
6779857 Updatet servlet tests to follow the same *Test naming convention
e1c38bf Avoid obsolete calendar panel renderings to avoid various NPEs. (#12504,#12667)
63f10ec Fixed compilation error in TB3 test
3e593b0 Focus selected row in Table #12540
3c842b7 added small pause to make test pass
1b7e40d Only fetch rows if there are some (#11189)
f595d05 Make the various Writers member fields instead of local variables (#12446)
4cb304d Converted broken test to TB3
2aa2fdc Handle ClientMethodInvocation serialization with JSONArray as parameter (#12532)
1449425 Also hide shim iframe of VOverlay on setVisible(false) (#12731)
25fc2f2 Fix whitespace after including a mixin (#12715)
c29ca5e Update to atmosphere javascript 2.0.3-vaadin1 (#12241, #12127)
f75164f Disable unit cache to avoid compilation issues when switching between branches
6a99730 Allow skipping TB2/TB3 tests using tests.tb2/tb3.skip
Change-Id: I5a92798e66575c2cfd1d3f761a5f00af7e83dc64
Diffstat (limited to 'uitest/src/com')
20 files changed, 682 insertions, 191 deletions
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldTestTest.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldTestTest.java new file mode 100644 index 0000000000..557201e803 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldTestTest.java @@ -0,0 +1,118 @@ +/* + * 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.datefield; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.NoSuchElementException; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class DateFieldTestTest extends MultiBrowserTest { + + @Test + public void testMakingRequired() throws InterruptedException { + setDebug(true); + openTestURL(); + Thread.sleep(1000); + menu("Component"); + menuSub("State"); + menu("Required"); + assertNoErrorNotification(); + } + + private void assertNoErrorNotification() { + try { + getDriver().findElement( + By.xpath("//div[contains(@class, 'v-Notification') ]")); + Assert.fail("Error notification shown!"); + } catch (NoSuchElementException e) { + // As expected + } + } + + @Test + public void testValueAfterOpeningPopupInRequiredField() + throws InterruptedException { + setDebug(true); + openTestURL(); + Thread.sleep(1000); + menu("Component"); + menuSub("State"); + menu("Required"); + + menu("Component"); + menuSub("Features"); + menuSub("Resolution"); + menu("Month"); + + menu("Component"); + menuSub("Listeners"); + menu("Value change listener"); + + String inputtedValue = "2/12"; + getInput().sendKeys(inputtedValue); + + openPopup(); + closePopup(); + String actual = getInput().getAttribute("value"); + Assert.assertEquals(inputtedValue, actual); + assertNoErrorNotification(); + + } + + private void openPopup() throws InterruptedException { + Dimension size = getInput().getSize(); + new Actions(getDriver()).moveToElement(getInput(), 0, 0) + .moveByOffset(size.getWidth() + 5, size.getHeight() / 2) + .click(); + // This fails in Opera for some weird reason + // getDriver().findElement(By.className("v-datefield-button")).click(); + } + + private WebElement getInput() { + return getDriver().findElement(By.xpath("//input")); + } + + private void closePopup() { + getDriver().findElement(By.tagName("body")).click(); + } + + /** + * @since + * @param string + */ + private void menuSub(String string) { + getDriver().findElement( + By.xpath("//span[text() = '" + string + "']")).click(); + new Actions(getDriver()).moveByOffset(100, 0).build().perform(); + } + + /** + * @since + * @param string + */ + private void menu(String string) { + getDriver().findElement( + By.xpath("//span[text() = '" + string + "']")).click(); + + } + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.html b/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.html index 77c610f211..75c19945b0 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.html +++ b/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.html @@ -52,6 +52,11 @@ <td></td> </tr> <tr> + <td>pause</td> + <td>300</td> + <td></td> +</tr> +<tr> <td>mouseClick</td> <td>vaadin=runcomvaadintestscomponentsdatefieldDynamicallyChangeDateRange::/VVerticalLayout[0]/Slot[0]/VPopupCalendar[0]#popupButton</td> <td>14,16</td> @@ -87,6 +92,11 @@ <td></td> </tr> <tr> + <td>pause</td> + <td>300</td> + <td></td> +</tr> +<tr> <td>mouseClick</td> <td>vaadin=runcomvaadintestscomponentsdatefieldDynamicallyChangeDateRange::/VVerticalLayout[0]/Slot[0]/VPopupCalendar[0]#popupButton</td> <td>14,15</td> diff --git a/uitest/src/com/vaadin/tests/components/table/EmptyTable.java b/uitest/src/com/vaadin/tests/components/table/EmptyTable.java new file mode 100644 index 0000000000..d6c30efa5a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/EmptyTable.java @@ -0,0 +1,58 @@ +/* + * 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.table; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Table; + +public class EmptyTable extends AbstractTestUI { + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + Table table = new Table("Table"); + table.addContainerProperty("testColumn", String.class, null); + table.setPageLength(0); // disable paging + addComponent(table); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "Empty Table should not cause JS exception"; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + return 11189; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/table/EmptyTableTest.java b/uitest/src/com/vaadin/tests/components/table/EmptyTableTest.java new file mode 100644 index 0000000000..229dc23b9a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/EmptyTableTest.java @@ -0,0 +1,44 @@ +/* + * 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.table; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.NoSuchElementException; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class EmptyTableTest extends MultiBrowserTest { + + @Test + public void test() { + setDebug(true); + openTestURL(); + + ensureNoErrors(); + } + + private void ensureNoErrors() { + try { + getDriver().findElement(By.className("v-Notification")); + } catch (NoSuchElementException e) { + return; + } + Assert.fail("Error notification was shown!"); + } + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/table/TableMoveFocusWithSelection.java b/uitest/src/com/vaadin/tests/components/table/TableMoveFocusWithSelection.java new file mode 100644 index 0000000000..20170efa13 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableMoveFocusWithSelection.java @@ -0,0 +1,125 @@ +/* + * 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.table; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import com.vaadin.event.LayoutEvents.LayoutClickEvent; +import com.vaadin.event.LayoutEvents.LayoutClickListener; +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.Table; +import com.vaadin.ui.VerticalLayout; + +public class TableMoveFocusWithSelection extends AbstractTestUI { + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + final Table t = new Table(); + t.setImmediate(true); + t.setId("test-table"); + t.setSizeFull(); + t.setSelectable(true); + t.addContainerProperty("layout", VerticalLayout.class, null); + t.addContainerProperty("string", String.class, null); + + for (int i = 0; i < 100; i++) { + t.addItem(i); + final VerticalLayout l = new VerticalLayout(); + l.setId("row-" + i); + l.setHeight(20, Unit.PIXELS); + l.setData(i); + l.addLayoutClickListener(new LayoutClickListener() { + @Override + public void layoutClick(LayoutClickEvent event) { + if (t.isMultiSelect()) { + Set<Object> values = new HashSet<Object>( + (Set<Object>) t.getValue()); + values.add(l.getData()); + t.setValue(values); + } else { + t.setValue(l.getData()); + } + } + }); + t.getContainerProperty(i, "layout").setValue(l); + t.getContainerProperty(i, "string").setValue("Item #" + i); + } + addComponent(t); + + // Select mode + Button toggleSelectMode = new Button( + t.isMultiSelect() ? "Press to use single select" + : "Press to use multi select"); + toggleSelectMode.setId("toggle-mode"); + toggleSelectMode.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + t.setMultiSelect(!t.isMultiSelect()); + + event.getButton().setCaption( + t.isMultiSelect() ? "Press to use single select" + : "Press to use multi select"); + } + }); + + addComponent(toggleSelectMode); + + Button select5210 = new Button("Select row 5-10", + new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + t.setValue(Arrays.asList(5, 6, 7, 8, 9, 10)); + } + }); + select5210.setId("select-510"); + addComponent(select5210); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "Changing selection in single select mode should move focus"; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + return 12540; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableMoveFocusWithSelectionTest.java b/uitest/src/com/vaadin/tests/components/table/TableMoveFocusWithSelectionTest.java new file mode 100644 index 0000000000..b38705eeb6 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableMoveFocusWithSelectionTest.java @@ -0,0 +1,75 @@ +/* + * 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.table; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Tests if table focus is moved correctly to the selected item + * + * @since + * @author Vaadin Ltd + */ +public class TableMoveFocusWithSelectionTest extends MultiBrowserTest { + + @Test + public void selectUnfocusedTableAndAssumeSelectionGetsFocus() { + + openTestURL(); + + // Click on row 5 + getDriver().findElement(By.id("row-5")).click(); + + // Ensure row 5 gets focused + WebElement row5TableRow = getDriver().findElement( + By.xpath("//div[@id='row-5']/../../..")); + String row5StyleName = row5TableRow.getAttribute("class"); + assertTrue(row5StyleName.contains("v-table-focus")); + } + + @Test + public void focusShouldStayOnUserSelectedRowIfSelectionChangesServerSide() { + + openTestURL(); + + // Select multiselect + getDriver().findElement(By.id("toggle-mode")).click(); + + // Click on row 7 + getDriver().findElement(By.id("row-7")).click(); + + // Select row 5-10 server side + getDriver().findElement(By.id("select-510")).click(); + + // Ensure row 7 is still focused + WebElement row7TableRow = getDriver().findElement( + By.xpath("//div[@id='row-7']/../../..")); + String row7StyleName = row7TableRow.getAttribute("class"); + assertTrue(row7StyleName.contains("v-table-focus")); + } + + @Override + protected Class<?> getUIClass() { + // FIXME Remove when this is done automatically + return TableMoveFocusWithSelection.class; + } +} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIAccessTest.java b/uitest/src/com/vaadin/tests/components/ui/UIAccessTest.java index 8d04ceae71..9db2c2f0d3 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UIAccessTest.java +++ b/uitest/src/com/vaadin/tests/components/ui/UIAccessTest.java @@ -15,11 +15,16 @@ */ package com.vaadin.tests.components.ui; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; +import com.vaadin.testbench.By; import com.vaadin.tests.tb3.MultiBrowserTest; public class UIAccessTest extends MultiBrowserTest { @@ -30,8 +35,7 @@ public class UIAccessTest extends MultiBrowserTest { getCurrentInstanceWhenPushingButton().click(); waitUntil(ExpectedConditions.textToBePresentInElement( vaadinLocatorById("Log_row_0"), "1.")); - Assert.assertEquals( - "0. Current UI matches in beforeResponse? true", + Assert.assertEquals("0. Current UI matches in beforeResponse? true", vaadinElementById("Log_row_1").getText()); Assert.assertEquals( "1. Current session matches in beforeResponse? true", @@ -39,6 +43,161 @@ public class UIAccessTest extends MultiBrowserTest { } + @Test + public void testAccessMethod() throws Exception { + openTestURL(); + + vaadinElement( + "/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]") + .click(); + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]")) + .click(); + assertTrue(driver + .findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_2")) + .getText() + .matches( + "^0\\. Access from UI thread future is done[\\s\\S] false$")); + assertEquals( + "1. Access from UI thread is run", + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_1")) + .getText()); + assertTrue(driver + .findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_0")) + .getText() + .matches( + "^2\\. beforeClientResponse future is done[\\s\\S] true$")); + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]")) + .click(); + assertEquals( + "0. Initial background message", + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_1")) + .getText()); + assertTrue(driver + .findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_0")) + .getText() + .matches("^1\\. Thread has current response[\\s\\S] false$")); + for (int second = 0;; second++) { + if (second >= 30) { + fail("timeout"); + } + try { + if ("0. Initial background message" + .equals(driver + .findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_2")) + .getText())) { + break; + } + } catch (Exception e) { + } + Thread.sleep(1000); + } + + assertTrue(driver + .findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_0")) + .getText() + .matches( + "^2\\. Thread got lock, inital future done[\\s\\S] true$")); + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]")) + .click(); + assertEquals( + "0. Throwing exception in access", + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_2")) + .getText()); + assertTrue(driver + .findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_1")) + .getText().matches("^1\\. firstFuture is done[\\s\\S] true$")); + assertEquals( + "2. Got exception from firstFuture: java.lang.RuntimeException: Catch me if you can", + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_0")) + .getText()); + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]")) + .click(); + assertEquals( + "0. future was cancled, should not start", + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_0")) + .getText()); + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[4]/VButton[0]/domChild[0]/domChild[0]")) + .click(); + assertEquals( + "0. Waiting for thread to start", + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_2")) + .getText()); + assertEquals( + "1. Thread started, waiting for interruption", + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_1")) + .getText()); + assertEquals( + "2. I was interrupted", + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_0")) + .getText()); + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[5]/VButton[0]/domChild[0]/domChild[0]")) + .click(); + assertTrue(driver + .findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_3")) + .getText() + .matches("^0\\. accessSynchronously has request[\\s\\S] true$")); + assertEquals( + "1. Test value in accessSynchronously: Set before accessSynchronosly", + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_2")) + .getText()); + assertTrue(driver + .findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_1")) + .getText() + .matches( + "^2\\. has request after accessSynchronously[\\s\\S] true$")); + assertEquals( + "3. Test value after accessSynchornously: Set in accessSynchronosly", + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_0")) + .getText()); + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]")) + .click(); + assertTrue(driver + .findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_3")) + .getText().matches("^0\\. access has request[\\s\\S] false$")); + assertEquals( + "1. Test value in access: Set before access", + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_2")) + .getText()); + assertTrue(driver + .findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_1")) + .getText() + .matches("^2\\. has request after access[\\s\\S] true$")); + assertEquals( + "3. Test value after access: Set before run pending", + driver.findElement( + By.vaadin("runcomvaadintestscomponentsuiUIAccess::PID_SLog_row_0")) + .getText()); + + } + private WebElement getCurrentInstanceWhenPushingButton() { return vaadinElement("/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[7]/VButton[0]"); } diff --git a/uitest/src/com/vaadin/tests/components/ui/UiAccess.html b/uitest/src/com/vaadin/tests/components/ui/UiAccess.html deleted file mode 100644 index 613691623c..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UiAccess.html +++ /dev/null @@ -1,166 +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</td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td> - <td>exact:0. Access from UI thread future is done? false</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td> - <td>1. Access from UI thread is run</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> - <td>exact:2. beforeClientResponse future is done? true</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td> - <td>0. Initial background message</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> - <td>exact:1. Thread has current response? false</td> -</tr> -<tr> - <td>waitForText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td> - <td>0. Initial background message</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> - <td>exact:2. Thread got lock, inital future done? true</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td> - <td>0. Throwing exception in access</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td> - <td>exact:1. firstFuture is done? true</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> - <td>2. Got exception from firstFuture: java.lang.RuntimeException: Catch me if you can</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> - <td>0. future was cancled, should not start</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[4]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td> - <td>0. Waiting for thread to start</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td> - <td>1. Thread started, waiting for interruption</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> - <td>2. I was interrupted</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[5]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_3</td> - <td>0. accessSynchronously has request? true</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td> - <td>1. Test value in accessSynchronously: Set before accessSynchronosly</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td> - <td>2. has request after accessSynchronously? true</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> - <td>3. Test value after accessSynchornously: Set in accessSynchronosly</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_3</td> - <td>0. access has request? false</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td> - <td>1. Test value in access: Set before access</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td> - <td>2. has request after access? true</td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td> - <td>3. Test value after access: Set before run pending</td> -</tr> -</tbody></table> -</body> -</html> diff --git a/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTestTB3.java b/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java index e170450619..5f4ae41361 100644 --- a/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTestTB3.java +++ b/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java @@ -32,7 +32,7 @@ import com.vaadin.tests.tb3.PrivateTB3Configuration; * @author Vaadin Ltd */ @RunWith(IntegrationTestRunner.class) -public abstract class AbstractIntegrationTestTB3 extends +public abstract class AbstractIntegrationTest extends PrivateTB3Configuration { @Override protected String getBaseURL() { diff --git a/uitest/src/com/vaadin/tests/integration/ServletIntegrationTestTB3.java b/uitest/src/com/vaadin/tests/integration/AbstractServletIntegrationTest.java index 2a2f8ab3d1..f736a126a5 100644 --- a/uitest/src/com/vaadin/tests/integration/ServletIntegrationTestTB3.java +++ b/uitest/src/com/vaadin/tests/integration/AbstractServletIntegrationTest.java @@ -26,8 +26,8 @@ import org.openqa.selenium.WebElement; * * @author Vaadin Ltd */ -public abstract class ServletIntegrationTestTB3 extends - AbstractIntegrationTestTB3 { +public abstract class AbstractServletIntegrationTest extends + AbstractIntegrationTest { @Test public void runTest() throws IOException, AssertionError { diff --git a/uitest/src/com/vaadin/tests/integration/IntegrationTestRunner.java b/uitest/src/com/vaadin/tests/integration/IntegrationTestRunner.java index 29ee4e6023..f5042b54b6 100644 --- a/uitest/src/com/vaadin/tests/integration/IntegrationTestRunner.java +++ b/uitest/src/com/vaadin/tests/integration/IntegrationTestRunner.java @@ -45,7 +45,7 @@ public class IntegrationTestRunner extends TB3Runner { */ @Override protected String testName(FrameworkMethod method) { - if (AbstractIntegrationTestTB3.class.isAssignableFrom(testClass)) { + if (AbstractIntegrationTest.class.isAssignableFrom(testClass)) { return System.getProperty("server-name"); } else { return super.testName(method); diff --git a/uitest/src/com/vaadin/tests/integration/IntegrationTestStreaming.java b/uitest/src/com/vaadin/tests/integration/ServletIntegrationStreamingUI.java index 20ddac9dd1..0d92fb1bb8 100644 --- a/uitest/src/com/vaadin/tests/integration/IntegrationTestStreaming.java +++ b/uitest/src/com/vaadin/tests/integration/ServletIntegrationStreamingUI.java @@ -25,11 +25,6 @@ import com.vaadin.shared.ui.ui.Transport; * @author Vaadin Ltd */ @Push(transport = Transport.STREAMING) -public class IntegrationTestStreaming extends IntegrationTestUI { - - public static class IntegrationTestStreamingTB3 extends - ServletIntegrationTestTB3 { - // Uses the test method declared in the super class - } +public class ServletIntegrationStreamingUI extends ServletIntegrationUI { } diff --git a/uitest/src/com/vaadin/tests/integration/ServletIntegrationStreamingUITest.java b/uitest/src/com/vaadin/tests/integration/ServletIntegrationStreamingUITest.java new file mode 100644 index 0000000000..36a946bfa3 --- /dev/null +++ b/uitest/src/com/vaadin/tests/integration/ServletIntegrationStreamingUITest.java @@ -0,0 +1,21 @@ +/* + * 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.integration; + +public class ServletIntegrationStreamingUITest extends + AbstractServletIntegrationTest { + // Uses the test method declared in the super class +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/integration/IntegrationTestUI.java b/uitest/src/com/vaadin/tests/integration/ServletIntegrationUI.java index 3d0a338bba..6aec2c8e2a 100755 --- a/uitest/src/com/vaadin/tests/integration/IntegrationTestUI.java +++ b/uitest/src/com/vaadin/tests/integration/ServletIntegrationUI.java @@ -11,11 +11,7 @@ import com.vaadin.ui.Table; import com.vaadin.ui.UI; import com.vaadin.ui.VerticalLayout; -public class IntegrationTestUI extends UI { - - public class IntegrationTestXhrTB3 extends ServletIntegrationTestTB3 { - // Uses the test method declared in the super class - } +public class ServletIntegrationUI extends UI { @Override protected void init(VaadinRequest request) { diff --git a/uitest/src/com/vaadin/tests/integration/ServletIntegrationUITest.java b/uitest/src/com/vaadin/tests/integration/ServletIntegrationUITest.java new file mode 100644 index 0000000000..25ffdac4a2 --- /dev/null +++ b/uitest/src/com/vaadin/tests/integration/ServletIntegrationUITest.java @@ -0,0 +1,20 @@ +/* + * 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.integration; + +public class ServletIntegrationUITest extends AbstractServletIntegrationTest { + // Uses the test method declared in the super class +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/integration/IntegrationTestWebsocket.java b/uitest/src/com/vaadin/tests/integration/ServletIntegrationWebsocketUI.java index eaa23de3cf..905b80fd85 100644 --- a/uitest/src/com/vaadin/tests/integration/IntegrationTestWebsocket.java +++ b/uitest/src/com/vaadin/tests/integration/ServletIntegrationWebsocketUI.java @@ -26,11 +26,7 @@ import com.vaadin.shared.ui.ui.Transport; * @author Vaadin Ltd */ @Push(transport = Transport.WEBSOCKET) -public class IntegrationTestWebsocket extends IntegrationTestUI { - - public class IntegrationTestWebsocketTB3 extends ServletIntegrationTestTB3 { - // Uses the test method declared in the super class - } +public class ServletIntegrationWebsocketUI extends ServletIntegrationUI { /* * (non-Javadoc) diff --git a/uitest/src/com/vaadin/tests/integration/ServletIntegrationWebsocketUITest.java b/uitest/src/com/vaadin/tests/integration/ServletIntegrationWebsocketUITest.java new file mode 100644 index 0000000000..f2e7a6f2d0 --- /dev/null +++ b/uitest/src/com/vaadin/tests/integration/ServletIntegrationWebsocketUITest.java @@ -0,0 +1,21 @@ +/* + * 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.integration; + +public class ServletIntegrationWebsocketUITest extends + AbstractServletIntegrationTest { + // Uses the test method declared in the super class +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java index 38c5b29bf9..1967891a7a 100644 --- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -173,6 +173,13 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { protected abstract String getDeploymentHostname(); /** + * Used to determine what port the test is running on + * + * @return The port teh test is running on, by default 8888 + */ + protected abstract String getDeploymentPort(); + + /** * Produces a collection of browsers to run the test on. This method is * executed by the test runner when determining how many test methods to * invoke and with what parameters. For each returned value a test method is @@ -562,7 +569,7 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { * @return The base URL for the test. Does not include a trailing slash. */ protected String getBaseURL() { - return "http://" + getDeploymentHostname() + ":8888"; + return "http://" + getDeploymentHostname() + ":" + getDeploymentPort(); } /** diff --git a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java index 3d7dead928..09615f0b2e 100644 --- a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java +++ b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java @@ -34,6 +34,7 @@ import java.util.Properties; */ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test { private static final String HOSTNAME_PROPERTY = "com.vaadin.testbench.deployment.hostname"; + private static final String PORT_PROPERTY = "com.vaadin.testbench.deployment.port"; private final Properties properties = new Properties(); public PrivateTB3Configuration() { @@ -82,6 +83,17 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test { return hostName; } + @Override + protected String getDeploymentPort() { + String port = getProperty(PORT_PROPERTY); + + if (port == null || "".equals(port)) { + port = "8888"; + } + + return port; + } + /** * Tries to automatically determine the IP address of the machine the test * is running on. diff --git a/uitest/src/com/vaadin/tests/tb3/ServletIntegrationTests.java b/uitest/src/com/vaadin/tests/tb3/ServletIntegrationTests.java index d2aa413749..c511b99e6e 100644 --- a/uitest/src/com/vaadin/tests/tb3/ServletIntegrationTests.java +++ b/uitest/src/com/vaadin/tests/tb3/ServletIntegrationTests.java @@ -19,7 +19,7 @@ package com.vaadin.tests.tb3; import org.junit.runner.RunWith; import org.junit.runners.model.InitializationError; -import com.vaadin.tests.integration.ServletIntegrationTestTB3; +import com.vaadin.tests.integration.AbstractServletIntegrationTest; import com.vaadin.tests.tb3.ServletIntegrationTests.ServletIntegrationTestSuite; @RunWith(ServletIntegrationTestSuite.class) @@ -28,7 +28,7 @@ public class ServletIntegrationTests { public static class ServletIntegrationTestSuite extends TB3TestSuite { public ServletIntegrationTestSuite(Class<?> klass) throws InitializationError { - super(klass, ServletIntegrationTestTB3.class, + super(klass, AbstractServletIntegrationTest.class, "com.vaadin.tests.integration", new String[] {}); } } |