Example usage for org.openqa.selenium Keys ENTER

List of usage examples for org.openqa.selenium Keys ENTER

Introduction

In this page you can find the example usage for org.openqa.selenium Keys ENTER.

Prototype

Keys ENTER

To view the source code for org.openqa.selenium Keys ENTER.

Click Source Link

Usage

From source file:info.magnolia.integrationtests.uitest.KeyboardShortcutUITest.java

License:Open Source License

@Test
public void itemCanBeEditedAfterCreation() throws Exception {
    // GIVEN//  w ww  . j  av  a  2  s .  c o  m
    getAppIcon("Configuration").click();
    waitUntil(appIsLoaded());
    assertAppOpen("Configuration");

    getActionBarItem("Add content node").click();
    delay(1, "Wait for node creation");

    // WHEN
    getKeyboard().pressKey(Keys.ENTER);
    delay(1, "Wait for key press");
    getEditedElement().sendKeys("newContentNode");
    delay(1, "Wait for key press");
    getKeyboard().pressKey(Keys.ENTER);
    delay(1, "Wait for key press");

    // THEN
    assertTrue(isTreeTableItemSelected("newContentNode"));
    // cleanup
    getActionBarItem("Delete item").click();
    getDialogConfirmButton().click();
}

From source file:info.magnolia.integrationtests.uitest.KeyboardShortcutUITest.java

License:Open Source License

@Test
public void focusIsNotLostIfThereIsNotAnotherItemToEdit() throws Exception {
    // GIVEN/* w  w w.jav  a  2s.co  m*/
    getAppIcon("Configuration").click();
    waitUntil(appIsLoaded());
    assertAppOpen("Configuration");

    getTreeTableItem("server").click();

    // WHEN
    getKeyboard().pressKey(Keys.chord(Keys.SHIFT, Keys.TAB));
    delay(1, "Wait for key press");

    // THEN
    // make sure server node is still selected
    assertTrue(isTreeTableItemSelected("server"));

    // WHEN
    getKeyboard().pressKey(Keys.ENTER);
    delay(1, "Wait for key press");

    // THEN
    // check if we're in inline editing mode
    assertThat(getEditedElement().getTagName(), is("input"));
}

From source file:info.magnolia.integrationtests.uitest.KeyboardShortcutUITest.java

License:Open Source License

@Test
public void selectionIsOnCorrectRowWhenCyclingUsingTab() throws Exception {
    // GIVEN/*from   w w w .  j a v  a 2s. c  o m*/
    getAppIcon("Configuration").click();
    waitUntil(appIsLoaded());
    assertAppOpen("Configuration");

    getTreeTableItemExpander("server").click();
    getTreeTableItem("server").click();
    getTreeTableItem("admin").click();

    // WHEN
    // edit admin property and cycle 3 times using tab
    getKeyboard().pressKey(Keys.ENTER);
    delay(1, "Wait for key press");
    getKeyboard().pressKey(Keys.TAB);
    delay(1, "Wait for key press");
    getKeyboard().pressKey(Keys.TAB);
    delay(1, "Wait for key press");
    getKeyboard().pressKey(Keys.TAB);
    delay(1, "Wait for key press");
    getKeyboard().pressKey(Keys.ENTER);

    // THEN
    assertTrue(isTreeTableItemSelected("defaultBaseUrl"));

    // WHEN
    // now cycle back to admin property
    getKeyboard().pressKey(Keys.ENTER);
    delay(1, "Wait for key press");
    getKeyboard().pressKey(Keys.chord(Keys.SHIFT, Keys.TAB));
    delay(1, "Wait for key press");
    getKeyboard().pressKey(Keys.chord(Keys.SHIFT, Keys.TAB));
    delay(1, "Wait for key press");
    getKeyboard().pressKey(Keys.chord(Keys.SHIFT, Keys.TAB));
    delay(1, "Wait for key press");
    getKeyboard().pressKey(Keys.ENTER);
    delay(1, "Wait for key press");

    // THEN
    assertTrue(isTreeTableItemSelected("admin"));
}

From source file:info.magnolia.integrationtests.uitest.KeyboardShortcutUITest.java

License:Open Source License

