Example usage for org.openqa.selenium Keys ESCAPE

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

Introduction

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

Prototype

Keys ESCAPE

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

Click Source Link

Usage

From source file:org.eclipse.che.selenium.core.action.MacOSActionsTest.java

License:Open Source License

@Test
public void testShouldReplacePageUpCharSequence() throws Exception {
    MacOSActions actions = new MacOSActions(webDriver);

    final CharSequence[] charSequences = actions.modifyCharSequence(Keys.ESCAPE, Keys.PAGE_UP);

    assertNotNull(charSequences);//from   w  w w. ja  va  2 s .c  om
    assertEquals(charSequences.length, 2);

    assertEquals(charSequences[0], Keys.ESCAPE);
    assertEquals(charSequences[1], Keys.chord(Keys.COMMAND, Keys.UP));
}

From source file:org.eclipse.che.selenium.core.action.MacOSActionsTest.java

License:Open Source License

@Test
public void testShouldNotReplaceAnyCharSequence() throws Exception {
    MacOSActions actions = new MacOSActions(webDriver);

    final CharSequence[] charSequences = actions.modifyCharSequence(Keys.ESCAPE, Keys.ENTER);

    assertNotNull(charSequences);/*w ww . j  a  v a  2  s .c o  m*/
    assertEquals(charSequences.length, 2);

    assertEquals(charSequences[0], Keys.ESCAPE);
    assertEquals(charSequences[1], Keys.ENTER);
}

From source file:org.eclipse.che.selenium.editor.autocomplete.EditorValidationTest.java

License:Open Source License

@Test
public void autoCompleteClassInTheSamePackage() {
    projectExplorer.waitProjectExplorer();
    projectExplorer.waitItem(PROJECT_NAME);
    consoles.closeProcessesArea();/*from w  ww.jav  a  2 s  .  c o  m*/
    projectExplorer.quickExpandWithJavaScript();
    mavenPluginStatusBar.waitClosingInfoPanel();
    projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java");
    editor.waitActiveEditor();
    //validation warnings
    editor.waitAllMarkersDisappear(ERROR_MARKER);
    editor.setCursorToLine(28);
    editor.typeTextIntoEditor(Keys.END.toString());
    editor.typeTextIntoEditor("\n");
    editor.typeTextIntoEditor(TEXT_FOR_WARNING);
    editor.waitMarkerInPosition(WARNING_MARKER, 29);
    editor.waitAnnotationCodeAssistIsClosed();
    editor.moveToMarkerAndWaitAssistContent(WARNING_MARKER);
    loader.waitOnClosed();
    editor.waitTextIntoAnnotationAssist("The value of the local variable l is not used");
    editor.waitTextIntoAnnotationAssist("The value of the local variable n is not used");

    // TODO the proposition code assist does not still work by click
    //ide.getEditor().clickOnWarningMarkerInPosition(21);
    editor.launchPropositionAssistPanel();
    editor.waitTextIntoFixErrorProposition("Remove 'l', keep assignments with side effects");
    editor.waitTextIntoFixErrorProposition("Remove 'l' and all assignments");
    editor.typeTextIntoEditor(Keys.ESCAPE.toString());
    editor.waitErrorPropositionPanelClosed();

    //validation errors
    editor.setCursorToLine(30);
    editor.waitActiveEditor();
    editor.typeTextIntoEditor(TEXT_FOR_ERROR);
    editor.waitMarkerInPosition(ERROR_MARKER, 30);
    editor.waitActiveEditor();
    editor.waitAnnotationCodeAssistIsClosed();
    editor.moveToMarkerAndWaitAssistContent(ERROR_MARKER);
    editor.waitTextIntoAnnotationAssist("Type mismatch: cannot convert from double to Integer");
    editor.waitTextIntoAnnotationAssist("Keys cannot be resolved to a variable");
    loader.waitOnClosed();

    // TODO the proposition code assist does not still work by click
    //ide.getEditor().clickOnErrorMarkerInPosition(22);
    editor.typeTextIntoEditor(Keys.HOME.toString());
    editor.launchPropositionAssistPanel();
    editor.waitTextIntoFixErrorProposition("Add cast to 'int'");
    editor.waitTextIntoFixErrorProposition("Change type of 'f' to 'double'");
}

From source file:org.eclipse.che.selenium.editor.autocomplete.JavaDocPopupTest.java

License:Open Source License

