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.miscellaneous.FindUsagesBaseOperationTest.java

License:Open Source License

@Test
public void checkFindUsagesBaseOperation() {
    projectExplorer.waitProjectExplorer();
    projectExplorer.waitItem(PROJECT_NAME);
    projectExplorer.expandPathInProjectExplorerAndOpenFile(PATH_FOR_EXPAND, "AppController.java");

    // Check basic operations of the 'find usages' panel
    editor.selectTabByName("AppController");
    editor.setCursorToDefinedLineAndChar(26, 17);
    menu.runCommand(TestMenuCommandsConstants.Assistant.ASSISTANT,
            TestMenuCommandsConstants.Assistant.FIND_USAGES);
    loader.waitOnClosed();//w w w .  j ava2s  .c  o  m
    findUsages.waitFindUsagesPanelIsOpen();
    findUsages.clickFindUsagesTab();
    findUsages.waitFindUsegesPanelIsClosed();
    findUsages.clickFindUsagesTab();
    findUsages.waitFindUsagesPanelIsOpen();
    findUsages.waitExpectedTextInFindUsagesPanel(EXPECTED_TEXT);
    findUsages.waitSelectedElementInFindUsagesPanel("numGuessByUser");

    // Check nodes in the 'find usages' panel by 'double click' and click on the icon node
    findUsages.clickOnIconNodeInFindUsagesPanel(PROJECT_NAME);
    findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_1);
    findUsages.selectNodeInFindUsagesByDoubleClick(PROJECT_NAME);
    findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_1);
    findUsages.selectNodeInFindUsagesByDoubleClick("org.eclipse.qa.examples");
    findUsages.selectNodeInFindUsagesByDoubleClick("AppController");
    findUsages.selectNodeInFindUsagesByDoubleClick("handleRequest(HttpServletRequest, HttpServletResponse)");
    findUsages.waitExpectedTextInFindUsagesPanel(EXPECTED_TEXT_1);
    findUsages.selectNodeInFindUsagesByDoubleClick("AppController");
    findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_2);
    findUsages.clickOnIconNodeInFindUsagesPanel("AppController");
    findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_2);
    findUsages.clickOnIconNodeInFindUsagesPanel("handleRequest(HttpServletRequest, HttpServletResponse)");
    findUsages.waitExpectedTextInFindUsagesPanel(EXPECTED_TEXT_2);

    // Check nodes in the 'find usages' panel by 'Enter'
    findUsages.selectNodeInFindUsagesPanel(PROJECT_NAME);
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ENTER.toString());
    findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_1);
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ENTER.toString());
    findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_1);
    findUsages.selectNodeInFindUsagesPanel("org.eclipse.qa.examples");
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ENTER.toString());
    findUsages.selectNodeInFindUsagesPanel("AppController");
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ENTER.toString());
    findUsages.selectNodeInFindUsagesPanel("handleRequest(HttpServletRequest, HttpServletResponse)");
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ENTER.toString());
    findUsages.waitExpectedTextInFindUsagesPanel(EXPECTED_TEXT_1);
    findUsages.selectNodeInFindUsagesPanel("AppController");
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ENTER.toString());
    findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_2);
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ENTER.toString());
    findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_2);
    findUsages.selectNodeInFindUsagesPanel("handleRequest(HttpServletRequest, HttpServletResponse)");
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ENTER.toString());
    findUsages.waitExpectedTextInFindUsagesPanel(EXPECTED_TEXT_2);

    // Check nodes in the 'find usages' panel by keyboard
    findUsages.selectNodeInFindUsagesPanel("handleRequest(HttpServletRequest, HttpServletResponse)");
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ARROW_LEFT.toString());
    findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_2);
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ARROW_RIGHT.toString());
    findUsages.waitExpectedTextInFindUsagesPanel(EXPECTED_TEXT_2);
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ARROW_UP.toString());
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ARROW_UP.toString());
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ARROW_UP.toString());
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ARROW_LEFT.toString());
    findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_1);
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ARROW_RIGHT.toString());
    findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_1);
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ARROW_DOWN.toString());
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ARROW_RIGHT.toString());
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ARROW_DOWN.toString());
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ARROW_RIGHT.toString());
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ARROW_DOWN.toString());
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ARROW_RIGHT.toString());
    findUsages.waitExpectedTextInFindUsagesPanel(EXPECTED_TEXT_2);
    findUsages.waitExpectedTextInFindUsagesPanel(EXPECTED_TEXT_1);

    // Check the found items in the editor
    findUsages.selectHighlightedItemInFindUsagesByDoubleClick(29);
    editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString());
    editor.expectedNumberOfActiveLine(29);
    editor.waitTextElementsActiveLine("numGuessByUser");
    findUsages.selectNodeInFindUsagesPanel("handleRequest(HttpServletRequest, HttpServletResponse)");
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ARROW_DOWN.toString());
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ARROW_DOWN.toString());
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ARROW_DOWN.toString());
    findUsages.sendCommandByKeyboardInFindUsagespanel(Keys.ENTER.toString());
    editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString());
    editor.expectedNumberOfActiveLine(33);
    editor.waitTextElementsActiveLine("numGuessByUser");
}

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