@Test
public void itIsPossibleToCycleBetweenPropertiesAndNodes() throws Exception {
    // GIVEN// ww  w .  j  a  va 2  s. c  o  m
    getAppIcon("Configuration").click();
    waitUntil(appIsLoaded());
    assertAppOpen("Configuration");

    getTreeTableItemExpander("server").click();
    delay(1, "Wait so item gets expanded");
    getTreeTableItem("server").click();
    delay(1, "Wait for item to be selected");
    getTreeTableItem("admin").click();
    delay(1, "Wait for item to be selected");

    // WHEN
    // cycle back to auditLogging node
    getKeyboard().pressKey(Keys.ENTER);
    delay(1, "Wait for key press");
    getKeyboard().pressKey(Keys.chord(Keys.SHIFT, Keys.TAB));
    delay(1, "Wait for key press");
    getKeyboard().pressKey(Keys.chord(Keys.SHIFT, Keys.TAB));
    delay(1, "Wait for key press");
    getKeyboard().pressKey(Keys.chord(Keys.SHIFT, Keys.TAB));
    delay(1, "Wait for key press");
    getKeyboard().pressKey(Keys.ENTER);
    delay(1, "Wait for key press");

    // THEN
    assertTrue(isTreeTableItemSelected("auditLogging"));

    // WHEN
    // now cycle back to admin property
    getKeyboard().pressKey(Keys.ENTER);
    delay(1, "Wait for key press");
    getKeyboard().pressKey(Keys.TAB);
    delay(1, "Wait for key press");
    getKeyboard().pressKey(Keys.TAB);
    delay(1, "Wait for key press");
    getKeyboard().pressKey(Keys.TAB);
    delay(1, "Wait for key press");
    getKeyboard().pressKey(Keys.ENTER);
    delay(1, "Wait for key press");

    // THEN
    assertTrue(isTreeTableItemSelected("admin"));
}

From source file:info.magnolia.integrationtests.uitest.LogToolsAppUITest.java

License:Open Source License

@Test
public void testFilters() {
    // GIVEN/*ww  w .  j  a v a2 s.  co m*/
    goToSubApp(LOG_LEVELS);
    String filterPattern = "WARN";

    // WHEN
    WebElement nameFilter = getElement(By.xpath("//input[contains(@class, 'v-textfield')]"));
    nameFilter.sendKeys(FILTER_SEARCH_PATTERN);
    delay("Wait for the grid to refresh");
    assertPatternIsInAllColumnRows("//tbody/tr[contains(@class, 'v-grid-row')]/*[1]", FILTER_SEARCH_PATTERN,
            true);

    // THEN
    // nameFilter.clear() is cleaner than this but it doesn't revert the grid filtering, probably because it's too fast
    nameFilter.click();
    for (int i = 0; i < FILTER_SEARCH_PATTERN.length(); i++) {
        nameFilter.sendKeys(Keys.BACK_SPACE);
    }
    delay("Wait for the grid to refresh");

    // WHEN
    WebElement levelFilter = getElement(
            By.xpath("//thead/*[2]/*[3]/div/select[contains(@class, 'v-select-select')]"));
    levelFilter.sendKeys(filterPattern);
    levelFilter.sendKeys(Keys.ENTER);
    delay("Wait for the grid to refresh");
    // THEN
    assertPatternIsInAllColumnRows("//tbody/tr[contains(@class, 'v-grid-row')]/*[3]", filterPattern, false);
}

From source file:info.magnolia.integrationtests.uitest.URIEncodingUITest.java

License:Open Source License

@Ignore("Ignoring error until MGNLUI-1600 is solved")
@Test/* www.j  a v a 2 s.com*/
public void doUnencodedSearchBySearchFieldContentAppStillFunctional() {
    // GIVEN
    final String unencodedSearchString = "Vincent Va*";

    // WHEN - navigate directly to content app
    navigateDriverTo(AUTHOR_URL);
    delay("Give some time to restart magnolia");

    // WHEN - search is entered and triggered
    WebElement searchBox = getElement(By.xpath("//input[contains(@class, 'searchfield')]"));
    searchBox.sendKeys("");
    searchBox.sendKeys(unencodedSearchString);
    simulateKeyPress(Keys.ENTER);
    delay("Give some time for the results to appear");

    // THEN
    assertEquals("Expected to find encoded URI", AUTHOR_URL + "/:searchview:Vincent%20Va*",
            getCurrentDriverUrl());
    assertTrue("Expected search result: Vincent Van Gogh", getTreeTableItem("Vincent Van Gogh").isDisplayed());
}

From source file:io.fabric8.test.Fabric8Console.java

License:Apache License

