diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-03-05 13:28:51 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-04-16 10:16:36 +0000 |
commit | 522c3dd8f3b64e772f7e41205308fc24a56426f4 (patch) | |
tree | 54b2f1fff6e253674c377120718a7c4ef6b1198d /uitest/src/com/vaadin/tests/dd/DnDOnSubtreeTest.java | |
parent | ab8a0268652b81b20be8d5dbf0deeb7029e9edec (diff) | |
download | vaadin-framework-522c3dd8f3b64e772f7e41205308fc24a56426f4.tar.gz vaadin-framework-522c3dd8f3b64e772f7e41205308fc24a56426f4.zip |
Convert some TB2 tests to TB4
- components/ui/CurrentUiRetainedTest
- components/ui/InitiallyEmptyFragmentTest
- components/ui/PollListeningTest
- components/ui/RpcInvocationHandlerToStringTest
- components/ui/UIAccessExceptionHandlingTest
- components/ui/UIInitBrowserDetailsTest
- components/ui/UIInitExceptionTest
- components/ui/UIPollingTest
- components/ui/UITabIndexTest
- components/ui/UIsInMultipleTabsTest
- components/window/CloseSubWindowTest
- components/window/ExtraWindowShownTest
- components/window/RepaintWindowContentsTest
- components/window/WindowShouldRemoveActionHandlerTest
- components/window/WindowWithInvalidCloseListenerTest
- containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKeyTest
- converter/ConverterThatEnforcesAFormatTest
- dd/DnDOnSubtreeTest
- fieldgroup/BasicPersonFormTest
- fieldgroup/CommitHandlerFailuresTest
- fieldgroup/CommitWithValidationOrConversionErrorTest
- fieldgroup/DateFormTest
- fieldgroup/FieldGroupDiscardTest
- fields/TabIndexesTest
renamed:
- components/ui/PollListenerTest -> PollListening
Change-Id: Iac3c153709f6edca28d9f75a85246f1a70176963
Diffstat (limited to 'uitest/src/com/vaadin/tests/dd/DnDOnSubtreeTest.java')
-rw-r--r-- | uitest/src/com/vaadin/tests/dd/DnDOnSubtreeTest.java | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/dd/DnDOnSubtreeTest.java b/uitest/src/com/vaadin/tests/dd/DnDOnSubtreeTest.java new file mode 100644 index 0000000000..2bceb905c4 --- /dev/null +++ b/uitest/src/com/vaadin/tests/dd/DnDOnSubtreeTest.java @@ -0,0 +1,52 @@ +package com.vaadin.tests.dd; + +import org.junit.Test; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedCondition; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.TestBenchElement; +import com.vaadin.testbench.elements.TreeElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class DnDOnSubtreeTest extends MultiBrowserTest { + + @Override + protected Class<?> getUIClass() { + return DDTest8.class; + } + + @Test + public void testDragAndDropOnSubTrees() throws Exception { + openTestURL(); + TreeElement tree = $(TreeElement.class).first(); + WebElement bar2 = tree.findElement(By.vaadin("#n[3]")); + WebElement bar5 = tree.findElement(By.vaadin("#n[6]")); + new Actions(driver).moveToElement(bar2, 11, 8).clickAndHold() + .moveByOffset(10, 10).perform(); + /* Drop on Bar5, which is a subtree target */ + new Actions(driver).moveToElement(bar5, 34, 9).release().perform(); + testBenchElement(tree.findElement(By.vaadin("#n[5]/expand"))).click(5, + 5); + /* Assert that the dragged & dropped node is now a child of Bar5 */ + waitUntilElementPresent(tree, "#n[5]/n[0]"); + } + + private void waitUntilElementPresent(final TestBenchElement parent, + final String vaadinSelector) { + waitUntil(new ExpectedCondition<Boolean>() { + + @Override + public Boolean apply(WebDriver arg0) { + return parent.isElementPresent(By.vaadin(vaadinSelector)); + } + + @Override + public String toString() { + return String.format("element to contain '%s'", vaadinSelector); + } + }); + } +} |