License:Open Source License

@Test
public void checkImplementationInEditor() {
    projectExplorer.waitProjectExplorer();
    projectExplorer.openItemByPath(PROJECT_NAME);
    expandTReeProjectAndOpenClass(JAVA_FILE_NAME);

    // check that the 'Implementation' container is not present
    editor.setCursorToLine(12);/*from  w  w  w  .  j  a  va2 s  .c o m*/
    menu.runCommand(TestMenuCommandsConstants.Assistant.ASSISTANT,
            TestMenuCommandsConstants.Assistant.IMPLEMENTATION_S);
    editor.waitImplementationFormIsClosed(JAVA_FILE_NAME);

    // check the 'implementation' for simple java class
    editor.setCursorToLine(20);
    editor.clickOnSelectedElementInEditor(JAVA_FILE_NAME);
    menu.runCommand(TestMenuCommandsConstants.Assistant.ASSISTANT,
            TestMenuCommandsConstants.Assistant.IMPLEMENTATION_S);
    editor.waitImplementationFormIsOpen(JAVA_FILE_NAME);
    editor.cancelFormInEditorByEscape();
    editor.waitImplementationFormIsClosed(JAVA_FILE_NAME);
    editor.setCursorToLine(20);
    editor.clickOnSelectedElementInEditor(JAVA_FILE_NAME);
    editor.launchImplementationFormByKeyboard();
    editor.waitImplementationFormIsOpen(JAVA_FILE_NAME);
    editor.waitTextInImplementationForm(NO_FOUND_TEXT);

    // check the 'implementation' for abstract class
    projectExplorer.openItemByVisibleNameInExplorer(ABSTRACT_CLASS_NAME + ".java");
    editor.setCursorToDefinedLineAndChar(15, 25);
    editor.waitActiveEditor();
    editor.waitTextElementsActiveLine("Empl");
    editor.launchImplementationFormByKeyboard();
    editor.waitActiveTabFileName("EmployeeFixedSalary");
    editor.expectedNumberOfActiveLine(13);
    editor.waitTextElementsActiveLine("EmployeeFixedSalary extends Empl");
    editor.clickOnCloseFileIcon("EmployeeFixedSalary");
    editor.waitActiveTabFileName(ABSTRACT_CLASS_NAME);
    editor.selectTabByName(ABSTRACT_CLASS_NAME);
    editor.setCursorToLine(22);
    editor.clickOnSelectedElementInEditor("toString");
    menu.runCommand(TestMenuCommandsConstants.Assistant.ASSISTANT,
            TestMenuCommandsConstants.Assistant.IMPLEMENTATION_S);
    editor.waitActiveTabFileName("EmployeeFixedSalary");
    editor.expectedNumberOfActiveLine(38);
    editor.waitTextElementsActiveLine("toString");

    // check the 'implementations' for interface
    projectExplorer.openItemByVisibleNameInExplorer(INTERFACE_NAME + ".java");
    editor.setCursorToDefinedLineAndChar(15, 20);
    editor.waitTextElementsActiveLine("Employee");
    editor.launchImplementationFormByKeyboard();
    editor.waitActiveTabFileName("EmployeeHourlyWages");
    editor.expectedNumberOfActiveLine(14);
    editor.waitTextElementsActiveLine("EmployeeHourlyWages implements Employee");
    editor.clickOnCloseFileIcon("EmployeeHourlyWages");
    editor.waitActiveTabFileName(INTERFACE_NAME);
    editor.selectTabByName(INTERFACE_NAME);
    editor.setCursorToLine(18);
    editor.clickOnSelectedElementInEditor("toString");
    menu.runCommand(TestMenuCommandsConstants.Assistant.ASSISTANT,
            TestMenuCommandsConstants.Assistant.IMPLEMENTATION_S);
    editor.waitActiveTabFileName("EmployeeHourlyWages");
    editor.expectedNumberOfActiveLine(58);
    editor.waitTextElementsActiveLine("toString");
    editor.selectTabByName(INTERFACE_NAME);
    editor.setCursorToLine(15);
    editor.waitTextElementsActiveLine("interface Employee extends Serializable");
    editor.clickOnSelectedElementInEditor("Serializable");
    menu.runCommand(TestMenuCommandsConstants.Assistant.ASSISTANT,
            TestMenuCommandsConstants.Assistant.IMPLEMENTATION_S);
    editor.waitImplementationFormIsOpen("Serializable");
    editor.waitTextInImplementationForm(LIST_IMPLEMENTATIONS);
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.waitImplementationFormIsClosed("Serializable");
    editor.waitActiveTabFileName(ABSTRACT_CLASS_NAME);
    editor.setCursorToLine(15);
    editor.waitTextElementsActiveLine("class Empl implements Serializable");
    editor.selectTabByName(INTERFACE_NAME);
    editor.launchImplementationFormByKeyboard();
    editor.waitImplementationFormIsOpen("Serializable");
    editor.waitTextInImplementationForm(LIST_IMPLEMENTATIONS);
    editor.selectImplementationByClick("EmployeeHourlyWages");
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.waitImplementationFormIsClosed("Serializable");
    editor.waitActiveTabFileName("EmployeeHourlyWages");
    editor.selectTabByName(INTERFACE_NAME);
    menu.runCommand(TestMenuCommandsConstants.Assistant.ASSISTANT,
            TestMenuCommandsConstants.Assistant.IMPLEMENTATION_S);
    editor.waitImplementationFormIsOpen("Serializable");
    editor.waitTextInImplementationForm(LIST_IMPLEMENTATIONS);
    editor.chooseImplementationByDoubleClick("EmployeeFixedSalary");
    editor.waitImplementationFormIsClosed("Serializable");
    editor.waitActiveTabFileName("EmployeeFixedSalary");
}

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

