/**
   * Case ID:76680. Test Case Name: Open user guide when user is on Spaces. Pre-Condition:
   * Post-Condition: Done with OSs and browsers : Generated by chinhdtt at 2014/05/19 12:12:55
   */
  @Test
  public void test22_OpenUserGuideWhenUserIsOnSpaces() {
    info("Test 22 Open user guide when user is on Spaces");
    String spaceName = "Space" + getRandomNumber();
    String URL =
        "http://docs.exoplatform.com/public/index.jsp?topic=/PLF42/PLFUserGuide.WorkingWithSpaces.html";

    /*
    - Connect to Intranet
    - Open Spaces application
     *Expected Outcome:
    - TheSpaces list page is displayed
    - The Top navigation bar is displayed
    - The Help button is displayed in the right of the bar		*/
    mMember.goToAllSpaces();
    mMember.addNewSpace(spaceName, spaceName);
    Utils.pause(1000);
    waitForAndGetElement(ELEMENT_NAVIGATION_TOOLBAR_HOMEPAGE);
    waitForAndGetElement(ELEMENT_HELP_ICON);

    /*
    - Click on the button "?"
     *Input Data:
     *Expected Outcome:
    - A new tab in the internet browser is opened
    - The user guide is opened on: http://docs.exoplatform.com/public/index.jsp?topic=/PLF41/PLFUserGuide.WorkingWithSpaces.html		*/
    click(ELEMENT_HELP_ICON);
    Utils.pause(5000);
    for (String winHandle : driver.getWindowHandles()) {
      driver.switchTo().window(winHandle);
    }
    Utils.pause(1000);
    assert driver.getCurrentUrl().equalsIgnoreCase(URL);
    info("URL " + driver.getCurrentUrl());
  }
  /**
   * Case ID:76671. Test Case Name: Open user guide when user is inside a space, on Forum.
   * Pre-Condition: The current user is a member of a space with Forum application Post-Condition:
   * Done with OSs and browsers : Generated by chinhdtt at 2014/05/19 12:12:55
   */
  @Test
  public void test13_OpenUserGuideWhenUserIsInsideASpaceOnForum() {
    info("Test 13 Open user guide when user is inside a space, on Forum");
    String spaceName = "Space" + getRandomNumber();
    String URL =
        "http://docs.exoplatform.com/public/index.jsp?topic=/PLF42/PLFUserGuide.BuildingYourForum.html";

    // Pre-condition
    mMember.goToAllSpaces();
    mMember.addNewSpace(spaceName, spaceName);
    Utils.pause(1000);

    /*
    - Connect to Intranet
    - Open a space, go to forum
     *Expected Outcome:
    - The forum screen is displayed
    - The Top navigation bar is displayed
    - The Help button is displayed in the right of the bar		*/
    mMember.goToSpaceMenu("Forums");
    Utils.pause(1000);
    waitForAndGetElement(ELEMENT_NAVIGATION_TOOLBAR_HOMEPAGE);
    waitForAndGetElement(ELEMENT_HELP_ICON);

    /*
    - Click on the button "?"
     *Input Data:
     *Expected Outcome:
    - A new tab in the internet browser is opened
    - The user guide is opened on: http://docs.exoplatform.com/public/index.jsp?topic=/PLF41/PLFUserGuide.BuildingYourForum.html		*/
    click(ELEMENT_HELP_ICON);
    Utils.pause(5000);
    for (String winHandle : driver.getWindowHandles()) {
      driver.switchTo().window(winHandle);
    }
    Utils.pause(1000);
    assert driver.getCurrentUrl().equalsIgnoreCase(URL);
    info("URL " + driver.getCurrentUrl());

    // Delete data test
    switchToParentWindow();
    mMember.goToAllSpaces();
    mMember.deleteSpace(spaceName, 300000);
  }
  /**
   * Case ID:76667. Test Case Name: Open user guide when user is inside a space, on Answers.
   * Pre-Condition: The current user is a member of a space with Answers application Post-Condition:
   * Done with OSs and browsers : Generated by chinhdtt at 2014/05/19 12:12:55
   */
  @Test
  public void test09_OpenUserGuideWhenUserIsInsideASpaceOnAnswers() {
    info("Test 9: Open user guide when user is inside a space, on Answers");
    String spaceName = "Space" + getRandomNumber();
    String URL =
        "http://docs.exoplatform.com/public/index.jsp?topic=/PLF42/eXoAddonsGuide.Answers.UserGuide.html";

    // Pre-condition
    mMember.goToAllSpaces();
    mMember.addNewSpace(spaceName, spaceName);
    Utils.pause(1000);

    /*
    - Connect to Intranet
    - Open a space, go to Answers
     *Expected Outcome:
    - The Answers screen is displayed
    - The Top navigation bar is displayed
    - The Help button is displayed in the right of the bar		*/
    mMember.addApplication(spaceName, "Collaboration", typeApplications.Answer);
    mMember.goToSpaceMenu("Answer");
    waitForAndGetElement(ELEMENT_NAVIGATION_TOOLBAR_HOMEPAGE);
    waitForAndGetElement(ELEMENT_HELP_ICON);

    /*
    - Click on the button "?"
     *Input Data:
     *Expected Outcome:
    - A new tab in the internet browser is opened
    - The user guide is opened on: http://docs.exoplatform.com/public/index.jsp?topic=/PLF42/eXoAddonsGuide.Answers.UserGuide.html*/
    click(ELEMENT_HELP_ICON);
    info("Check URL is shown");
    Utils.pause(5000);
    for (String winHandle : driver.getWindowHandles()) {
      driver.switchTo().window(winHandle);
    }
    Utils.pause(1000);
    assert driver.getCurrentUrl().equalsIgnoreCase(URL);
    info("URL " + driver.getCurrentUrl());
  }