Example usage for org.openqa.selenium Keys PAGE_DOWN

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

Introduction

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

Prototype

Keys PAGE_DOWN

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

Click Source Link

Usage

From source file:org.auraframework.components.ui.inputDate.BaseInputDateUITester.java

License:Apache License

@ExcludeBrowsers({ BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPAD,
        BrowserType.IPHONE })//from  ww w . j a  v  a2s  . c  o m
public void testPageUpDownMonth() throws Exception {
    DateFormat formatter = new SimpleDateFormat(DATE_FORMAT_STR);
    open(URL);

    // Calendar used to get current date
    GregorianCalendar cal = new GregorianCalendar();

    // Running test, Decreasing month
    String result = pageUpDownHelper(4, "" + Keys.PAGE_UP);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.MONTH, -4);
    String fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());
    assertEquals("Page up id not find the correct date", fmt, result);

    // Resetting calendar
    cal = new GregorianCalendar();

    // Running Test, increasing month
    result = pageUpDownHelper(10, "" + Keys.PAGE_DOWN);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.MONTH, 10);
    fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());

    // Making sure test result and true calendar outcome match
    assertEquals("Page down id not find the correct date", fmt, result);
}

From source file:org.auraframework.components.ui.inputDate.InputDateWithLabelUITest.java

License:Apache License

@ExcludeBrowsers({ BrowserType.IE7, BrowserType.IE9, BrowserType.IE10, BrowserType.ANDROID_PHONE,
        BrowserType.ANDROID_TABLET, BrowserType.IPAD, BrowserType.IPHONE })
public void testPageUpDownYear() throws Exception {
    DateFormat formatter = new SimpleDateFormat(DATE_FORMAT_STR);
    open(URL);//ww  w .j av a2  s  .c om
    // Calendar used to get current date
    GregorianCalendar cal = new GregorianCalendar();
    // Running test, Increasing year
    String result = pageUpDownHelper(10, Keys.SHIFT + "" + Keys.PAGE_UP);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.YEAR, -10);

    // Formatting date to match out of test
    String fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());

    // Making sure test result and true calendar outcome match
    assertEquals("Shift + Page up did not go to the correct date", fmt, result);

    // Resetting calendar
    cal = new GregorianCalendar();

    // Running test, decreasing month
    result = pageUpDownHelper(15, Keys.SHIFT + "" + Keys.PAGE_DOWN);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.YEAR, 15);
    fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());

    // Making sure test result and true calendar outcome match
    assertEquals("shift + Page Down did not find the correct date", fmt, result);
}

From source file:org.auraframework.integration.test.components.ui.inputDate.InputDateWithLabelUITest.java

License:Apache License

@ExcludeBrowsers({ BrowserType.IE7, BrowserType.IE9, BrowserType.IE10, BrowserType.IE11,
        BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPAD, BrowserType.IPHONE })
@Test//from   w ww .j  a  va  2 s.  com
public void testPageUpDownYear() throws Exception {
    DateFormat formatter = new SimpleDateFormat(DATE_FORMAT_STR);
    open(URL);
    // Calendar used to get current date
    GregorianCalendar cal = new GregorianCalendar();
    // Running test, Increasing year
    String result = pageUpDownHelper(10, Keys.SHIFT + "" + Keys.PAGE_UP);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.YEAR, -10);

    // Formatting date to match out of test
    String fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());

    // Making sure test result and true calendar outcome match
    assertEquals("Shift + Page up did not go to the correct date", fmt, result.trim());

    // Resetting calendar
    cal = new GregorianCalendar();

    // Running test, decreasing month
    result = pageUpDownHelper(15, Keys.SHIFT + "" + Keys.PAGE_DOWN);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.YEAR, 15);
    fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());

    // Making sure test result and true calendar outcome match
    assertEquals("shift + Page Down did not find the correct date", fmt, result.trim());
}

From source file:org.auraframework.integration.test.components.ui.inputDate.InputDateWithLabelUITest.java