@Test
public void javaDocPopupTest() throws Exception {
    projectExplorer.waitProjectExplorer();
    projectExplorer.waitItem(PROJECT_NAME);
    consoles.closeProcessesArea();//  www. j  a va 2  s  .  c o  m
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.waitItem(PATH_TO_FILES + "/AppController.java");
    projectExplorer.openItemByVisibleNameInExplorer("AppController.java");
    loader.waitOnClosed();
    // Class javadoc popup
    editor.setCursorToDefinedLineAndChar(25, 105);

    editor.openJavaDocPopUp();
    editor.waitJavaDocPopUpOpened();
    editor.checkTextToBePresentInJavaDocPopUp(CLASS_TEXT);

    editor.selectTabByName("AppController");
    editor.waitJavaDocPopUpClosed();

    // Annotation javadoc popup
    editor.typeTextIntoEditor(Keys.CONTROL.toString());
    editor.waitActiveEditor();
    editor.setCursorToDefinedLineAndChar(24, 6);

    editor.openJavaDocPopUp();
    editor.waitJavaDocPopUpOpened();
    editor.checkTextToBePresentInJavaDocPopUp(ANNOTATION_TEXT);

    editor.typeTextIntoEditor(Keys.ESCAPE.toString());
    editor.waitJavaDocPopUpClosed();
    editor.typeTextIntoEditor(Keys.CONTROL.toString());

    // Class name javadoc popup
    editor.setCursorToDefinedLineAndChar(21, 17);
    editor.openJavaDocPopUp();
    editor.waitJavaDocPopUpOpened();
    editor.checkTextToBePresentInJavaDocPopUp(CLASS_NAME_TEXT);

    editor.selectTabByName("AppController");
    editor.waitJavaDocPopUpClosed();
    editor.typeTextIntoEditor(Keys.CONTROL.toString());

    // Class constructor name javadoc popup
    editor.setCursorToLine(23);
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor("public AppController() {}");
    editor.typeTextIntoEditor(Keys.ENTER.toString());

    editor.setCursorToDefinedLineAndChar(24, 15);
    editor.openJavaDocPopUp();
    editor.checkTextToBePresentInJavaDocPopUp(CONSTRUCTOR_TEXT);

    editor.selectTabByName("AppController");
    editor.waitJavaDocPopUpClosed();
    editor.typeTextIntoEditor(Keys.CONTROL.toString());

    createClass("TestClass", PATH_TO_FILES);
    editor.setCursorToLine(2);
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor("/**");
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor(Keys.UP.toString());
    editor.typeTextIntoEditor("Hello");
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor("<script>alert('Hello')</script>");
    editor.closeAllTabsByContextMenu();
    projectExplorer.openItemByPath(PATH_TO_FILES + "/AppController.java");
    editor.setCursorToLine(23);
    editor.typeTextIntoEditor(Keys.END.toString());
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor("TestClass abc = new TestClass(); Object testObject = new Object();");
    editor.typeTextIntoEditor(Keys.HOME.toString());

    editor.setCursorToDefinedLineAndChar(24, 5);
    editor.openJavaDocPopUp();
    editor.checkTextToBePresentInJavaDocPopUp(JAVA_DOC_FOR_TEST_CLASS);

    editor.selectTabByName("AppController");
    editor.waitJavaDocPopUpClosed();
    editor.typeTextIntoEditor(Keys.CONTROL.toString());

    editor.setCursorToDefinedLineAndChar(24, 35);
    editor.openJavaDocPopUp();
    editor.waitJavaDocPopUpOpened();
    editor.checkTextToBePresentInJavaDocPopUp(JAVA_DOC_FOR_OBJECT);
}

From source file:org.eclipse.che.selenium.editor.autocomplete.QuickFixAndCodeAssistantFeaturesTest.java

License:Open Source License

