summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/tb3/newelements
diff options
context:
space:
mode:
authorSauli Tähkäpää <sauli@vaadin.com>2014-12-12 11:14:23 +0200
committerArtur Signell <artur@vaadin.com>2015-01-16 17:35:12 +0000
commit54e577da4503d417f3607f71820b545098c917ec (patch)
tree97ff5e96646edd2f1e0eead7a3ee3576718b5b7d /uitest/src/com/vaadin/tests/tb3/newelements
parent836a396fcc38752f211fbccad7ddb455d7d24d16 (diff)
downloadvaadin-framework-54e577da4503d417f3607f71820b545098c917ec.tar.gz
vaadin-framework-54e577da4503d417f3607f71820b545098c917ec.zip
Fix maximized window ordering. (#15360)
Change-Id: Ic994d4e5d74ddc2a554311110640b84bc2e9c802
Diffstat (limited to 'uitest/src/com/vaadin/tests/tb3/newelements')
-rw-r--r--uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java b/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java
new file mode 100644
index 0000000000..dd7cb55d01
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java
@@ -0,0 +1,53 @@
+package com.vaadin.tests.tb3.newelements;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ServerClass;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+/*
+ Suggestions for new elemental api for Window
+ */
+@ServerClass("com.vaadin.ui.Window")
+public class WindowElement extends com.vaadin.testbench.elements.WindowElement {
+
+ private final String restoreBoxClass = "v-window-restorebox";
+ private final String maximizeBoxClass = "v-window-maximizebox";
+
+ public void restore() {
+ if(isMaximized()) {
+ getRestoreButton().click();
+ } else {
+ throw new AssertionError("Window is not maximized, cannot be restored.");
+ }
+ }
+
+ private boolean isMaximized() {
+ return isElementPresent(By.className(restoreBoxClass));
+ }
+
+ private WebElement getRestoreButton() {
+ return this.findElement(By.className("v-window-restorebox"));
+ }
+
+ public void maximize() {
+ if(!isMaximized()) {
+ getMaximizeButton().click();
+ } else {
+ throw new AssertionError("Window is already maximized, cannot maximize.");
+ }
+ }
+
+ private WebElement getMaximizeButton() {
+ return this.findElement(By.className(maximizeBoxClass));
+ }
+
+ public void move(int xOffset, int yOffset) {
+ Actions action = new Actions(getDriver());
+ action.moveToElement(this.findElement(org.openqa.selenium.By.className("v-window-wrap")), 5, 5);
+ action.clickAndHold();
+ action.moveByOffset(xOffset, yOffset);
+ action.release();
+ action.build().perform();
+ }
+}