Example usage for org.openqa.selenium Keys HOME

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

Introduction

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

Prototype

Keys HOME

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

Click Source Link

Usage

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

License:Open Source License

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

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

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

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

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

License:Open Source License

@Test
public void updateDependencyWithInheritTest() {
    projectExplorer.waitProjectExplorer();
    //projectExplorer.waitItem(PROJECT_NAME);
    mavenPluginStatusBar.waitClosingInfoPanel();
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.openItemByVisibleNameInExplorer("AppController.java");
    editor.waitAllMarkersDisappear(ERROR_MARKER);
    projectExplorer.openItemByVisibleNameInExplorer(EXTENDED_CLASS + ".java");
    editor.returnFocusInCurrentLine();//from w  w  w  .j ava 2 s.c  o  m
    editor.waitMarkerInPosition(ERROR_MARKER, 13);
    editor.setCursorToLine(13);
    editor.launchPropositionAssistPanel();
    editor.waitTextIntoFixErrorProposition("Add constructor 'InheritClass(int,String)'");
    editor.selectFirstItemIntoFixErrorPropByEnter();
    editor.waitTextIntoEditor(contentAfterFix);
    editor.waitMarkerDisappears(ERROR_MARKER, 13);
    editor.waitMarkerInPosition(TASK_MARKER_OVERVIEW, 18);
    editor.waitTabFileWithSavedStatus(EXTENDED_CLASS);
    editor.selectTabByName(BASE_CLASS);
    loader.waitOnClosed();
    editor.selectLineAndDelete(24);
    editor.typeTextIntoEditor("int testString;");
    editor.typeTextIntoEditor(Keys.ARROW_DOWN.toString());
    editor.typeTextIntoEditor(Keys.ARROW_DOWN.toString());
    editor.selectLineAndDelete();
    editor.typeTextIntoEditor("public AppController(int testInt, int testString) {");
    editor.typeTextIntoEditor(Keys.DELETE.toString());
    editor.waitTabFileWithSavedStatus(BASE_CLASS);
    editor.selectTabByName(EXTENDED_CLASS);
    loader.waitOnClosed();
    editor.setCursorToLine(16);
    editor.typeTextIntoEditor(Keys.END.toString());
    editor.typeTextIntoEditor(Keys.HOME.toString());
    editor.typeTextIntoEditor(Keys.DELETE.toString());
    editor.typeTextIntoEditor("s");
    editor.launchPropositionAssistPanel();
    editor.waitTextIntoFixErrorProposition("Change type of 'testString' to 'int'");
    editor.selectFirstItemIntoFixErrorPropByDoubleClick();
    editor.waitAllMarkersDisappear(ERROR_MARKER);
}

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();/*w ww .  j  ava 2 s.c  om*/
    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();/* w ww  . j av  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.ShowHintsCommandTest.java

License:Open Source License

@Test
public void checkShowHintsCommand() {
    projectExplorer.waitProjectExplorer();
    projectExplorer.waitItem(PROJECT_NAME);
    console.closeProcessesArea();//w w  w  . j a  v  a 2 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.miscellaneous.WorkingWithTerminalTest.java

License:Open Source License

@Test(priority = 11)
public void shouldViewFolderIntoMC() {
    openMC("/");/* ww  w .j a  va  2  s .co  m*/

    //select bin folder and view this folder by "F3" key
    terminal.waitExpectedTextIntoTerminal("/bin");
    terminal.typeIntoTerminal(Keys.HOME.toString() + Keys.F3.toString());
    for (String partOfContent : VIEW_BIN_FOLDER) {
        terminal.waitExpectedTextIntoTerminal(partOfContent);
    }
    terminal.typeIntoTerminal("cd ~" + Keys.ENTER);
    terminal.waitExpectedTextIntoTerminal(".cache");
}

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

License:Open Source License

@Test(priority = 13)
public void shouldEditFileIntoMCEdit() {
    openMC("/projects/" + PROJECT_NAME);

    //check End, Home, F4, Delete keys
    terminal.typeIntoTerminal("" + Keys.END + Keys.ENTER + Keys.END + Keys.ARROW_UP + Keys.F4);
    //select editor
    terminal.typeIntoTerminal(valueOf(1) + Keys.ENTER);

    terminal.waitExpectedTextIntoTerminal(
            "README.md          " + "[----]  0 L:[  1+ 0   1/  1] *(0   /  21b) 0035 0x023");
    terminal.typeIntoTerminal("<!-some comment->");
    terminal.typeIntoTerminal(// w  w  w  .  jav a  2s. c o m
            "" + Keys.HOME + Keys.ARROW_RIGHT + Keys.ARROW_RIGHT + Keys.ARROW_RIGHT + Keys.DELETE);
    terminal.waitExpectedTextIntoTerminal("<!-ome comment->");
}