@Step("Given a user is logged in")
public void log_in(String user, String password) {

    find(By.id("inputUsername")).sendKeys(user);
    find(By.id("inputPassword")).sendKeys(password, Keys.ENTER);

    new WebDriverWait(this.getDriver(), 5).until(titleContains("OpenShift Web Console"));
}

From source file:io.openvidu.test.e2e.OpenViduTestAppE2eTest.java

License:Apache License

@Test
@DisplayName("One2One [Audio]")
void oneToOneAudioSession() throws Exception {

    setupBrowser("chrome");

    log.info("One2One [Audio]");

    user.getDriver().findElement(By.id("one2one-btn")).click();

    user.getDriver().findElements(By.className("send-video-checkbox")).forEach(el -> el.click());
    user.getDriver().findElements(By.className("join-btn")).forEach(el -> el.sendKeys(Keys.ENTER));

    user.getEventManager().waitUntilEventReaches("connectionCreated", 4);
    user.getEventManager().waitUntilEventReaches("accessAllowed", 2);
    user.getEventManager().waitUntilEventReaches("streamCreated", 4);
    user.getEventManager().waitUntilEventReaches("streamPlaying", 4);

    System.out.println(this.getBase64Screenshot(user));

    final int numberOfVideos = user.getDriver().findElements(By.tagName("video")).size();
    Assert.assertEquals("Expected 4 videos but found " + numberOfVideos, 4, numberOfVideos);
    Assert.assertTrue("Videos were expected to only have audio tracks", user.getEventManager()
            .assertMediaTracks(user.getDriver().findElements(By.tagName("video")), true, false));

    gracefullyLeaveParticipants(2);//from   w ww  . ja  v  a2 s  .com
}

From source file:io.openvidu.test.e2e.OpenViduTestAppE2eTest.java

License:Apache License

@Test
@DisplayName("One2One [Video]")
void oneToOneVideoSession() throws Exception {

    setupBrowser("chrome");

    log.info("One2One [Video]");

    user.getDriver().findElement(By.id("one2one-btn")).click();

    user.getDriver().findElements(By.className("send-audio-checkbox")).forEach(el -> el.click());
    user.getDriver().findElements(By.className("join-btn")).forEach(el -> el.sendKeys(Keys.ENTER));

    user.getEventManager().waitUntilEventReaches("connectionCreated", 4);
    user.getEventManager().waitUntilEventReaches("accessAllowed", 2);
    user.getEventManager().waitUntilEventReaches("streamCreated", 4);
    user.getEventManager().waitUntilEventReaches("streamPlaying", 4);

    final int numberOfVideos = user.getDriver().findElements(By.tagName("video")).size();
    Assert.assertEquals("Expected 4 videos but found " + numberOfVideos, 4, numberOfVideos);
    Assert.assertTrue("Videos were expected to only have video tracks", user.getEventManager()
            .assertMediaTracks(user.getDriver().findElements(By.tagName("video")), false, true));

    gracefullyLeaveParticipants(2);//from  www  .  j a v  a2 s.  co  m
}

From source file:io.openvidu.test.e2e.OpenViduTestAppE2eTest.java

License:Apache License

@Test
@DisplayName("Many2Many [Video + Audio]")
void manyToManyVideoAudioSession() throws Exception {

    setupBrowser("chrome");

    log.info("Many2Many [Video + Audio]");

    WebElement addUser = user.getDriver().findElement(By.id("add-user-btn"));
    for (int i = 0; i < 4; i++) {
        addUser.click();/*from  w  w w .  j av  a2 s  .c  o m*/
    }

    user.getDriver().findElements(By.className("join-btn")).forEach(el -> el.sendKeys(Keys.ENTER));

    user.getEventManager().waitUntilEventReaches("connectionCreated", 16);
    user.getEventManager().waitUntilEventReaches("accessAllowed", 4);
    user.getEventManager().waitUntilEventReaches("streamCreated", 16);
    user.getEventManager().waitUntilEventReaches("streamPlaying", 16);

    final int numberOfVideos = user.getDriver().findElements(By.tagName("video")).size();
    Assert.assertEquals("Expected 16 videos but found " + numberOfVideos, 16, numberOfVideos);
    Assert.assertTrue("Videos were expected to have audio and video tracks", user.getEventManager()
            .assertMediaTracks(user.getDriver().findElements(By.tagName("video")), true, true));

    gracefullyLeaveParticipants(4);
}