License:Apache License

@ExcludeBrowsers({ BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPAD,
        BrowserType.IPHONE })/*from w  w w .ja  va2 s  .c om*/
public void _testPageUpDownMonth() throws Exception {
    DateFormat formatter = new SimpleDateFormat(DATE_FORMAT_STR);
    open(URL);

    // Calendar used to get current date
    GregorianCalendar cal = new GregorianCalendar();

    // Running test, Decreasing month
    String result = pageUpDownHelper(4, "" + Keys.PAGE_UP);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.MONTH, -4);
    String fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());
    assertEquals("Page up id not find the correct date", fmt, result.trim());

    // Resetting calendar
    cal = new GregorianCalendar();

    // Running Test, increasing month
    result = pageUpDownHelper(10, "" + Keys.PAGE_DOWN);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.MONTH, 10);
    fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());

    // Making sure test result and true calendar outcome match
    assertEquals("Page down id not find the correct date", fmt, result.trim());
}

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);//from  w w  w . j av a 2  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 {/* w  ww. j  a  v a  2  s .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 testShouldReplacePageDownCharSequence() throws Exception {
    MacOSActions actions = new MacOSActions(webDriver);

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

    assertNotNull(charSequences);/*from   ww w  .j  a va  2 s  .  co m*/
    assertEquals(charSequences.length, 2);

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

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

License:Open Source License

@Test
public void addFilesTest() throws InterruptedException {
    projectExplorer.waitProjectExplorer();
    projectExplorer.openItemByPath(PROJECT_NAME);
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY);
    askDialog.waitFormToOpen();/*from  ww w.  ja v a  2s. c  o  m*/
    askDialog.clickOkBtn();
    askDialog.waitFormToClose();
    git.waitGitStatusBarWithMess(TestGitConstants.GIT_INITIALIZED_SUCCESS);
    events.clickProjectEventsTab();
    events.waitExpectedMessage(TestGitConstants.GIT_INITIALIZED_SUCCESS);

    // perform init commit
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.selectItem(PROJECT_NAME);
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT);
    git.waitAndRunCommit("init");
    loader.waitOnClosed();

    // check state of the index
    projectExplorer.selectItem(PROJECT_NAME);
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX);
    git.waitGitStatusBarWithMess(TestGitConstants.GIT_NOTHING_TO_ADD);
    events.clickProjectEventsTab();
    events.waitExpectedMessage(TestGitConstants.GIT_NOTHING_TO_ADD);

    //Edit index.jsp
    projectExplorer.openItemByVisibleNameInExplorer("index.jsp");
    editor.waitActiveEditor();
    editor.typeTextIntoEditor(Keys.PAGE_DOWN.toString());
    editor.typeTextIntoEditor(Keys.END.toString());
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor("<!-- Testing add to index-->");
    loader.waitOnClosed();

    //Add this file to index
    projectExplorer.selectItem(PROJECT_NAME + "/src/main/webapp/index.jsp");
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX);
    git.waitGitStatusBarWithMess(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS);
    events.clickProjectEventsTab();
    events.waitExpectedMessage(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS);

    //Check status
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS);
    loader.waitOnClosed();
    git.waitGitStatusBarWithMess(STATUS_MESSAGE_ONE_FILE);

    //Edit GreetingController.java
    projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java");
    editor.waitActiveEditor();
    editor.setCursorToLine(16);
    editor.typeTextIntoEditor("//Testing add to index");
    loader.waitOnClosed();

    //Create new.css file
    projectExplorer.selectItem(PROJECT_NAME + "/src/main/webapp");
    menu.runCommand(TestMenuCommandsConstants.Project.PROJECT, TestMenuCommandsConstants.Project.New.NEW,
            TestMenuCommandsConstants.Project.New.CSS_FILE);
    askForValueDialog.waitFormToOpen();
    askForValueDialog.typeAndWaitText("new");
    askForValueDialog.clickOkBtn();

    //Add all files to index
    projectExplorer.selectItem(PROJECT_NAME);
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX);
    git.waitAddToIndexFormToOpen();
    git.waitAddToIndexFileName("Add content of folder " + PROJECT_NAME + " to index?");
    git.confirmAddToIndexForm();
    git.waitGitStatusBarWithMess(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS);
    events.clickProjectEventsTab();
    events.waitExpectedMessage(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS);

    //Check status
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS);
    git.waitGitStatusBarWithMess(STATUS_MESSAGE_ALL_FILES);

    //Edit GreetingController.java
    editor.selectTabByName("AppController");
    editor.waitActiveEditor();
    editor.typeTextIntoEditor(Keys.DOWN.toString());
    editor.typeTextIntoEditor(Keys.DOWN.toString());
    editor.typeTextIntoEditor(Keys.DOWN.toString());
    editor.typeTextIntoEditor("//Testing add to index");
    loader.waitOnClosed();

    //Edit index.jsp
    editor.selectTabByName("index.jsp");
    editor.waitActiveEditor();
    editor.typeTextIntoEditor(Keys.PAGE_DOWN.toString());
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor("<!-- Testing add to index-->");
    loader.waitOnClosed();

    //Edit new.css
    editor.selectTabByName("new.css");
    editor.waitActiveEditor();
    editor.typeTextIntoEditor(Keys.PAGE_DOWN.toString());
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor("/* Testing add to index */");
    loader.waitOnClosed();

    //Check status and add to index all files
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS);
    git.waitGitStatusBarWithMess(STATUS_MESSAGE_AFTER_EDIT);
    projectExplorer.selectItem(PROJECT_NAME);
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX);
    git.waitGitStatusBarWithMess(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS);

    // delete README file and add to index
    deleteFromMenuFile();
    projectExplorer.selectItem(PROJECT_NAME);
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX);
    git.waitGitStatusBarWithMess(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS);
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS);
    git.waitGitStatusBarWithMess(STATUS_AFTER_DELETE_FILE);
}

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