License:Open Source License

private void createFileInTerminal(String projectName, String fileName) {
    terminal.typeIntoTerminal("cd " + projectName + Keys.ENTER);
    terminal.typeIntoTerminal("ls -als > " + fileName + Keys.ENTER);
    terminal.typeIntoTerminal("cat " + fileName + Keys.ENTER);
    terminal.typeIntoTerminal("ls" + Keys.ENTER);
    terminal.waitExpectedTextIntoTerminal(fileName);
}

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

License:Open Source License

@Test(priority = 1)
public void checkTerminalAndBuild() {
    // make build, open terminal and check tabs
    multiSplitPanel.selectSplitPanel(3);
    commandsBuilder(TestIntelligentCommandsConstants.CommandsGoals.COMMON_GOAL,
            TestIntelligentCommandsConstants.CommandsTypes.MAVEN_TYPE);
    projectExplorer.invokeCommandWithContextMenu(ProjectExplorer.CommandsGoal.COMMON, PROJECT_NAME, BUILD_COMM);
    consoles.waitExpectedTextIntoConsole(TestBuildConstants.BUILD_SUCCESS, 120);
    multiSplitPanel.waitTabProcessIsPresent(3, BUILD_COMM);
    multiSplitPanel.selectSplitPanel(1);
    projectExplorer.invokeCommandWithContextMenu(ProjectExplorer.CommandsGoal.COMMON, PROJECT_NAME, BUILD_COMM);
    consoles.waitExpectedTextIntoConsole(TestBuildConstants.BUILD_SUCCESS, 120);
    multiSplitPanel.waitTabProcessIsPresent(1, BUILD_COMM);
    multiSplitPanel.waitTabNameProcessIsFocused(BUILD_COMM);
    multiSplitPanel.waitTabProcessIsNotPresent(3, BUILD_COMM);
    consoles.openNewTerminalIntoProcesses();
    multiSplitPanel.waitTabProcessIsPresent(1, "Terminal-2");
    multiSplitPanel.waitTabNameProcessIsFocused("Terminal-2");
    terminal.waitTerminalIsNotEmpty();//from w  ww  .  ja  va2 s.com
    loader.waitOnClosed();
    terminal.typeIntoTerminal("mc");
    terminal.typeIntoTerminal(Keys.ENTER.toString());
    terminal.waitTerminalIsNotEmpty();
    loader.waitOnClosed();
    for (String partOfContent : checkMcTerminal) {
        terminal.waitExpectedTextIntoTerminal(partOfContent);
    }
}

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

License:Open Source License

