Example usage for org.openqa.selenium Keys END

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

Introduction

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

Prototype

Keys END

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

Click Source Link

Usage

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

License:Open Source License

@Test
public void testShouldReturnSameCharSequence() throws Exception {
    GenericActions actions = new GenericActions(webDriver);

    final CharSequence[] charSequences = actions.modifyCharSequence(Keys.END, Keys.HOME, Keys.PAGE_DOWN,
            Keys.PAGE_UP);/* www. j  a  v a2  s .c  o  m*/

    assertNotNull(charSequences);
    assertEquals(charSequences.length, 4);

    assertEquals(charSequences[0], Keys.END);
    assertEquals(charSequences[1], Keys.HOME);
    assertEquals(charSequences[2], Keys.PAGE_DOWN);
    assertEquals(charSequences[3], Keys.PAGE_UP);
}

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

License:Open Source License

@Override
protected CharSequence[] modifyCharSequence(CharSequence... keysToSend) {
    final List<CharSequence> modKeysToSend = newArrayList();

    for (CharSequence charSequence : keysToSend) {
        final String key = charSequence.toString();

        if (Keys.END.toString().equals(key)) {
            modKeysToSend.add(Keys.chord(Keys.COMMAND, Keys.RIGHT));
        } else if (Keys.HOME.toString().equals(key)) {
            modKeysToSend.add(Keys.chord(Keys.COMMAND, Keys.LEFT));
        } else if (Keys.PAGE_UP.toString().equals(key)) {
            modKeysToSend.add(Keys.chord(Keys.COMMAND, Keys.UP));
        } else if (Keys.PAGE_DOWN.toString().equals(key)) {
            modKeysToSend.add(Keys.chord(Keys.COMMAND, Keys.DOWN));
        } else {/*from   w w  w .ja  v a  2s .c o  m*/
            modKeysToSend.add(charSequence);
        }
    }

    return modKeysToSend.toArray(new CharSequence[modKeysToSend.size()]);
}

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

License:Open Source License

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

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

    assertNotNull(charSequences);/*  ww w. jav a2s  .com*/
    assertEquals(charSequences.length, 2);

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

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

License:Open Source License

@Test
public void createJavaSpringProjectAndTestEditor() {
    projectExplorer.waitProjectExplorer();
    projectExplorer.waitItem(PROJECT_NAME);
    notificationsPopupPanel.waitProgressPopupPanelClose();
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.openItemByVisibleNameInExplorer("AppController.java");
    loader.waitOnClosed();//from  w w w .j  a  v a  2 s.c o m
    reparseEditorCode();
    editor.setCursorToLine(37);
    editor.typeTextIntoEditor(Keys.END.toString());
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.launchAutocompleteAndWaitContainer();
    String textFromEditorAfterFirstCall = editor.getAllVisibleTextFromAutocomplete();
    for (String content : autocompleteContentAfterFirst) {
        assertTrue(textFromEditorAfterFirstCall.contains(content));
    }

    editor.enterAutocompleteProposal("result : String");
    projectExplorer.openItemByVisibleNameInExplorer("AppController.java");
    editor.waitTextIntoEditor("result");
    editor.typeTextIntoEditor(".");
    editor.launchAutocompleteAndWaitContainer();
    String textFromEditorAfterSecondCall = editor.getAllVisibleTextFromAutocomplete();
    for (String content : autocompleteContentAfterSecond) {
        assertTrue(textFromEditorAfterSecondCall.contains(content));
    }
    editor.enterAutocompleteProposal("getBytes() : byte[]");
    editor.typeTextIntoEditor(".");
    editor.launchAutocompleteAndWaitContainer();
    editor.enterAutocompleteProposal("toString() : String");
    editor.typeTextIntoEditor(";");
    consoles.closeProcessesArea();
    editor.waitTextIntoEditor(contentAfterEditing);
    editor.waitTabFileWithSavedStatus("AppController");
}

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

License:Open Source License

private void reparseEditorCode() {
    editor.setCursorToLine(36);/*w w  w  . j  a v a 2 s  .  co  m*/
    editor.typeTextIntoEditor("a");
    editor.waitMarkerInPosition(ERROR_MARKER, 36);
    editor.typeTextIntoEditor(Keys.END.toString());
    editor.typeTextIntoEditor(Keys.BACK_SPACE.toString());
    editor.waitMarkerDisappears(ERROR_MARKER, 36);
}

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

License:Open Source License

