aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2014-07-18 11:18:58 +0300
committerTeemu Suo-Anttila <teemusa@vaadin.com>2014-07-22 22:52:58 +0300
commit0bbd14486e3839c60e1e59f12dc959b133b6ed05 (patch)
tree76ad3d3bf6acf7b7383ab45457a1f70e3e8c658e /uitest/src/com/vaadin/tests
parent14667cc349f8c8d65966638b9fc2a0b272f6ec7c (diff)
downloadvaadin-framework-0bbd14486e3839c60e1e59f12dc959b133b6ed05.tar.gz
vaadin-framework-0bbd14486e3839c60e1e59f12dc959b133b6ed05.zip
Implement Tab navigation for Grid (#13334)
Change-Id: If2c1f3db23247355439360def983dba714979a48
Diffstat (limited to 'uitest/src/com/vaadin/tests')
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java10
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridKeyboardNavigationTest.java51
2 files changed, 61 insertions, 0 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 cc48f11c69..94d9766f78 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java
@@ -23,6 +23,7 @@ import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.remote.DesiredCapabilities;
import com.vaadin.testbench.TestBenchElement;
import com.vaadin.tests.annotations.TestCategory;
@@ -33,6 +34,15 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
public abstract class GridBasicFeaturesTest extends MultiBrowserTest {
@Override
+ protected DesiredCapabilities getDesiredCapabilities() {
+ DesiredCapabilities dCap = super.getDesiredCapabilities();
+ if (BrowserUtil.isIE(dCap)) {
+ dCap.setCapability("requireWindowFocus", true);
+ }
+ return super.getDesiredCapabilities();
+ }
+
+ @Override
protected Class<?> getUIClass() {
return GridBasicFeatures.class;
}
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridKeyboardNavigationTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridKeyboardNavigationTest.java
index 4c7e7c6365..4c26124a51 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridKeyboardNavigationTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridKeyboardNavigationTest.java
@@ -118,4 +118,55 @@ public class GridKeyboardNavigationTest extends GridBasicFeaturesTest {
assertTrue("Body cell 300, 2 is not active", grid.getCell(300, 2)
.isActive());
}
+
+ @Test
+ public void testNavigateBetweenHeaderAndBodyWithTab() {
+ openTestURL();
+
+ GridElement grid = getGridElement();
+ grid.getCell(10, 2).click();
+
+ assertTrue("Body cell 10, 2 is not active", grid.getCell(10, 2)
+ .isActive());
+ new Actions(getDriver()).keyDown(Keys.SHIFT).sendKeys(Keys.TAB)
+ .keyUp(Keys.SHIFT).perform();
+ assertTrue("Header cell 0, 2 is not active", grid.getHeaderCell(0, 2)
+ .isActive());
+ new Actions(getDriver()).sendKeys(Keys.TAB).perform();
+ assertTrue("Body cell 10, 2 is not active", grid.getCell(10, 2)
+ .isActive());
+
+ // Navigate out of the Grid and try to navigate with arrow keys.
+ new Actions(getDriver()).keyDown(Keys.SHIFT).sendKeys(Keys.TAB)
+ .sendKeys(Keys.TAB).keyUp(Keys.SHIFT).sendKeys(Keys.ARROW_DOWN)
+ .perform();
+ assertTrue("Header cell 0, 2 is not active", grid.getHeaderCell(0, 2)
+ .isActive());
+ }
+
+ @Test
+ public void testNavigateBetweenFooterAndBodyWithTab() {
+ openTestURL();
+
+ selectMenuPath("Component", "Footers", "Visible");
+
+ GridElement grid = getGridElement();
+ grid.getCell(10, 2).click();
+
+ assertTrue("Body cell 10, 2 is not active", grid.getCell(10, 2)
+ .isActive());
+ new Actions(getDriver()).sendKeys(Keys.TAB).perform();
+ assertTrue("Footer cell 0, 2 is not active", grid.getFooterCell(0, 2)
+ .isActive());
+ new Actions(getDriver()).keyDown(Keys.SHIFT).sendKeys(Keys.TAB)
+ .keyUp(Keys.SHIFT).perform();
+ assertTrue("Body cell 10, 2 is not active", grid.getCell(10, 2)
+ .isActive());
+
+ // Navigate out of the Grid and try to navigate with arrow keys.
+ new Actions(getDriver()).sendKeys(Keys.TAB).sendKeys(Keys.TAB)
+ .sendKeys(Keys.ARROW_UP).perform();
+ assertTrue("Footer cell 0, 2 is not active", grid.getFooterCell(0, 2)
+ .isActive());
+ }
}