@Test(priority = 0)
public void shouldLaunchCommandWithBigOutput() {
    // build the web java application
    projectExplorer.waitProjectExplorer();
    loader.waitOnClosed();/*  ww w  . ja v a 2 s  . co  m*/
    projectExplorer.waitItem(PROJECT_NAME);
    terminal.waitTerminalConsole(1);
    terminal.typeIntoTerminal("cd /projects/" + PROJECT_NAME + Keys.ENTER);
    terminal.waitExpectedTextIntoTerminal("/projects/" + PROJECT_NAME);
    terminal.typeIntoTerminal("mvn clean install" + Keys.ENTER);
    terminal.waitExpectedTextIntoTerminal(TestBuildConstants.BUILD_SUCCESS,
            TestTimeoutsConstants.EXPECTED_MESS_IN_CONSOLE_SEC);
    terminal.waitExpectedTextIntoTerminal(MESS_IN_CONSOLE);

    // check the target folder
    projectExplorer.openItemByPath(PROJECT_NAME);
    projectExplorer.openItemByPath(PROJECT_NAME + "/target");
    projectExplorer.waitItem(PROJECT_NAME + "/target/" + WAR_NAME);
}

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  ww .  j  a  v  a  2s .  c  om
    //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.miscellaneous.WorkingWithTerminalTest.java

License:Open Source License

@Test(priority = 4)
public void shouldNavigateToMC() {
    openMC("/");/*from www .j a va2s  . c  om*/

    //navigate to midnight commander tree
    consoles.selectProcessByTabName("Terminal");
    terminal.typeIntoTerminal(Keys.ARROW_DOWN.toString());
    terminal.typeIntoTerminal(Keys.ARROW_DOWN.toString());
    terminal.typeIntoTerminal(Keys.ARROW_DOWN.toString());
    terminal.typeIntoTerminal(Keys.ARROW_DOWN.toString());
    terminal.typeIntoTerminal(Keys.ENTER.toString());
    terminal.typeIntoTerminal(Keys.ARROW_DOWN.toString());
    terminal.typeIntoTerminal(Keys.ENTER.toString());

    // check the home content of the midnight commander
    for (String partOfContent : CHECK_MC_OPENING) {
        terminal.waitExpectedTextIntoTerminal(partOfContent);
    }
    terminal.typeIntoTerminal(Keys.F10.toString());
}

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

License:Open Source License

@Test(priority = 5)
public void shouldCreateFileTest() {
    terminal.typeIntoTerminal("cd ~" + Keys.ENTER);
    terminal.typeIntoTerminal("ls" + Keys.ENTER);
    terminal.waitTerminalIsNotEmpty();//from  ww  w . j  a v  a2s  .  c om
    terminal.waitExpectedTextIntoTerminal("apache-maven-3.3.9");
    terminal.typeIntoTerminal("touch testfile0.txt" + Keys.ENTER);

    terminal.typeIntoTerminal("ls" + Keys.ENTER);
    terminal.waitExpectedTextIntoTerminal("apache-maven-3.3.9");
    terminal.waitExpectedTextIntoTerminal("che");
    terminal.waitExpectedTextIntoTerminal("testfile0.txt");
    terminal.waitExpectedTextIntoTerminal("tomcat8");
}

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

License:Open Source License

@Test(priority = 6)
public void shouldCancelProcessByCtrlC() throws InterruptedException {
    terminal.typeIntoTerminal("cd /" + Keys.ENTER);

    // launch bash script
    terminal.typeIntoTerminal(BASH_SCRIPT + Keys.ENTER);
    terminal.waitExpectedTextIntoTerminal("test=1");

    //cancel script
    terminal.typeIntoTerminal(Keys.CONTROL + "c");

    // wait 1 sec. If process was really stopped we should not get text "test=2"
    Thread.sleep(1000);//  w  w  w .j a  va  2  s .  c  o  m
    terminal.waitExpectedTextNotPresentTerminal("test=2");
}

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

License:Open Source License

@Test(priority = 7)
public void shouldBeClear() {
    terminal.typeIntoTerminal("cd / && ls -l" + Keys.ENTER);

    //clear terminal
    terminal.typeIntoTerminal("clear" + Keys.ENTER);
    terminal.waitExpectedTextNotPresentTerminal("clear");

    terminal.waitTerminalIsNotEmpty();// ww  w. j  a va 2 s .co  m
    String terminalContent = terminal.getVisibleTextFromTerminal().trim();
    assertTrue(terminalContent.matches("^(user@)[a-z0-9]{12}(:/\\$)$"));
}