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: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  v a2 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.OpenDeclarationTest.java

License:Open Source License

@Test
public void navigateToSourceTest() throws Exception {
    projectExplorer.waitItem(PROJECT_NAME);
    events.clickProjectEventsTab();//from w ww.jav a2 s.  co m
    mavenPluginStatusBar.waitClosingInfoPanel();
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.openItemByVisibleNameInExplorer("AppController.java");
    loader.waitOnClosed();
    editor.selectTabByName("AppController");
    editor.setCursorToLine(20);
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor("import sun.net.spi.nameservice.dns.DNSNameServiceDescriptor;");
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.setCursorToLine(25);
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor("DNSNameServiceDescriptor descriptor = new DNSNameServiceDescriptor();");
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor("String sdf = descriptor.getProviderName();");
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    loader.waitOnClosed();

    editor.setCursorToDefinedLineAndChar(26, 10);
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitTabIsPresent("DNSNameServiceDescriptor");
    editor.waitActiveEditor();
    editor.setCursorToLine(5);
    editor.waitTextElementsActiveLine("DNSNameServiceDescriptor");
    editor.closeFileByNameWithSaving("DNSNameServiceDescriptor");
    editor.waitTabIsNotPresent("DNSNameServiceDescriptor");
    editor.selectTabByName("AppController");
    editor.setCursorToDefinedLineAndChar(27, 39);
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitTabIsPresent("DNSNameServiceDescriptor");
    editor.setCursorToLine(11);
    editor.waitTextElementsActiveLine("getProviderName");
    editor.closeFileByNameWithSaving("DNSNameServiceDescriptor");

    // check an ability to download source
    editor.selectTabByName("AppController");
    editor.setCursorToDefinedLineAndChar(30, 12);
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitTabIsPresent("ModelAndView");
    //editor.waitTextIntoEditor(expectedTextBeforeDownloadSources);
    editor.clickOnDownloadSourcesLink();
    loader.waitOnClosed();
    //editor.waitTextIntoEditor(expectedTextAfterDownloadSources);

    editor.closeFileByNameWithSaving("ModelAndView");

    // check go to class
    editor.selectTabByName("AppController");
    editor.setCursorToDefinedLineAndChar(30, 12);
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitTabIsPresent("ModelAndView");
    editor.waitTextElementsActiveLine("ModelAndView");
    editor.waitSpecifiedValueForLineAndChar(44, 14);
    editor.closeFileByNameWithSaving("ModelAndView");

    //Check go to method
    editor.selectTabByName("AppController");
    editor.setCursorToDefinedLineAndChar(43, 16);
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitTabIsPresent("ModelAndView");
    editor.waitTextElementsActiveLine("addObject");
    editor.waitSpecifiedValueForLineAndChar(226, 22);

    //Check go to inner method
    editor.setCursorToDefinedLineAndChar(227, 9);
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitTabIsPresent("ModelAndView");
    editor.waitTextElementsActiveLine("getModelMap()");
    editor.waitSpecifiedValueForLineAndChar(203, 18);
}

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();//  w  w  w.  ja v  a2  s . c  o  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.editor.ContextMenuEditorTest.java

License:Open Source License

@Test(priority = 4)
public void checkQuickFix() {
    projectExplorer.waitItem(PROJECT_NAME_2);
    projectExplorer//  w  w w.jav a2 s  .  c  om
            .openItemByPath(PROJECT_NAME_2 + "/src/main/java/org/eclipse/qa/examples/AppController.java");
    editor.waitActiveEditor();
    editor.setCursorToLine(28);
    editor.typeTextIntoEditor("String s = 5;");
    editor.waitTextIntoEditor("String s = 5;");
    editor.waitMarkerInPosition(ERROR_MARKER, 28);
    editor.openContextMenuOnElementInEditor("5");
    editor.clickOnItemInContextMenu(QUICK_FIX);
    editor.waitContextMenuIsNotPresent();
    editor.waitTextIntoFixErrorProposition("Change type of 's' to 'int'");
    editor.selectFirstItemIntoFixErrorPropByEnter();
    editor.setCursorToLine(28);
    editor.waitTextIntoEditor("int s = 5;");
    editor.waitMarkerDisappears(ERROR_MARKER, 28);
    editor.typeTextIntoEditor(Keys.ENTER.toString());
}

From source file:org.eclipse.che.selenium.editor.ContextMenuEditorTest.java

License:Open Source License