License:Open Source License

@Test
public void checkoutBranchTest() throws Exception {
    // perform init commit
    projectExplorer.waitProjectExplorer();
    projectExplorer.waitItem(PROJECT_NAME);
    projectExplorer.waitAndSelectItem(PROJECT_NAME);
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY);
    loader.waitOnClosed();/* w  w  w  .jav a2s  .co  m*/
    askDialog.confirmAndWaitClosed();
    git.waitGitStatusBarWithMess(TestGitConstants.GIT_INITIALIZED_SUCCESS);
    events.clickEventLogBtn();
    events.waitExpectedMessage(TestGitConstants.GIT_INITIALIZED_SUCCESS);
    projectExplorer.waitAndSelectItem(PROJECT_NAME);
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT);
    git.waitAndRunCommit("init");
    loader.waitOnClosed();
    createBranch();
    switchOnTestBranch();

    // create change in AppController.java
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.openItemByPath(PROJECT_NAME + APP_JAVA_PATH);
    editor.setCursorToLine(16);
    editor.typeTextIntoEditor("\n" + "//some change");
    editor.waitTextIntoEditor("\n" + "//some change");
    loader.waitOnClosed();

    // Create change in index.jsp
    projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/webapp/index.jsp");
    editor.waitActive();
    editor.typeTextIntoEditor(Keys.PAGE_DOWN.toString());
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor(CHANGE_CONTENT_1);
    editor.waitTextIntoEditor(CHANGE_CONTENT_1);
    loader.waitOnClosed();

    // Create Hello.java class
    projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples");
    menu.runCommand(TestMenuCommandsConstants.Project.PROJECT, TestMenuCommandsConstants.Project.New.NEW,
            TestMenuCommandsConstants.Project.New.JAVA_CLASS);
    askForValueDialog.waitNewJavaClassOpen();
    askForValueDialog.typeTextInFieldName("Hello");
    askForValueDialog.clickOkBtnNewJavaClass();
    askForValueDialog.waitNewJavaClassClose();
    projectExplorer.waitVisibilityByName("Hello.java");
    projectExplorer.openItemByVisibleNameInExplorer("Hello.java");
    loader.waitOnClosed();
    editor.closeFileByNameWithSaving("Hello");
    editor.waitWhileFileIsClosed("Hello");

    // Create script.js file
    projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/webapp");
    menu.runCommand(TestMenuCommandsConstants.Project.PROJECT, TestMenuCommandsConstants.Project.New.NEW,
            TestMenuCommandsConstants.Project.New.JAVASCRIPT_FILE);
    askForValueDialog.waitFormToOpen();
    askForValueDialog.typeAndWaitText("script");
    askForValueDialog.clickOkBtn();
    askForValueDialog.waitFormToClose();

    // Check status
    projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main");
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS);
    loader.waitOnClosed();
    git.waitGitStatusBarWithMess(STATUS_MESSAGE_BEFORE_ADD);

    // add all files to index and check status
    projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main");
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX);
    git.waitAddToIndexFormToOpen();
    git.confirmAddToIndexForm();
    git.waitGitStatusBarWithMess(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS);
    events.clickEventLogBtn();
    events.waitExpectedMessage(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS);
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS);
    git.waitGitStatusBarWithMess(STATUS_MESSAGE_AFTER_ADD);

    // commit to repository and check status
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT);
    git.waitAndRunCommit("first commit");
    git.waitGitStatusBarWithMess(TestGitConstants.COMMIT_MESSAGE_SUCCESS);
    events.clickEventLogBtn();
    events.waitExpectedMessage(TestGitConstants.COMMIT_MESSAGE_SUCCESS);
    loader.waitOnClosed();
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS);
    git.waitGitStatusBarWithMess(STATUS_MESSAGE_AFTER_COMMIT);

    // checkout in main branch and check changed files
    switchOnMasterBranch();
    loader.waitOnClosed();
    projectExplorer.openItemByVisibleNameInExplorer("AppController.java");
    editor.waitTextNotPresentIntoEditor("\n" + "//some change");
    projectExplorer.openItemByVisibleNameInExplorer("index.jsp");
    editor.waitTextNotPresentIntoEditor(CHANGE_CONTENT_1);
    projectExplorer.waitDisappearItemByPath(PROJECT_NAME + HELLO_JAVA_PATH);
    projectExplorer.waitDisappearItemByPath(PROJECT_NAME + SCRIPT_FILE_PATH);
    projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main");
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS);
    git.waitGitStatusBarWithMess(STATUS_MASTER_BRANCH);
    loader.waitOnClosed();

    // switch to test branch again and check earlier changes
    switchOnTestBranch();
    projectExplorer.openItemByVisibleNameInExplorer("AppController.java");
    loader.waitOnClosed();
    editor.waitTextIntoEditor("\n" + "//some change");
    projectExplorer.openItemByVisibleNameInExplorer("index.jsp");
    editor.waitTextIntoEditor(CHANGE_CONTENT_1);
    projectExplorer.openItemByVisibleNameInExplorer("Hello.java");
    loader.waitOnClosed();
    editor.closeFileByNameWithSaving("Hello");
    editor.waitWhileFileIsClosed("Hello");
    projectExplorer.openItemByVisibleNameInExplorer("script.js");
    loader.waitOnClosed();
    editor.closeFileByNameWithSaving("script.js");
    editor.waitWhileFileIsClosed("script.js");

    // Checkout in main branch, change files in master branch (this creates conflict) and check
    // message with conflict
    switchOnMasterBranch();
    projectExplorer.waitProjectExplorer();
    loader.waitOnClosed();
    // create change in GreetingController.java
    projectExplorer.openItemByPath(PROJECT_NAME + APP_JAVA_PATH);
    editor.setCursorToLine(2);
    editor.typeTextIntoEditor("\n" + "//change in master branch");
    editor.waitTextIntoEditor("\n" + "//change in master branch");
    editor.waitTabFileWithSavedStatus("AppController");
    loader.waitOnClosed();
    // create change in index.jsp
    projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/webapp/index.jsp");
    editor.waitTextNotPresentIntoEditor(CHANGE_CONTENT_2);
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor(Keys.PAGE_UP.toString());
    editor.typeTextIntoEditor(CHANGE_CONTENT_2);
    editor.waitTextIntoEditor(CHANGE_CONTENT_2);
    editor.waitTabFileWithSavedStatus("index.jsp");
    loader.waitOnClosed();

    // Add all files to index and check status
    projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main");
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX);
    git.waitGitStatusBarWithMess(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS);
    events.clickEventLogBtn();
    events.waitExpectedMessage(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS);
    checkShwithConflict();
}

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

