use of org.openqa.selenium.interactions.Actions in project rstudio by rstudio.
the class RConsoleInteraction method testPlotGeneration.
@Test
public void testPlotGeneration() {
ConsoleTestUtils.resumeConsoleInteraction(driver_);
Actions plotCars = new Actions(driver_);
plotCars.sendKeys(Keys.ESCAPE + "plot(cars)" + Keys.ENTER);
plotCars.perform();
// Wait for the Plot window to activate
final WebElement plotWindow = (new WebDriverWait(driver_, 5)).until(ExpectedConditions.presenceOfElementLocated(By.id(ElementIds.getElementId(ElementIds.PLOT_IMAGE_FRAME))));
// Wait for a plot to appear in the window
Assert.assertEquals(plotWindow.getTagName(), "iframe");
driver_.switchTo().frame(plotWindow);
(new WebDriverWait(driver_, 5)).until(ExpectedConditions.presenceOfElementLocated(By.tagName("img")));
// Switch back to document context
driver_.switchTo().defaultContent();
}
use of org.openqa.selenium.interactions.Actions in project rstudio by rstudio.
the class RConsoleInteraction method testInvokeHelp.
@Test
public void testInvokeHelp() {
ConsoleTestUtils.resumeConsoleInteraction(driver_);
Actions help = new Actions(driver_);
help.sendKeys(Keys.ESCAPE + "?lapply" + Keys.ENTER);
help.perform();
// Wait for the Help window to activate
final WebElement helpWindow = (new WebDriverWait(driver_, 5)).until(ExpectedConditions.presenceOfElementLocated(By.id(ElementIds.getElementId(ElementIds.HELP_FRAME))));
// Wait for help to appear in the window
Assert.assertEquals(helpWindow.getTagName(), "iframe");
driver_.switchTo().frame(helpWindow);
(new WebDriverWait(driver_, 5)).until(ExpectedConditions.textToBePresentInElement(By.tagName("body"), "lapply"));
// Switch back to document context
driver_.switchTo().defaultContent();
}
use of org.openqa.selenium.interactions.Actions in project rstudio by rstudio.
the class RConsoleInteraction method testBasicRInteraction.
@Test
public void testBasicRInteraction() {
Actions do42 = new Actions(driver_);
do42.sendKeys(Keys.chord(Keys.CONTROL, "l"));
do42.sendKeys(Keys.ESCAPE);
do42.sendKeys("41 + 1");
do42.sendKeys(Keys.ENTER);
do42.perform();
ConsoleTestUtils.waitForConsoleContainsText(driver_, "42");
}
use of org.openqa.selenium.interactions.Actions in project rstudio by rstudio.
the class SourceInteraction method findAndReplace.
@Test
public void findAndReplace() {
createRFile();
// Type some code into the file
String preReplaceCode = "foo <- 'bar'";
Actions a = new Actions(driver_);
a.sendKeys(preReplaceCode + Keys.ENTER);
a.perform();
// Find the ACE editor instance that the code appears in. (CONSIDER:
// This is not the best way to find the code editor instance.)
WebElement editor = null;
List<WebElement> editors = driver_.findElements(By.className("ace_content"));
for (WebElement e : editors) {
if (e.getText().contains(preReplaceCode)) {
editor = e;
break;
}
}
Assert.assertNotNull(editor);
// Invoke find and replace
WebElement findMenuEntry = MenuNavigator.getMenuItem(driver_, "Edit", "Find...");
findMenuEntry.click();
// Wait for the find and replace panel to come up
(new WebDriverWait(driver_, 2)).until(ExpectedConditions.presenceOfElementLocated(By.id(ElementIds.getElementId(ElementIds.FIND_REPLACE_BAR))));
// Type the text and the text to be replaced (replace 'bar' with 'foo')
Actions rep = new Actions(driver_);
rep.sendKeys("bar" + Keys.TAB + "foo" + Keys.ENTER);
rep.perform();
DialogTestUtils.respondToModalDialog(driver_, "OK");
Actions dismiss = new Actions(driver_);
dismiss.sendKeys(Keys.ESCAPE);
dismiss.perform();
// Ensure that the source has been updated
Assert.assertTrue(editor.getText().contains("foo <- 'foo'"));
closeUnsavedRFile();
}
use of org.openqa.selenium.interactions.Actions in project ghostdriver by detro.
the class MouseCommandsTest method doubleClick.
@Test
public void doubleClick() {
WebDriver d = getDriver();
Actions actionBuilder = new Actions(d);
d.get("http://www.duckduckgo.com");
// Double click
actionBuilder.doubleClick().build().perform();
// Double click on the logo
actionBuilder.doubleClick(d.findElement(By.id("logo_homepage_link"))).build().perform();
}
Aggregations