From source file:org.eclipse.che.selenium.pageobject.machineperspective.MachineTerminal.java

License:Open Source License

/**
 * scroll terminal by pressing key 'Home'
 *
 * @param item is the name of the highlighted item
 *///w  w  w . ja  v a  2  s .co  m
public void moveUpListTerminal(String item) {
    loader.waitOnClosed();
    actionsFactory.createAction(seleniumWebDriver).sendKeys(Keys.HOME.toString()).perform();
    WaitUtils.sleepQuietly(2);
    WebElement element = seleniumWebDriver
            .findElement(By.xpath(format("(//span[contains(text(), '%s')])[position()=1]", item)));
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC).until(visibilityOf(element));
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until((WebDriver input) -> element.getCssValue("background-color").equals(LINE_HIGHLIGHTED_GREEN));
}

From source file:org.eclipse.scout.rt.testing.ui.rap.RapMock.java

License:Open Source License

protected Keys toSeleniumKey(Key key) {
    switch (key) {
    case Shift://  w  w  w.  ja v  a2 s . c  o m
        return Keys.SHIFT;
    case Control:
        return Keys.CONTROL;
    case Alt:
        return Keys.ALT;
    case Delete:
        return Keys.DELETE;
    case Backspace:
        return Keys.BACK_SPACE;
    case Enter:
        return Keys.ENTER;
    case Esc:
        return Keys.ESCAPE;
    case Tab:
        return Keys.TAB;
    case ContextMenu:
        throw new IllegalArgumentException("Unknown keyboard key: " + key);
    case Up:
        return Keys.UP;
    case Down:
        return Keys.DOWN;
    case Left:
        return Keys.LEFT;
    case Right:
        return Keys.RIGHT;
    case Windows:
        return Keys.META;
    case F1:
        return Keys.F1;
    case F2:
        return Keys.F2;
    case F3:
        return Keys.F3;
    case F4:
        return Keys.F4;
    case F5:
        return Keys.F5;
    case F6:
        return Keys.F6;
    case F7:
        return Keys.F7;
    case F8:
        return Keys.F8;
    case F9:
        return Keys.F9;
    case F10:
        return Keys.F10;
    case F11:
        return Keys.F11;
    case F12:
        return Keys.F12;
    case Home:
        return Keys.HOME;
    case End:
        return Keys.END;
    case PageUp:
        return Keys.PAGE_UP;
    case PageDown:
        return Keys.PAGE_DOWN;
    case NumPad0:
        return Keys.NUMPAD0;
    case NumPad1:
        return Keys.NUMPAD1;
    case NumPad2:
        return Keys.NUMPAD2;
    case NumPad3:
        return Keys.NUMPAD3;
    case NumPad4:
        return Keys.NUMPAD4;
    case NumPad5:
        return Keys.NUMPAD5;
    case NumPad6:
        return Keys.NUMPAD6;
    case NumPad7:
        return Keys.NUMPAD7;
    case NumPad8:
        return Keys.NUMPAD8;
    case NumPadMultiply:
        return Keys.MULTIPLY;
    case NumPadDivide:
        return Keys.DIVIDE;
    case NumPadAdd:
        return Keys.ADD;
    case NumPadSubtract:
        return Keys.SUBTRACT;
    case NumPadDecimal:
        return Keys.DECIMAL;
    case NumPadSeparator:
        return Keys.SEPARATOR;
    default:
        throw new IllegalArgumentException("Unknown keyboard key: " + key);
    }
}

From source file:org.musetest.selenium.values.KeystrokesStringSourceTests.java

License:Open Source License

@Test
void testDouble() throws MuseInstantiationException, ValueSourceResolutionError {
    ValueSourceConfiguration source = ValueSourceConfiguration.forTypeWithSource(KeystrokesStringSource.TYPE_ID,
            ValueSourceConfiguration.forValue("{ESCAPE}{HOME}"));
    Object result = source.createSource(new SimpleProject()).resolveValue(new MockStepExecutionContext());
    Assertions.assertEquals(Keys.ESCAPE.toString() + Keys.HOME.toString(), result.toString());
}