diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-09-12 12:43:01 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-09-12 12:04:00 +0000 |
commit | 9f30ebf6662c99a5b6b2e1be2e0c25ed01571592 (patch) | |
tree | c70110ff7d2af932e0d376d4787c02958b44caf7 /uitest-common | |
parent | 52cada891a947b593e019639f3b65c773084a938 (diff) | |
download | vaadin-framework-9f30ebf6662c99a5b6b2e1be2e0c25ed01571592.tar.gz vaadin-framework-9f30ebf6662c99a5b6b2e1be2e0c25ed01571592.zip |
Support finding components in v7 packages with ComponentLocator
Change-Id: I60eabf3b1c6363be505a2d21f7ed439c5357f61f
Diffstat (limited to 'uitest-common')
22 files changed, 14 insertions, 323 deletions
diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/CalendarElement.java b/uitest-common/src/main/java/com/vaadin/testbench/customelements/CalendarElement.java index c43ebd80ba..3ba2cbbf6a 100644 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/CalendarElement.java +++ b/uitest-common/src/main/java/com/vaadin/testbench/customelements/CalendarElement.java @@ -1,4 +1,4 @@ -package com.vaadin.v7.testbench.customelements; +package com.vaadin.testbench.customelements; import java.util.List; @@ -7,7 +7,7 @@ import org.openqa.selenium.WebElement; import com.vaadin.testbench.By; import com.vaadin.testbench.elementsbase.ServerClass; -@ServerClass("com.vaadin.v7.ui.Calendar") +@ServerClass("com.vaadin.ui.Calendar") public class CalendarElement extends com.vaadin.testbench.elements.CalendarElement { public List<WebElement> getWeekNumbers() { diff --git a/uitest-common/src/main/java/com/vaadin/testbench/customelements/NativeSelectElement.java b/uitest-common/src/main/java/com/vaadin/testbench/customelements/NativeSelectElement.java index e5d572eaa9..289162ee27 100644 --- a/uitest-common/src/main/java/com/vaadin/testbench/customelements/NativeSelectElement.java +++ b/uitest-common/src/main/java/com/vaadin/testbench/customelements/NativeSelectElement.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2016 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 @@ -19,6 +19,7 @@ import java.util.List; import org.openqa.selenium.support.ui.Select; +import com.vaadin.testbench.By; import com.vaadin.testbench.TestBenchElement; import com.vaadin.testbench.elements.AbstractSelectElement; import com.vaadin.testbench.elementsbase.ServerClass; @@ -30,7 +31,12 @@ public class NativeSelectElement extends AbstractSelectElement { @Override protected void init() { super.init(); - selectElement = new Select(this); + // FIXME: Newer NativeSelect has different DOM structure. + if (getTagName().equals("select")) { + selectElement = new Select(this); + } else { + selectElement = new Select(findElement(By.tagName("select"))); + } } public List<TestBenchElement> getOptions() { diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/TableElement.java b/uitest-common/src/main/java/com/vaadin/testbench/customelements/TableElement.java index 3737fa0e04..b84b67a896 100644 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/TableElement.java +++ b/uitest-common/src/main/java/com/vaadin/testbench/customelements/TableElement.java @@ -1,4 +1,4 @@ -package com.vaadin.v7.testbench.customelements; +package com.vaadin.testbench.customelements; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -6,7 +6,7 @@ import org.openqa.selenium.WebElement; import com.vaadin.testbench.elementsbase.AbstractElement; import com.vaadin.testbench.elementsbase.ServerClass; -@ServerClass("com.vaadin.v7.ui.Table") +@ServerClass("com.vaadin.ui.Table") public class TableElement extends com.vaadin.testbench.elements.TableElement { public CollapseMenu openCollapseMenu() { getCollapseMenuToggle().click(); diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/CheckBoxElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/CheckBoxElement.java deleted file mode 100644 index 9ab5ceae89..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/CheckBoxElement.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.vaadin.v7.testbench.customelements; - -import com.vaadin.testbench.elementsbase.ServerClass; - -@ServerClass("com.vaadin.v7.ui.CheckBox") -public class CheckBoxElement - extends com.vaadin.testbench.elements.CheckBoxElement { - -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/ColorPickerAreaElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/ColorPickerAreaElement.java deleted file mode 100644 index 151dee9915..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/ColorPickerAreaElement.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.vaadin.v7.testbench.customelements; - -import com.vaadin.testbench.elementsbase.ServerClass; - -@ServerClass("com.vaadin.v7.ui.ColorPickerArea") -public class ColorPickerAreaElement - extends com.vaadin.testbench.elements.ColorPickerAreaElement { - -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/ColorPickerElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/ColorPickerElement.java deleted file mode 100644 index 749a54f967..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/ColorPickerElement.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.vaadin.v7.testbench.customelements; - -import com.vaadin.testbench.elementsbase.ServerClass; - -@ServerClass("com.vaadin.v7.ui.ColorPicker") -public class ColorPickerElement - extends com.vaadin.testbench.elements.ColorPickerElement { - -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/ComboBoxElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/ComboBoxElement.java deleted file mode 100644 index d5208e6338..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/ComboBoxElement.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.vaadin.v7.testbench.customelements; - -import org.junit.Assert; -import org.openqa.selenium.WebElement; - -import com.vaadin.testbench.By; -import com.vaadin.testbench.elementsbase.ServerClass; - -@ServerClass("com.vaadin.v7.ui.ComboBox") -public class ComboBoxElement - extends com.vaadin.testbench.elements.ComboBoxElement { - - private static org.openqa.selenium.By bySuggestionPopup = By - .vaadin("#popup"); - - public WebElement getInputField() { - return findElement(By.vaadin("#textbox")); - } - - @Override - public String getText() { - return getInputField().getAttribute("value"); - } - - @Override - public void clear() { - getInputField().clear(); - } - - public WebElement getSuggestionPopup() { - return findElement(bySuggestionPopup); - } - - @Override - public void sendKeys(CharSequence... keysToSend) { - sendKeys(50, keysToSend); - } - - /** - * Use this method to simulate typing into an element, which may set its - * value. - * - * @param delay - * delay after sending each individual key (mainly needed for - * PhantomJS) - * @param keysToSend - * keys to type into the element - */ - public void sendKeys(int delay, CharSequence... keysToSend) { - WebElement input = getInputField(); - - for (CharSequence key : keysToSend) { - input.sendKeys(key); - try { - Thread.sleep(delay); - } catch (InterruptedException e) { - Assert.fail(e.getMessage()); - } - } - } -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/DateFieldElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/DateFieldElement.java deleted file mode 100644 index c69c2ad22c..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/DateFieldElement.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2000-2016 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.v7.testbench.customelements; - -import com.vaadin.testbench.elementsbase.ServerClass; - -@ServerClass("com.vaadin.v7.ui.DateField") -public class DateFieldElement - extends com.vaadin.testbench.elements.DateFieldElement { - -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/GridElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/GridElement.java deleted file mode 100644 index b3c24c5c3a..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/GridElement.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (C) 2012 Vaadin Ltd - * - * This program is available under Commercial Vaadin Add-On License 3.0 - * (CVALv3). - * - * See the file licensing.txt distributed with this software for more - * information about licensing. - * - * You should have received a copy of the license along with this program. - * If not, see <http://vaadin.com/license/cval-3>. - */ -package com.vaadin.v7.testbench.customelements; - -import org.openqa.selenium.NoSuchElementException; - -import com.vaadin.testbench.By; -import com.vaadin.testbench.TestBenchElement; -import com.vaadin.testbench.elementsbase.ServerClass; - -/** - * TestBench Element API for Grid - * - * @since 8.0 - * @author Vaadin Ltd - */ -@ServerClass("com.vaadin.v7.ui.Grid") -public class GridElement extends com.vaadin.testbench.elements.GridElement { - - /** - * Gets the element that contains the details of a row. - * - * @since 8.0 - * @param rowIndex - * the index of the row for the details - * @return the element that contains the details of a row. <code>null</code> - * if no widget is defined for the detials row - * @throws NoSuchElementException - * if the given details row is currently not open - */ - public TestBenchElement getDetails(int rowIndex) - throws NoSuchElementException { - return getSubPart("#details[" + rowIndex + "]"); - } - - private TestBenchElement getSubPart(String subPartSelector) { - return (TestBenchElement) findElement(By.vaadin(subPartSelector)); - } - -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/InlineDateFieldElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/InlineDateFieldElement.java deleted file mode 100644 index 22618d73d5..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/InlineDateFieldElement.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2000-2016 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.v7.testbench.customelements; - -import com.vaadin.testbench.elementsbase.ServerClass; - -/** - * @author Vaadin Ltd - * - */ -@ServerClass("com.vaadin.v7.ui.InlineDateField") -public class InlineDateFieldElement - extends com.vaadin.testbench.elements.InlineDateFieldElement { - -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/ListSelectElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/ListSelectElement.java deleted file mode 100644 index ac59fd62e4..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/ListSelectElement.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.vaadin.v7.testbench.customelements; - -import com.vaadin.testbench.elementsbase.ServerClass; - -@ServerClass("com.vaadin.v7.ui.ListSelect") -public class ListSelectElement - extends com.vaadin.testbench.elements.ListSelectElement { - -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/NativeSelectElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/NativeSelectElement.java deleted file mode 100644 index ffb116a6fb..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/NativeSelectElement.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.vaadin.v7.testbench.customelements; - -import com.vaadin.testbench.elementsbase.ServerClass; - -@ServerClass("com.vaadin.v7.ui.NativeSelect") -public class NativeSelectElement - extends com.vaadin.testbench.elements.NativeSelectElement { - -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/OptionGroupElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/OptionGroupElement.java deleted file mode 100644 index fed5533f18..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/OptionGroupElement.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.vaadin.v7.testbench.customelements; - -import com.vaadin.testbench.elementsbase.ServerClass; - -@ServerClass("com.vaadin.v7.ui.OptionGroup") -public class OptionGroupElement - extends com.vaadin.testbench.elements.OptionGroupElement { - -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/PasswordFieldElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/PasswordFieldElement.java deleted file mode 100644 index dccf14351f..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/PasswordFieldElement.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.vaadin.v7.testbench.customelements; - -import com.vaadin.testbench.elementsbase.ServerClass; - -@ServerClass("com.vaadin.v7.ui.PasswordField") -public class PasswordFieldElement - extends com.vaadin.testbench.elements.PasswordFieldElement { - -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/PopupDateFieldElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/PopupDateFieldElement.java deleted file mode 100644 index 777e55ae0a..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/PopupDateFieldElement.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2000-2016 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.v7.testbench.customelements; - -import com.vaadin.testbench.elementsbase.ServerClass; - -/** - * @author Vaadin Ltd - * - */ -@ServerClass("com.vaadin.v7.ui.PopupDateField") -public class PopupDateFieldElement - extends com.vaadin.testbench.elements.PopupDateFieldElement { - -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/RichTextAreaElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/RichTextAreaElement.java deleted file mode 100644 index f83d83393a..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/RichTextAreaElement.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.vaadin.v7.testbench.customelements; - -import com.vaadin.testbench.elementsbase.ServerClass; - -@ServerClass("com.vaadin.v7.ui.RichTextArea") -public class RichTextAreaElement - extends com.vaadin.testbench.elements.RichTextAreaElement { - -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/SelectElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/SelectElement.java deleted file mode 100644 index 607bfebeae..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/SelectElement.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.vaadin.v7.testbench.customelements; - -import com.vaadin.testbench.elementsbase.ServerClass; - -@ServerClass("com.vaadin.v7.ui.Select") -public class SelectElement extends com.vaadin.testbench.elements.SelectElement { - -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/TextAreaElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/TextAreaElement.java deleted file mode 100644 index f4099985ad..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/TextAreaElement.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.vaadin.v7.testbench.customelements; - -import com.vaadin.testbench.elementsbase.ServerClass; - -@ServerClass("com.vaadin.v7.ui.TextArea") -public class TextAreaElement - extends com.vaadin.testbench.elements.TextAreaElement { - -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/TextFieldElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/TextFieldElement.java deleted file mode 100644 index 3329eed510..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/TextFieldElement.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.vaadin.v7.testbench.customelements; - -import com.vaadin.testbench.elementsbase.ServerClass; - -@ServerClass("com.vaadin.v7.ui.TextField") -public class TextFieldElement - extends com.vaadin.testbench.elements.TextFieldElement { - -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/TreeElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/TreeElement.java deleted file mode 100644 index ab9811d7e0..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/TreeElement.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.vaadin.v7.testbench.customelements; - -import com.vaadin.testbench.elementsbase.ServerClass; - -@ServerClass("com.vaadin.v7.ui.Tree") -public class TreeElement extends com.vaadin.testbench.elements.TreeElement { - -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/TreeTableElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/TreeTableElement.java deleted file mode 100644 index f236fc863a..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/TreeTableElement.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.vaadin.v7.testbench.customelements; - -import com.vaadin.testbench.elementsbase.ServerClass; - -@ServerClass("com.vaadin.v7.ui.TreeTable") -public class TreeTableElement - extends com.vaadin.testbench.elements.TreeTableElement { - -} diff --git a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/TwinColSelectElement.java b/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/TwinColSelectElement.java deleted file mode 100644 index 663ebc0456..0000000000 --- a/uitest-common/src/main/java/com/vaadin/v7/testbench/customelements/TwinColSelectElement.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.vaadin.v7.testbench.customelements; - -import com.vaadin.testbench.elementsbase.ServerClass; - -@ServerClass("com.vaadin.v7.ui.TwinColSelect") -public class TwinColSelectElement - extends com.vaadin.testbench.elements.TwinColSelectElement { - -} |