@Test
public void quickFixAndCodeAssistantTest() {
    projectExplorer.waitItem(PROJECT_NAME);
    notificationsPopupPanel.waitProgressPopupPanelClose();
    consoles.closeProcessesArea();/* w  w  w  .j  a v a  2s.co m*/
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.openItemByVisibleNameInExplorer("AppController.java");
    editor.waitActiveEditor();

    editor.setCursorToLine(28);
    editor.typeTextIntoEditor(TEXT_FOR_WARNING);
    editor.waitMarkerInPosition(WARNING_MARKER, 28);
    editor.launchPropositionAssistPanel();
    editor.waitTextIntoFixErrorProposition("Remove 'l', keep assignments with side effects");
    editor.waitTextIntoFixErrorProposition("Remove 'l' and all assignments");
    editor.typeTextIntoEditor(Keys.ESCAPE.toString());
    editor.waitErrorPropositionPanelClosed();

    editor.launchPropositionAssistPanel();
    editor.waitTextIntoFixErrorProposition("Convert local variable to field");
    editor.waitTextIntoFixErrorProposition("Inline local variable");
    editor.typeTextIntoEditor(Keys.ESCAPE.toString());
    editor.waitErrorPropositionPanelClosed();
    loader.waitOnClosed();
    editor.typeTextIntoEditor(Keys.END.toString());
    editor.typeTextIntoEditor("\n");

    editor.typeTextIntoEditor(TEXT_FOR_ERROR);
    editor.launchAutocompleteAndWaitContainer();
    //ide.getEditor().selectItemIntoAutocompleteAndPasteByDoubleClick("null"); //TODO cursor disappears IDEX-3353
    editor.enterAutocompleteProposal("null");
    projectExplorer.selectVisibleItem("AppController.java"); // TODO because the cursor disappears after click in the autocomplete panel
    projectExplorer.openItemByVisibleNameInExplorer("AppController.java");
    editor.typeTextIntoEditor(";");
    editor.waitMarkerInPosition(ERROR_MARKER, 29);
    editor.launchPropositionAssistPanel();
    editor.waitTextIntoFixErrorProposition("Change to 'ClassDesc' (javax.rmi.CORBA)");
    editor.waitTextIntoFixErrorProposition("Change to 'ClassUtils' (org.springframework.util)");
    editor.waitTextIntoFixErrorProposition("Change to 'ClassValue' (java.lang)");
    editor.waitTextIntoFixErrorProposition("Change to 'Class' (java.lang)");
    editor.typeTextIntoEditor(Keys.ESCAPE.toString());
    editor.waitErrorPropositionPanelClosed();
    editor.launchPropositionAssistPanel();
    editor.waitTextIntoFixErrorProposition("Change to 'ClassDesc' (javax.rmi.CORBA)");
    editor.waitTextIntoFixErrorProposition("Change to 'ClassUtils' (org.springframework.util)");
    editor.waitTextIntoFixErrorProposition("Change to 'ClassValue' (java.lang)");
    editor.waitTextIntoFixErrorProposition("Change to 'Class' (java.lang)");
}

From source file:org.eclipse.che.selenium.editor.autocomplete.ShowHintsCommandTest.java

License:Open Source License

@Test
public void checkShowHintsCommand() {
    projectExplorer.waitProjectExplorer();
    projectExplorer.waitItem(PROJECT_NAME);
    console.closeProcessesArea();//www.jav a 2  s. co  m
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.openItemByVisibleNameInExplorer("AppController.java");
    loader.waitOnClosed();
    projectExplorer.openItemByVisibleNameInExplorer("HintTestClass.java");
    loader.waitOnClosed();

    // check the 'show hints' to all parameters on the overloaded method
    editor.selectTabByName("AppController");
    editor.waitActiveEditor();
    editor.setCursorToLine(32);
    editor.typeTextIntoEditor(Keys.TAB.toString());
    editor.typeTextIntoEditor("runCommand();");
    editor.waitTextIntoEditor("runCommand();");
    editor.typeTextIntoEditor(Keys.HOME.toString());
    editor.callShowHintsPopUp();
    editor.waitShowHintsPopUpOpened();
    editor.waitExpTextIntoShowHintsPopUp(TEXT_IN_POP_UP_1);
    editor.typeTextIntoEditor(Keys.ESCAPE.toString());
    editor.waitShowHintsPopUpClosed();

    // check the 'show hints' to all parameters on the overloaded constructor
    editor.waitActiveEditor();
    editor.setCursorToLine(27);
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor(Keys.TAB.toString());
    editor.typeTextIntoEditor(CONSTRUCTOR);
    editor.waitTextIntoEditor(CONSTRUCTOR);
    editor.setCursorToDefinedLineAndChar(28, 41);
    editor.callShowHintsPopUp();
    editor.waitShowHintsPopUpOpened();
    editor.waitExpTextIntoShowHintsPopUp(TEXT_IN_POP_UP_2);
    editor.typeTextIntoEditor(Keys.ESCAPE.toString());
    editor.waitShowHintsPopUpClosed();
}

From source file:org.eclipse.che.selenium.git.BranchTest.java

License:Open Source License

@Test(priority = 1)
public void filterBranchesTest() {
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.BRANCHES);
    String defaultFilter = "Type from keyboard to filter branches";
    git.waitBranchSearchFilerWithText(defaultFilter);
    git.typeToBranchSearchFilter("newbranch");
    git.waitBranchSearchFilerWithText("newbranch");
    git.waitBranchInTheList("newbranch");
    git.waitDisappearBranchName("master");
    git.typeToBranchSearchFilter(Keys.ESCAPE.toString());
    git.waitBranchSearchFilerWithText(defaultFilter);
    git.waitBranchInTheList("master");
    git.waitBranchInTheList("newbranch");
}