@Test
public void checkAutocompleteJSFilesTest() {
    projectExplorer.waitItem(PROJECT_NAME);
    projectExplorer.openItemByPath(PROJECT_NAME);
    notificationsPopupPanel.waitProgressPopupPanelClose();
    projectExplorer.waitProjectExplorer();
    projectExplorer.quickExpandWithJavaScript();
    menu.runCommand(TestMenuCommandsConstants.Project.PROJECT, TestMenuCommandsConstants.Project.New.NEW,
            TestMenuCommandsConstants.Project.New.JAVASCRIPT_FILE);
    askForValueDialog.typeAndWaitText("newJsFile");
    askForValueDialog.clickOkBtn();//from  w  w  w .j a  va  2  s .  co m
    loader.waitOnClosed();
    projectExplorer.waitItemInVisibleArea("newJsFile.js");

    editor.waitActiveEditor();
    loader.waitOnClosed();
    editor.setCursorToLine(1);

    editor.typeTextIntoEditorWithoutDelayForSaving("function a (");
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving("{");
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving("var b = 5;");
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving("var c = ");

    editor.launchPropositionAssistPanelForJSFiles();
    editor.enterTextIntoFixErrorPropByEnterForJsFiles("b", " : number");

    editor.typeTextIntoEditorWithoutDelayForSaving(";");
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving("return c;");
    editor.setCursorToLine(5);
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());

    editor.launchPropositionAssistPanelForJSFiles();
    editor.enterTextIntoFixErrorPropByEnterForJsFiles("a()", " : number");

    editor.typeTextIntoEditorWithoutDelayForSaving(";");
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving("/**");
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());

    Assert.assertEquals(editor.getVisibleTextFromEditor(), EXPECTED_TEXT);

    editor.setCursorToLine(9);
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving("function f (");
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving("{");
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving("return 'test text';");
    editor.setCursorToLine(12);
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());

    editor.launchPropositionAssistPanelForJSFiles();
    editor.enterTextIntoFixErrorPropByEnterForJsFiles("f()", " : string");
    editor.typeTextIntoEditorWithoutDelayForSaving(";");

    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString());

    editor.setCursorToLine(11);
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString());
    editor.typeTextIntoEditorWithoutDelayForSaving(Keys.BACK_SPACE.toString());

    editor.waitMarkerInPositionAndClick(INFO_MARKER, 11);
    editor.clickOnElementByXpath("//button[text()='Add missing semicolon']");

    editor.waitAllMarkersDisappear(INFO_MARKER);
    loader.waitOnClosed();
}

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  ww  w . j  a v a  2 s  . com*/
    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();//from www .  ja v  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.InheritClassTest.java

License:Open Source License

@Test
public void autoCompleteClassInTheSamePackage() {
    //create java class in the same package with GreetingController.java
    projectExplorer.waitProjectExplorer();
    projectExplorer.waitItem(PROJECT_NAME);
    notificationsPopupPanel.waitProgressPopupPanelClose();
    loader.waitOnClosed();// www .  java 2  s  . c  om
    projectExplorer.quickExpandWithJavaScript();
    loader.waitOnClosed();
    projectExplorer.openItemByPath(COMMON_PACKAGE + "/AppController.java");

    //create java class in the different package with GreetingController.java
    projectExplorer.waitProjectExplorer();
    projectExplorer.selectItem(COMMON_PACKAGE);
    menu.runCommand(TestMenuCommandsConstants.Project.PROJECT, TestMenuCommandsConstants.Project.New.NEW,
            TestMenuCommandsConstants.Project.New.JAVA_CLASS);
    askForValueDialog.createJavaFileByNameAndType("CodenvyTest", AskForValueDialog.JavaFiles.CLASS);
    editor.waitTabIsPresent("CodenvyTest");
    loader.waitOnClosed();

    projectExplorer.selectItem(COMMON_PACKAGE);
    menu.runCommand(TestMenuCommandsConstants.Project.PROJECT, TestMenuCommandsConstants.Project.New.NEW,
            TestMenuCommandsConstants.Project.New.JAVA_CLASS);
    askForValueDialog.createJavaFileByNameAndType("CodenvyTestInherite", AskForValueDialog.JavaFiles.CLASS);
    editor.waitTabIsPresent("CodenvyTestInherite");
    loader.waitOnClosed();

    editor.waitActiveEditor();
    editor.setCursorToLine(3);
    editor.typeTextIntoEditor(Keys.END.toString());
    editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString());
    editor.typeTextIntoEditor("ex");
    loader.waitOnClosed();
    editor.launchAutocomplete();
    editor.waitAutocompleteContainerIsClosed();
    editor.waitTextIntoEditor("extends");
    editor.typeTextIntoEditor(" Code");
    loader.waitOnClosed();
    editor.launchAutocompleteAndWaitContainer();
    editor.waitTextIntoAutocompleteContainer("CodenvyTest - org.eclipse.qa.examples");
    editor.enterAutocompleteProposal("CodenvyTest");
    editor.waitAutocompleteContainerIsClosed();
    editor.waitTextIntoEditor("CodenvyTestInherite extends CodenvyTest");
    loader.waitOnClosed();
    editor.waitActiveEditor();

    editor.selectTabByName("AppController");
    editor.waitActiveEditor();
    editor.setCursorToLine(32);
    editor.typeTextIntoEditor("Code");
    editor.launchAutocompleteAndWaitContainer();
    editor.waitTextIntoAutocompleteContainer("CodenvyTest - org.eclipse.qa.examples");
    editor.waitTextIntoAutocompleteContainer("CodenvyTestInherite - org.eclipse.qa.examples");
    editor.enterAutocompleteProposal("CodenvyTest");
    editor.waitAutocompleteContainerIsClosed();

    editor.waitTextIntoEditor("CodenvyTest");
    editor.typeTextIntoEditor(" codenvyTest = n");
    editor.launchAutocompleteAndWaitContainer();
    editor.waitAutocompleteContainer();
    editor.waitTextIntoAutocompleteContainer("new");
    editor.typeTextIntoEditor(Keys.ENTER.toString());

    editor.typeTextIntoEditor(" Code");
    editor.waitCodeAssistMarkers(ERROR_MARKER);
    editor.launchAutocompleteAndWaitContainer();
    editor.waitTextIntoAutocompleteContainer("CodenvyTest - org.eclipse.qa.examples");
    editor.waitTextIntoAutocompleteContainer("CodenvyTestInherite - org.eclipse.qa.examples");
    editor.enterAutocompleteProposal("CodenvyTestInherite");
    editor.waitAutocompleteContainerIsClosed();
    editor.typeTextIntoEditor(";");
    editor.waitTextIntoEditor("CodenvyTest codenvyTest = numGuessByUser CodenvyTestInherite;        \n");
}

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();/*from   w  w  w . 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);
}