@Test(priority = 6)
public void checkRefactoring() {
    projectExplorer.waitItem(PROJECT_NAME);
    projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/com/example/Test1.java");
    editor.setCursorToDefinedLineAndChar(13, 15);
    editor.openContextMenuOnElementInEditor("Test1");
    editor.clickOnItemInContextMenu(REFACTORING);
    editor.clickOnItemInContextMenu(REFACTORING_MOVE);
    editor.waitContextMenuIsNotPresent();
    refactor.waitMoveItemFormIsOpen();//from ww  w  .j  a va 2s. c  o  m
    refactor.clickOnExpandIconTree(PROJECT_NAME);
    loader.waitOnClosed();
    refactor.clickOnExpandIconTree("/src/main/java");
    loader.waitOnClosed();
    refactor.chooseDestinationForItem("org.eclipse.qa.examples");
    refactor.clickOkButtonRefactorForm();
    refactor.waitMoveItemFormIsClosed();
    loader.waitOnClosed();
    projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/Test1.java");
    editor.setCursorToDefinedLineAndChar(13, 15);
    editor.openContextMenuOnElementInEditor("Test1");
    editor.clickOnItemInContextMenu(REFACTORING);
    editor.clickOnItemInContextMenu(REFACTORING_RENAME);
    editor.waitContextMenuIsNotPresent();
    editor.typeTextIntoEditor("Zclass");
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    loader.waitOnClosed();
    editor.waitTextIntoEditor("public class Zclass");
    projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/Zclass.java");
}

From source file:org.eclipse.che.selenium.editor.SplitEditorFeatureTest.java

License:Open Source License

@Test
public void checkSplitEditorWindow() {
    createProject(PROJECT_NAME);/*ww  w . ja  v a  2 s . c  om*/
    projectExplorer.selectItem(PROJECT_NAME);
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.openItemByPath(PATH_JAVA_FILE);
    loader.waitOnClosed();
    editor.waitActiveEditor();
    editor.openContextMenuForTabByName(NAME_JAVA_CLASS);
    editor.runActionForTabFromContextMenu(TabAction.SPIT_HORISONTALLY);
    editor.selectTabByIndexEditorWindowAndOpenMenu(0, NAME_JAVA_CLASS);
    editor.runActionForTabFromContextMenu(TabAction.SPLIT_VERTICALLY);
    editor.selectTabByIndexEditorWindow(1, NAME_JAVA_CLASS);
    editor.waitActiveEditor();
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor(Keys.UP.toString());
    editor.typeTextIntoEditor(TEXT);
    editor.waitTextIntoEditor(TEXT);
    editor.selectTabByIndexEditorWindow(0, NAME_JAVA_CLASS);
    editor.waitActiveEditor();
    editor.waitTextIntoEditor(TEXT);
    editor.selectTabByIndexEditorWindow(2, NAME_JAVA_CLASS);
    editor.waitActiveEditor();
    editor.waitTextIntoEditor(TEXT);
    editor.selectTabByIndexEditorWindow(2, NAME_JAVA_CLASS);
    editor.waitActiveEditor();
    editor.waitTextIntoEditor(TEXT);
    editor.setCursorToLine(1);
    editor.deleteCurrentLine();
    editor.selectTabByIndexEditorWindow(0, NAME_JAVA_CLASS);
    editor.waitActiveEditor();
    editor.waitTextNotPresentIntoEditor(TEXT);
    editor.selectTabByIndexEditorWindow(1, NAME_JAVA_CLASS);
    editor.waitActiveEditor();
    editor.waitTextNotPresentIntoEditor(TEXT);
}

From source file:org.eclipse.che.selenium.factory.CreateFactoryFromUiWithKeepDirTest.java

License:Open Source License

private void checkAutocompletion() {
    editor.setCursorToDefinedLineAndChar(18, 6);
    editor.typeTextIntoEditor(Keys.END.toString());
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor("Greeting");
    editor.launchAutocompleteAndWaitContainer();
    String textFromEditorAfterFirstCall = editor.getAllVisibleTextFromAutocomplete();
    for (String content : autocompleteContentAfterFirst) {
        assertTrue(textFromEditorAfterFirstCall.contains(content));
    }//  www . ja  va  2 s .  c o  m
    editor.closeAutocomplete();
    editor.typeTextIntoEditor(" greeting =null;");
    editor.waitAllMarkersDisappear(ERROR_MARKER);
}

From source file:org.eclipse.che.selenium.filewatcher.CheckFileWatcherExcludeFeatureTest.java

License:Open Source License