From source file:org.eclipse.che.selenium.intelligencecommand.AutocompleteCommandsEditorTest.java

License:Open Source License

@Test(priority = 2)
public void checkAutocompletePreviewUrl() {
    commandsEditor.typeTextIntoEditor(Keys.ESCAPE.toString());
    commandsEditor.setFocusIntoTypeCommandsEditor(PREVIEW_URL_EDITOR);
    commandsEditor.setCursorToLine(1);//from w w w .j a  va 2s. co m
    commandsEditor.deleteAllContent();
    commandsEditor.typeTextIntoEditor("port.80");
    commandsEditor.launchAutocompleteAndWaitContainer();
    String[] autocompleteItems = { "${server.port.8000/tcp}", "${server.port.8000}", "${server.port.8080/tcp}",
            "${server.port.8080}" };
    for (String autocompleteItem : autocompleteItems) {
        commandsEditor.waitTextIntoAutocompleteContainer(autocompleteItem);
    }
    commandsEditor.selectAutocompleteProposal("80/tcp}");
    commandsEditor.waitTextIntoDescriptionMacrosForm(
            "Returns external address of the server running on port 8080/tcp");
    commandsEditor.closeAutocomplete();
    commandsEditor.waitActiveEditor();
    commandsEditor.deleteAllContent();
    commandsEditor.typeTextIntoEditor("80.host");
    commandsEditor.launchAutocompleteAndWaitContainer();
    commandsEditor.selectItemIntoAutocompleteAndPasteByDoubleClick("${server.80");
    commandsEditor.waitTextIntoEditor("${server.8080.hostname}");
    commandsEditor.typeTextIntoEditor(Keys.ENTER.toString());
    commandsEditor.waitActiveEditor();
    commandsEditor.typeTextIntoEditor("8080.pro");
    commandsEditor.launchAutocomplete();
    commandsEditor.waitTextIntoEditor("${server.8080.protocol}");
    commandsEditor.clickOnRunButton();
    consoles.waitExpectedTextIntoConsole(BUILD_SUCCESS);
    consoles.waitExpectedTextIntoPreviewUrl("tomcat8 http");
}

From source file:org.eclipse.che.selenium.miscellaneous.WorkingWithTerminalTest.java

License:Open Source License

@Test(priority = 1)
public void shouldAppearMCDialogs() {
    terminal.typeIntoTerminal("cd ~ && touch -f testfile.txt" + Keys.ENTER);

    openMC("~");/*from  w w w .ja v a  2  s.c  o  m*/
    //check F5
    terminal.typeIntoTerminal("" + Keys.END + Keys.F5);

    terminal.waitExpectedTextIntoTerminal("Copy file \"testfile.txt\" with source mask");
    terminal.typeIntoTerminal("" + Keys.ESCAPE + Keys.ESCAPE);

    //check F6
    terminal.typeIntoTerminal(Keys.F6.toString());
    terminal.waitExpectedTextIntoTerminal("Move file \"testfile.txt\" with source mask");
    terminal.typeIntoTerminal("" + Keys.ESCAPE + Keys.ESCAPE);

    //check F7
    terminal.typeIntoTerminal(Keys.F7.toString());
    terminal.waitExpectedTextIntoTerminal("Enter directory name:");
    terminal.typeIntoTerminal("" + Keys.ESCAPE + Keys.ESCAPE);

    //check F8
    terminal.typeIntoTerminal(Keys.F8.toString());
    terminal.waitExpectedTextIntoTerminal("Delete file");
    terminal.waitExpectedTextIntoTerminal("\"testfile.txt\"?");
    terminal.typeIntoTerminal("" + Keys.ESCAPE + Keys.ESCAPE);

    //check F9 - Select menu in MC
    terminal.typeIntoTerminal("" + Keys.F9 + Keys.ENTER);
    terminal.waitExpectedTextIntoTerminal("File listing");
    terminal.typeIntoTerminal("" + Keys.ESCAPE + Keys.ESCAPE);
}

From source file:org.eclipse.che.selenium.pageobject.FindText.java

License:Open Source License

/** close main form by pressing 'Ctrl' key */
public void closeFindTextFormByEscape() {
    loader.waitOnClosed();//from   w w  w. j  a  v a2s.co m
    actionsFactory.createAction(seleniumWebDriver).sendKeys(Keys.ESCAPE.toString()).perform();
    waitFindTextMainFormIsClosed();
}