/**
   * == Add File activity after uploading a file in a space == Test case ID: 76992 Step 1: - Connect
   * to Intranet - Add new space - Open Documents in this space - Upload a file - Back to the Home
   * page
   */
  @Test
  public void test02_AddFileActivityAfterUploadingAFileInASpace() {
    // Declare variable
    String spacename = "Space02";
    String spacedesc = "Description Of Space02";
    String file = "ECMS_DMS_SE_Upload_imgfile.jpg";

    // Add new space
    magMember.goToMySpacePage();
    magMember.addNewSpace(spacename, spacedesc);

    // Open Documents in this space
    waitForAndGetElement(magMember.ELEMENT_DOCUMENTS_TAB);
    click(magMember.ELEMENT_DOCUMENTS_TAB);

    // Upload a file
    ecms.uploadFile("TestData/" + file);

    // Back to the Home page
    info("-- Back to the Home page --");
    navToolBar.goToHomePage();

    // - A File activity is added to the activity stream
    info("-- A File activity is added to the activity stream --");
    activity.checkInforAfterAddingDocument(file, "", "File", "423 KB", "", "", "", "");

    /*Clear data*/
    info("-- Clear data --");
    magMember.goToMySpacePage();
    magMember.deleteSpace(spacename);
  }
  /**
   * == Remove the File activity after deleting a file in Space document == Test case ID: 77326 Step
   * 1: Create file activity Step 2: Delete File
   */
  @Test
  public void test10_RemoveTheFileActivityAfterDeletingAFileInSpaceDocument() {
    // Declare variable
    String file = "KS_Wiki_Attachment_pdffile.pdf";
    By elementfile = By.linkText(file);
    String spacename = "Space10";
    String spacedesc = "Description Of Space10";

    /*Step 1: Create file activity*/
    // Add new space
    magMember.goToMySpacePage();
    magMember.addNewSpace(spacename, spacedesc);

    // Open Documents in this space
    waitForAndGetElement(magMember.ELEMENT_DOCUMENTS_TAB);
    click(magMember.ELEMENT_DOCUMENTS_TAB);

    // Upload a file
    ecms.uploadFile("TestData/" + file);

    // Back to the Home page
    info("-- Back to the Home page --");
    navToolBar.goToHomePage();

    // - The File activity is displayed in the activity stream
    info("-- A File activity is added to the activity stream --");
    activity.checkInforAfterAddingDocument(file, "", "File", "1 MB", "", "", "", "");

    /*Step 2: Delete File*/
    // Delete file from space
    magMember.goToMySpacePage();
    magMember.doAction("Edit", spacename);
    waitForAndGetElement(magMember.ELEMENT_DOCUMENTS_TAB);
    click(magMember.ELEMENT_DOCUMENTS_TAB);
    cMenu.deleteData(elementfile);

    // Back to the Home page
    info("-- Back to the Home page --");
    navToolBar.goToHomePage();

    // The File activity is removed from the activity stream
    info("-- The File activity is removed from the activity stream --");
    waitForElementNotPresent(activity.ELEMENT_CONTENT_NAME.replace("@{fileName}", file));

    /*Clear data*/
    info("-- Clear data --");
    magMember.goToMySpacePage();
    magMember.deleteSpace(spacename);
  }
  /**
   * Case ID:76673. Test Case Name: Open user guide when user is inside a space, on Wiki.
   * Pre-Condition: The current user is a member of a space with wiki application Post-Condition:
   * Done with OSs and browsers : Generated by chinhdtt at 2014/05/19 12:12:55
   */
  @Test
  public void test15_OpenUserGuideWhenUserIsInsideASpaceOnWiki() {
    info("Test 15 Open user guide when user is inside a space, on Wiki");
    String spaceName = "Space" + getRandomNumber();
    String URL =
        "http://docs.exoplatform.com/public/index.jsp?topic=/PLF42/PLFUserGuide.WorkingWithWikis.html";

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

    /*
    - Connect to Intranet
    - Open a space, go to wiki
     *Expected Outcome:
    - The wiki screen is displayed
    - The Top navigation bar is displayed
    - The Help button is displayed in the right of the bar		*/
    mMember.goToSpaceMenu("Wiki");
    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.WorkingWithWikis.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);
  }
  /**
   * == Edit a file from the File activity from space == Test case ID: 77330 Step 1: Create file
   * activity Step 2: Edit file from activity stream
   */
  @Test
  public void test12_EditAFileFromTheFileActivityFromSpace() {
    // Declare variable
    String file = "KS_Wiki_Attachment_pdffile.pdf";
    String spacename = "Space12";
    String spacedesc = "Description Of Space12";

    /*Step 1: Create file activity*/
    // Add new space
    magMember.goToMySpacePage();
    magMember.addNewSpace(spacename, spacedesc);

    // Open Documents in this space
    waitForAndGetElement(magMember.ELEMENT_DOCUMENTS_TAB);
    click(magMember.ELEMENT_DOCUMENTS_TAB);

    // Upload a file
    ecms.uploadFile("TestData/" + file);

    // Back to the Home page
    info("-- Back to the Home page --");
    navToolBar.goToHomePage();

    // - The File activity is displayed in the activity stream
    info("-- A File activity is added to the activity stream --");
    activity.checkInforAfterAddingDocument(file, "", "File", "1 MB", "", "", "", "");

    /*Step 2: Edit file from activity stream*/
    // From the file activity, click on the link "Edit"
    info("Click Edit icon in activity");
    activity.goToEditFromContentActivity(file);
    assert getValue(cTemplate.ELEMENT_WEBCONTENT_NAME_TEXTBOX).equalsIgnoreCase(file);
    activity.backToHomePageFromEditContentScreen();

    /*Clear data*/
    info("-- Clear data --");
    magMember.goToMySpacePage();
    magMember.deleteSpace(spacename);
  }