Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a(n E2E) test for basic (left) arrow key usage #8492

Merged
merged 7 commits into from
Jul 11, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
* Tests interaction through the advanced gestures API of keyboard handling.
*/
public class BasicKeyboardInterfaceTest extends JUnit4TestBase {

private Actions getBuilder(WebDriver driver) {
return new Actions(driver);
}
Expand Down Expand Up @@ -297,6 +296,26 @@ public void testSelectionSelectAll() {
assertThat(input.getAttribute("value")).isEqualTo("");
}

@Test
public void testLeftArrowEntry() {
final String leftArrowSpaceTestStringCore = "bfmtv.fr";
final String leftArrowSpaceTestString = leftArrowSpaceTestStringCore+ "est";
final String leftArrowSpaceTestStringExpected = leftArrowSpaceTestStringCore+" est";

driver.get(appServer.whereIs("single_text_input.html"));
WebElement textInput = driver.findElement(By.id("textInput"));
sendLeftArrowSpaceTestKeys(textInput, leftArrowSpaceTestString);

assertThat(textInput.getAttribute("value")).isEqualTo(leftArrowSpaceTestStringExpected);
}

private void sendLeftArrowSpaceTestKeys(final WebElement inputElement, final String leftArrowSpaceTestString) {
inputElement.sendKeys(leftArrowSpaceTestString);
for (byte j = 0; j < 3; j++)
inputElement.sendKeys(Keys.LEFT);
inputElement.sendKeys(Keys.SPACE);
}

private void assertBackgroundColor(WebElement el, Colors expected) {
Color actual = Color.fromString(el.getCssValue("background-color"));
assertThat(actual).isEqualTo(expected.getColorValue());
Expand Down