summaryrefslogtreecommitdiffstats
path: root/uitest/src
diff options
context:
space:
mode:
authorPekka Hyvönen <pekka@vaadin.com>2015-04-14 15:39:18 +0300
committerVaadin Code Review <review@vaadin.com>2015-04-16 08:44:32 +0000
commitdd550858b9b4300acac8e35159f4c93e7f58d8ed (patch)
tree34654e20bef89b3eabaa4b24746b9adad1aaef2c /uitest/src
parent4c8ac1b008a9221ecd9e9133dd598435ae4dd8fd (diff)
downloadvaadin-framework-dd550858b9b4300acac8e35159f4c93e7f58d8ed.tar.gz
vaadin-framework-dd550858b9b4300acac8e35159f4c93e7f58d8ed.zip
Calculate Grid sidebar button height when closed #17412
+ contains Valo theming fixes for all browsers. + includes screenshot test for sidebar in Valo Change-Id: Ic6401057efff7e4d4ab65c46885dda2d995bce5d
Diffstat (limited to 'uitest/src')
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java27
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridColumnHidingTest.java9
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java31
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java86
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/LoadingIndicatorTest.java7
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java20
6 files changed, 139 insertions, 41 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java
index ca8ea9fd75..469bf37c2f 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java
@@ -233,4 +233,31 @@ public abstract class GridBasicFeaturesTest extends MultiBrowserTest {
assertTrue(getGridElement().getCell(row, column).getAttribute("class")
.contains("focused"));
}
+
+ protected WebElement getSidebar() {
+ List<WebElement> elements = findElements(By.className("v-grid-sidebar"));
+ return elements.isEmpty() ? null : elements.get(0);
+ }
+
+ protected WebElement getSidebarOpenButton() {
+ List<WebElement> elements = findElements(By
+ .className("v-grid-sidebar-button"));
+ return elements.isEmpty() ? null : elements.get(0);
+ }
+
+ /**
+ * Returns the toggle inside the sidebar for hiding the column at the given
+ * index, or null if not found.
+ */
+ protected WebElement getColumnHidingToggle(int columnIndex) {
+ WebElement sidebar = getSidebar();
+ List<WebElement> elements = sidebar.findElements(By
+ .className("column-hiding-toggle"));
+ for (WebElement e : elements) {
+ if ((e.getText().toLowerCase()).startsWith("column " + columnIndex)) {
+ return e;
+ }
+ }
+ return null;
+ }
}
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridColumnHidingTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridColumnHidingTest.java
index 1213e02799..b446bdef48 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridColumnHidingTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridColumnHidingTest.java
@@ -921,12 +921,14 @@ public class GridColumnHidingTest extends GridBasicClientFeaturesTest {
assertNotNull(sidebar);
}
- private WebElement getSidebar() {
+ @Override
+ protected WebElement getSidebar() {
List<WebElement> elements = findElements(By.className("v-grid-sidebar"));
return elements.isEmpty() ? null : elements.get(0);
}
- private WebElement getSidebarOpenButton() {
+ @Override
+ protected WebElement getSidebarOpenButton() {
List<WebElement> elements = findElements(By
.className("v-grid-sidebar-button"));
return elements.isEmpty() ? null : elements.get(0);
@@ -936,7 +938,8 @@ public class GridColumnHidingTest extends GridBasicClientFeaturesTest {
* Returns the toggle inside the sidebar for hiding the column at the given
* index, or null if not found.
*/
- private WebElement getColumnHidingToggle(int columnIndex) {
+ @Override
+ protected WebElement getColumnHidingToggle(int columnIndex) {
WebElement sidebar = getSidebar();
List<WebElement> elements = sidebar.findElements(By
.className("column-hiding-toggle"));
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java
index 7942650576..d01e689b72 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java
@@ -21,12 +21,8 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import java.util.List;
-
import org.junit.Before;
import org.junit.Test;
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebElement;
import com.vaadin.testbench.parallel.TestCategory;
import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeaturesTest;
@@ -281,31 +277,4 @@ public class GridColumnVisibilityTest extends GridBasicFeaturesTest {
selectMenuPath("Component", "Columns", "Column " + index,
"Add / Remove");
}
-
- private WebElement getSidebar() {
- List<WebElement> elements = findElements(By.className("v-grid-sidebar"));
- return elements.isEmpty() ? null : elements.get(0);
- }
-
- private WebElement getSidebarOpenButton() {
- List<WebElement> elements = findElements(By
- .className("v-grid-sidebar-button"));
- return elements.isEmpty() ? null : elements.get(0);
- }
-
- /**
- * Returns the toggle inside the sidebar for hiding the column at the given
- * index, or null if not found.
- */
- private WebElement getColumnHidingToggle(int columnIndex) {
- WebElement sidebar = getSidebar();
- List<WebElement> elements = sidebar.findElements(By
- .className("column-hiding-toggle"));
- for (WebElement e : elements) {
- if ((e.getText().toLowerCase()).startsWith("column " + columnIndex)) {
- return e;
- }
- }
- return null;
- }
}
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java
new file mode 100644
index 0000000000..79327993b0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2000-2014 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.grid.basicfeatures.server;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
+import com.vaadin.testbench.parallel.Browser;
+import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeaturesTest;
+
+public class GridSidebarThemeTest extends GridBasicFeaturesTest {
+
+ @Test
+ public void testValo() throws Exception {
+ runTestSequence("valo");
+ }
+
+ private void runTestSequence(String theme) throws IOException {
+ openTestURL("theme=" + theme);
+ if (getDesiredCapabilities().getBrowserName().equals(
+ Browser.CHROME.getDesiredCapabilities().getBrowserName())) {
+ waitUntil(ExpectedConditions.elementToBeClickable(By.id("menu")), 2);
+ getDriver().findElement(By.id("menu")).click();
+ selectMenu("Columns");
+ selectMenu("All columns hidable");
+ waitUntilLoadingIndicatorNotVisible();
+ } else {
+ selectMenuPath("Component", "Columns", "All columns hidable");
+ }
+
+ compareScreen(theme + "|SidebarClosed");
+ getSidebarOpenButton().click();
+
+ compareScreen(theme + "|SidebarOpen");
+
+ new Actions(getDriver()).moveToElement(getColumnHidingToggle(2), 5, 5)
+ .perform();
+
+ compareScreen(theme + "|OnMouseOverNotHiddenToggle");
+
+ getColumnHidingToggle(2).click();
+ getColumnHidingToggle(3).click();
+ getColumnHidingToggle(6).click();
+
+ new Actions(getDriver()).moveToElement(getSidebarOpenButton())
+ .perform();
+ ;
+
+ compareScreen(theme + "|TogglesTriggered");
+
+ new Actions(getDriver()).moveToElement(getColumnHidingToggle(2))
+ .perform();
+ ;
+
+ compareScreen(theme + "|OnMouseOverHiddenToggle");
+
+ getSidebarOpenButton().click();
+
+ compareScreen(theme + "|SidebarClosed2");
+ }
+
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ // phantom JS looks wrong from the beginning, so not tested
+ return getBrowsersExcludingPhantomJS();
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/LoadingIndicatorTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/LoadingIndicatorTest.java
index f251313100..f4771b9067 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/LoadingIndicatorTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/LoadingIndicatorTest.java
@@ -19,7 +19,6 @@ import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
@@ -83,10 +82,4 @@ public class LoadingIndicatorTest extends GridBasicFeaturesTest {
});
}
- private boolean isLoadingIndicatorVisible() {
- WebElement loadingIndicator = findElement(By
- .className("v-loading-indicator"));
-
- return loadingIndicator.isDisplayed();
- }
}
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
index 2d032ecd9e..48f99e5057 100644
--- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -938,4 +938,24 @@ public abstract class AbstractTB3Test extends ParallelTest {
protected void click(CheckBoxElement checkbox) {
checkbox.findElement(By.xpath("input")).click();
}
+
+ protected boolean isLoadingIndicatorVisible() {
+ WebElement loadingIndicator = findElement(By
+ .className("v-loading-indicator"));
+
+ return loadingIndicator.isDisplayed();
+ }
+
+ protected void waitUntilLoadingIndicatorNotVisible() {
+ waitUntil(new ExpectedCondition<Boolean>() {
+
+ @Override
+ public Boolean apply(WebDriver input) {
+ WebElement loadingIndicator = input.findElement(By
+ .className("v-loading-indicator"));
+
+ return !loadingIndicator.isDisplayed();
+ }
+ });
+ }
}