diff options
author | Artur <artur@vaadin.com> | 2017-05-09 14:17:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-09 14:17:05 +0300 |
commit | b5da856bdbe9961151a265db1058c7ee1393bcff (patch) | |
tree | 69dec0fd388dfd45a1791bd24cdbcc4a54b79b78 /testbench-api | |
parent | 93256e3e69fc6a4d132eb11faff8fe9ce5efdf64 (diff) | |
download | vaadin-framework-b5da856bdbe9961151a265db1058c7ee1393bcff.tar.gz vaadin-framework-b5da856bdbe9961151a265db1058c7ee1393bcff.zip |
Move TestBench API to the correct package (#9249)
Fixes #9241
Diffstat (limited to 'testbench-api')
6 files changed, 165 insertions, 24 deletions
diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/AbstractDateFieldElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/AbstractDateFieldElement.java new file mode 100644 index 0000000000..5d298d3c3b --- /dev/null +++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/AbstractDateFieldElement.java @@ -0,0 +1,25 @@ +/* + * 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.testbench.elements; + +import com.vaadin.testbench.elementsbase.ServerClass; + +/** + * Element class for testing AbstractDateField. + */ +@ServerClass("com.vaadin.ui.AbstractDateField") +public class AbstractDateFieldElement extends AbstractFieldElement { +} diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/DateFieldElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/DateFieldElement.java index 740e2a6a68..162796cd3c 100644 --- a/testbench-api/src/main/java/com/vaadin/testbench/elements/DateFieldElement.java +++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/DateFieldElement.java @@ -22,11 +22,14 @@ import com.vaadin.testbench.By; import com.vaadin.testbench.TestBenchElement; import com.vaadin.testbench.elementsbase.ServerClass; +/** + * Element class for testing DateField. + */ @ServerClass("com.vaadin.ui.DateField") -public class DateFieldElement extends AbstractFieldElement { +public class DateFieldElement extends AbstractDateFieldElement { /** - * Clear DateField element + * Clear DateField element. */ @Override public void clear() { @@ -35,7 +38,7 @@ public class DateFieldElement extends AbstractFieldElement { } /** - * Return value of the date field element + * Return value of the date field element. * * @return value of the date field element */ @@ -44,10 +47,12 @@ public class DateFieldElement extends AbstractFieldElement { } /** - * Set value of the date field element + * Set value of the date field element. * * @param chars * new value of the date field + * @throws ReadOnlyException + * if the date field is in readonly mode */ public void setValue(CharSequence chars) throws ReadOnlyException { if (isReadOnly()) { @@ -59,4 +64,12 @@ public class DateFieldElement extends AbstractFieldElement { tbElement.sendKeys(chars); tbElement.sendKeys(Keys.TAB); } + + /** + * Opens the date field popup. + */ + public void openPopup() { + findElement(By.tagName("button")).click(); + } + } diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/DateTimeFieldElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/DateTimeFieldElement.java new file mode 100644 index 0000000000..8e6155e33c --- /dev/null +++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/DateTimeFieldElement.java @@ -0,0 +1,66 @@ +/* + * 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.testbench.elements; + +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.TestBenchElement; +import com.vaadin.testbench.elementsbase.ServerClass; + +/** + * Element class for testing DateTimeField. + */ +@ServerClass("com.vaadin.ui.DateTimeField") +public class DateTimeFieldElement extends AbstractDateFieldElement { + + /** + * Return value of the date field element. + * + * @return value of the date field element + */ + public String getValue() { + return findElement(By.tagName("input")).getAttribute("value"); + } + + /** + * Set value of the date field element. + * + * @param chars + * new value of the date field + * @throws ReadOnlyException + * if the date field is in readonly mode + */ + public void setValue(CharSequence chars) throws ReadOnlyException { + if (isReadOnly()) { + throw new ReadOnlyException(); + } + WebElement elem = findElement(By.tagName("input")); + TestBenchElement tbElement = (TestBenchElement) elem; + clearElementClientSide(tbElement); + tbElement.sendKeys(chars); + tbElement.sendKeys(Keys.TAB); + } + + /** + * Opens the date field popup. + */ + public void openPopup() { + findElement(By.tagName("button")).click(); + } + +} diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/InlineDateFieldElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/InlineDateFieldElement.java index 1cb88a1865..959b723ed8 100644 --- a/testbench-api/src/main/java/com/vaadin/testbench/elements/InlineDateFieldElement.java +++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/InlineDateFieldElement.java @@ -17,26 +17,10 @@ package com.vaadin.testbench.elements; import com.vaadin.testbench.elementsbase.ServerClass; +/** + * Element class for testing InlineDateField. + */ @ServerClass("com.vaadin.ui.InlineDateField") -public class InlineDateFieldElement extends DateFieldElement { - - /** - * Operation is not supported - * - * @throws UnsupportedOperationException - */ - @Override - public String getValue() { - throw new UnsupportedOperationException(); - } +public class InlineDateFieldElement extends AbstractFieldElement { - /** - * Operation is not supported - * - * @throws UnsupportedOperationException - */ - @Override - public void setValue(CharSequence chars) throws ReadOnlyException { - throw new UnsupportedOperationException(); - } } diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/InlineDateTimeFieldElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/InlineDateTimeFieldElement.java new file mode 100644 index 0000000000..da2d606496 --- /dev/null +++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/InlineDateTimeFieldElement.java @@ -0,0 +1,27 @@ +/* + * 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.testbench.elements; + +import com.vaadin.testbench.elementsbase.ServerClass; + +/** + * @author Vaadin Ltd + * + */ +@ServerClass("com.vaadin.ui.InlineDateTimeField") +public class InlineDateTimeFieldElement extends InlineDateFieldElement { + +} diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/LoginFormElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/LoginFormElement.java new file mode 100644 index 0000000000..946a456c4e --- /dev/null +++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/LoginFormElement.java @@ -0,0 +1,26 @@ +/* + * 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.testbench.elements; + +import com.vaadin.testbench.elementsbase.ServerClass; + +/** + * Element class for testing LoginForm. + */ +@ServerClass("com.vaadin.ui.LoginForm") +public class LoginFormElement extends AbstractSingleComponentContainerElement { + +} |