License:Open Source License

@Test
public void checkoutBranchTest() throws Exception {
    // perform init commit
    projectExplorer.waitProjectExplorer();
    projectExplorer.waitItem(PROJECT_NAME);
    projectExplorer.selectItem(PROJECT_NAME);
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY);
    loader.waitOnClosed();//ww  w.  ja  v  a 2  s .co m
    askDialog.confirmAndWaitClosed();
    git.waitGitStatusBarWithMess(TestGitConstants.GIT_INITIALIZED_SUCCESS);
    events.clickProjectEventsTab();
    events.waitExpectedMessage(TestGitConstants.GIT_INITIALIZED_SUCCESS);
    projectExplorer.selectItem(PROJECT_NAME);
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT);
    git.waitAndRunCommit("init");
    loader.waitOnClosed();
    createBranch();
    switchOnTestBranch();

    // create change in AppController.java
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.openItemByPath(PROJECT_NAME + APP_JAVA_PATH);
    editor.setCursorToLine(16);
    editor.typeTextIntoEditor("\n" + "//some change");
    editor.waitTextIntoEditor("\n" + "//some change");
    loader.waitOnClosed();

    // Create change in index.jsp
    projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/webapp/index.jsp");
    editor.waitActiveEditor();
    editor.typeTextIntoEditor(Keys.PAGE_DOWN.toString());
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor(CHANGE_CONTENT_1);
    editor.waitTextIntoEditor(CHANGE_CONTENT_1);
    loader.waitOnClosed();

    // Create Hello.java class
    projectExplorer.selectItem(PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples");
    menu.runCommand(TestMenuCommandsConstants.Project.PROJECT, TestMenuCommandsConstants.Project.New.NEW,
            TestMenuCommandsConstants.Project.New.JAVA_CLASS);
    askForValueDialog.waitNewJavaClassOpen();
    askForValueDialog.typeTextInFieldName("Hello");
    askForValueDialog.clickOkBtnNewJavaClass();
    askForValueDialog.waitNewJavaClassClose();
    projectExplorer.waitItemInVisibleArea("Hello.java");
    projectExplorer.openItemByVisibleNameInExplorer("Hello.java");
    loader.waitOnClosed();
    editor.closeFileByNameWithSaving("Hello");
    editor.waitWhileFileIsClosed("Hello");

    // Create script.js file
    projectExplorer.selectItem(PROJECT_NAME + "/src/main/webapp");
    menu.runCommand(TestMenuCommandsConstants.Project.PROJECT, TestMenuCommandsConstants.Project.New.NEW,
            TestMenuCommandsConstants.Project.New.JAVASCRIPT_FILE);
    askForValueDialog.waitFormToOpen();
    askForValueDialog.typeAndWaitText("script");
    askForValueDialog.clickOkBtn();
    askForValueDialog.waitFormToClose();

    // Check status
    projectExplorer.selectItem(PROJECT_NAME + "/src/main");
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS);
    loader.waitOnClosed();
    git.waitGitStatusBarWithMess(STATUS_MESSAGE_BEFORE_ADD);

    // add all files to index and check status
    projectExplorer.selectItem(PROJECT_NAME + "/src/main");
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX);
    git.waitAddToIndexFormToOpen();
    git.confirmAddToIndexForm();
    git.waitGitStatusBarWithMess(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS);
    events.clickProjectEventsTab();
    events.waitExpectedMessage(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS);
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS);
    git.waitGitStatusBarWithMess(STATUS_MESSAGE_AFTER_ADD);

    // commit to repository and check status
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT);
    git.waitAndRunCommit("first commit");
    git.waitGitStatusBarWithMess(TestGitConstants.COMMIT_MESSAGE_SUCCESS);
    events.clickProjectEventsTab();
    events.waitExpectedMessage(TestGitConstants.COMMIT_MESSAGE_SUCCESS);
    loader.waitOnClosed();
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS);
    git.waitGitStatusBarWithMess(STATUS_MESSAGE_AFTER_COMMIT);

    // checkout in main branch and check changed files
    switchOnMasterBranch();
    loader.waitOnClosed();
    projectExplorer.openItemByVisibleNameInExplorer("AppController.java");
    editor.waitTextNotPresentIntoEditor("\n" + "//some change");
    projectExplorer.openItemByVisibleNameInExplorer("index.jsp");
    editor.waitTextNotPresentIntoEditor(CHANGE_CONTENT_1);
    projectExplorer.waitDisappearItemByPath(PROJECT_NAME + HELLO_JAVA_PATH);
    projectExplorer.waitDisappearItemByPath(PROJECT_NAME + SCRIPT_FILE_PATH);
    projectExplorer.selectItem(PROJECT_NAME + "/src/main");
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS);
    git.waitGitStatusBarWithMess(STATUS_MASTER_BRANCH);
    loader.waitOnClosed();

    // switch to test branch again and check earlier changes
    switchOnTestBranch();
    projectExplorer.openItemByVisibleNameInExplorer("AppController.java");
    loader.waitOnClosed();
    editor.waitTextIntoEditor("\n" + "//some change");
    projectExplorer.openItemByVisibleNameInExplorer("index.jsp");
    editor.waitTextIntoEditor(CHANGE_CONTENT_1);
    projectExplorer.openItemByVisibleNameInExplorer("Hello.java");
    loader.waitOnClosed();
    editor.closeFileByNameWithSaving("Hello");
    editor.waitWhileFileIsClosed("Hello");
    projectExplorer.openItemByVisibleNameInExplorer("script.js");
    loader.waitOnClosed();
    editor.closeFileByNameWithSaving("script.js");
    editor.waitWhileFileIsClosed("script.js");

    // Checkout in main branch, change files in master branch (this creates conflict) and check message with conflict
    switchOnMasterBranch();
    projectExplorer.waitProjectExplorer();
    loader.waitOnClosed();
    // create change in GreetingController.java
    projectExplorer.openItemByPath(PROJECT_NAME + APP_JAVA_PATH);
    editor.setCursorToLine(2);
    editor.typeTextIntoEditor("\n" + "//change in master branch");
    editor.waitTextIntoEditor("\n" + "//change in master branch");
    editor.waitTabFileWithSavedStatus("AppController");
    loader.waitOnClosed();
    // create change in index.jsp
    projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/webapp/index.jsp");
    editor.waitTextNotPresentIntoEditor(CHANGE_CONTENT_2);
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor(Keys.PAGE_UP.toString());
    editor.typeTextIntoEditor(CHANGE_CONTENT_2);
    editor.waitTextIntoEditor(CHANGE_CONTENT_2);
    editor.waitTabFileWithSavedStatus("index.jsp");
    loader.waitOnClosed();

    // Add all files to index and check status
    projectExplorer.selectItem(PROJECT_NAME + "/src/main");
    menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX);
    git.waitGitStatusBarWithMess(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS);
    events.clickProjectEventsTab();
    events.waitExpectedMessage(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS);
    checkShwithConflict();
}