@Test(priority = 1)
public void checkFileWatcherFeatureBeforeExcluding() {
    projectExplorer.openItemByVisibleNameInExplorer(FILE_NAME_FOR_EXCLUDE);
    editor.waitActiveEditor();//  w  ww.  j  a va 2  s  .c  o  m

    terminal.selectTerminalTab();
    terminal.waitTerminalConsole();
    terminal.waitTerminalIsNotEmpty();
    terminal.typeIntoTerminal("cd /projects/" + PROJECT_NAME + Keys.ENTER);
    terminal.waitExpectedTextIntoTerminal("/projects/" + PROJECT_NAME);
    terminal.typeIntoTerminal("df > " + FILE_NAME_FOR_EXCLUDE + Keys.ENTER);

    editor.selectTabByName(FILE_NAME_FOR_EXCLUDE);
    editor.waitTextIntoEditor("Filesystem");
}

From source file:org.eclipse.che.selenium.filewatcher.CheckFileWatcherExcludeFeatureTest.java

License:Open Source License

@Test(priority = 2)
public void checkFileInEditorAfterExluding() {
    doFileWatcherExcludeOperation(PATH_FOR_EXCLUDED_FILE,
            ProjectExplorer.FileWatcherExcludeOperations.ADD_TO_FILE_WATCHER_EXCLUDES);
    editor.selectTabByName(FILE_WATCHER_IGNORE_FILE_NAME);
    editor.waitTextIntoEditor(FILE_NAME_FOR_EXCLUDE);

    terminal.selectTerminalTab();//from   w  w w  . j a  v  a 2  s  .  com
    terminal.waitTerminalConsole();
    terminal.waitTerminalIsNotEmpty();
    terminal.typeIntoTerminal("cd /projects/" + PROJECT_NAME + Keys.ENTER);
    terminal.waitExpectedTextIntoTerminal("/projects/" + PROJECT_NAME);
    terminal.typeIntoTerminal("pwd > " + FILE_NAME_FOR_EXCLUDE + Keys.ENTER);

    editor.selectTabByName(FILE_NAME_FOR_EXCLUDE);
    editor.waitTextNotPresentIntoEditor("/projects/" + PROJECT_NAME);
    editor.clickOnCloseFileIcon(FILE_NAME_FOR_EXCLUDE);
    projectExplorer.openItemByVisibleNameInExplorer(FILE_NAME_FOR_EXCLUDE);
    editor.waitActiveEditor();
    editor.waitTextIntoEditor("/projects/" + PROJECT_NAME);

    doFileWatcherExcludeOperation(PATH_FOR_EXCLUDED_FILE,
            ProjectExplorer.FileWatcherExcludeOperations.REMOVE_FROM_FILE_WATCHER_EXCLUDES);
    editor.selectTabByName(FILE_WATCHER_IGNORE_FILE_NAME);
    editor.waitTextNotPresentIntoEditor(FILE_NAME_FOR_EXCLUDE);
}

From source file:org.eclipse.che.selenium.filewatcher.CheckFileWatcherExcludeFeatureTest.java

License:Open Source License

@Test(priority = 3)
public void checkFeatureAfterExcludingFolder() {
    doFileWatcherExcludeOperation(PROJECT_NAME + "/" + FOLDER_NAME_FOR_EXCLUDE,
            ProjectExplorer.FileWatcherExcludeOperations.ADD_TO_FILE_WATCHER_EXCLUDES);
    projectExplorer.openItemByVisibleNameInExplorer("AppController.java");
    editor.waitActiveEditor();/*from   w ww  . jav  a  2 s .  c  o  m*/

    terminal.selectTerminalTab();
    terminal.waitTerminalConsole();
    terminal.waitTerminalIsNotEmpty();
    terminal.typeIntoTerminal(
            "cd /projects/" + PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples" + Keys.ENTER);
    terminal.waitExpectedTextIntoTerminal(
            "/projects/" + PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples");
    terminal.typeIntoTerminal("pwd > " + "AppController.java" + Keys.ENTER);

    editor.selectTabByName("AppController");
    editor.waitTextNotPresentIntoEditor("/projects/" + PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples");
    editor.clickOnCloseFileIcon("AppController");
    projectExplorer.openItemByVisibleNameInExplorer("AppController.java");
    editor.waitActiveEditor();
    editor.waitTextIntoEditor("/projects/" + PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples");
    doFileWatcherExcludeOperation(PROJECT_NAME + "/" + FOLDER_NAME_FOR_EXCLUDE,
            ProjectExplorer.FileWatcherExcludeOperations.REMOVE_FROM_FILE_WATCHER_EXCLUDES);
}