/**
   * == Remove the File activity after deleting a file in Content explorer == Test case ID: 77000
   * Step 1: Create file activity Step 2: Delete File
   */
  @Test
  public void test06_RemoveTheFileActivityAfterDeletingAFileInContentExplorer() {
    // Declare variable
    String file = "KS_Wiki_Attachment_pdffile.pdf";
    By elementfile = By.linkText(file);

    /*Step 1: Create file activity*/
    // Go to SE
    navToolBar.goToSiteExplorer();

    // 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 the file
    navToolBar.goToSiteExplorer();
    cMenu.deleteData(elementfile);

    // Back to the Homepage
    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));
  }
  /*
   * CaseId 77702: Post an activity with "My Spaces" filter selected
   * CaseId 77706: Comment from "My Spaces"
   * Precondition: Space1 is already exist.
   */
  @Test
  public void test02_ActivityComment_MySpacesFilter() {
    String activity = "My Spaces filter: Post an activity.";
    String spaceName = "Space77702";
    String comment = "My Spaces filter: Comment for an activity.";

    // Create data for Pre-Conditions
    spaceMag.goToMySpacePage();
    spaceMag.addNewSpace(spaceName, "");

    // Start test case
    naviToolbar.goToHomePage();

    // Step1: My Spaces filter is displayed
    selectFileter("My Spaces");

    // Add an activity in Space1
    click(By.linkText(spaceName));
    addActivity(true, activity, false, "");

    // Go to Home, select All Activities filter
    naviToolbar.goToHomePage();
    selectFileter("All Activities");

    // Step2: Add a comment
    addComment(activity, comment);

    // Select My Spaces filter
    selectFileter("My Spaces");

    // Delete activity before exit test cases
    hpActivity.deleteActivity(activity);
    spaceMag.goToMySpacePage();
    spaceMag.deleteSpace(spaceName, 300000);
  }
  /**
   * == 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);
  }
  /**
   * == Displaying of file format (image, pdf, office) in the File activity (1) == Test case ID:
   * 76994 Step 1: - Connect to Intranet - Go to SE and Upload a file: image, pdf or office document
   * (except personal document drive) - Go back intranet home page PENDING: check preview of the
   * file is displayed (only first page for documents) Refer:
   * https://jira.exoplatform.org/browse/FQA-1250
   */
  @Test(groups = {"pending"})
  public void test03_DisplayingOfFileFormatImagePdfOfficeInTheFileActivity1() {
    // Declare variable
    String file = "KS_Wiki_Attachment_pdffile.pdf";
    By elementfile = By.linkText(file);

    // Go to SE
    navToolBar.goToSiteExplorer();

    // Upload a file: image, pdf or office document (except personal document drive)
    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", "", "", "", "");

    // - A preview of the file is displayed (only first page for documents)

    /*Clear data*/
    info("-- Clear data --");
    navToolBar.goToSiteExplorer();
    cMenu.deleteData(elementfile);
  }
  /**
   * == Cancel an upload of file == Test case ID: 77779 Step 1: Open popup "Select File" Step 2:
   * Upload a file from local Step 3: Cancel the upload PENDING: can't verify progress bar of the
   * uploaded file --> REASON: Need to upload a large file to server to verify it.
   */
  @Test(groups = "pending")
  public void test01_CancelAnUploadOfFile() {
    /*Declare variables*/
    // String uploadFileName = "ECMS_DMS_SE_Upload_pdffile.pdf";
    // String driverName = "Personal Drives";
    // String folderPath = "Personal Documents";

    /* Step 1: Open popup "Select File" */
    // - Connect to Intranet
    // - From [Activity Composer], click on [File] button
    // - The pop up "Select File" is displayed

    /* Step 2: Upload a file from local */
    // - Select a drive from [Select drive] list
    // - Click on a folder
    // - Click on the icon [Upload]
    // - Select a file from  local
    // - Click [Open]
    // - The progress bar of the uploaded file is displayed
    // - A cross icon in the end of the bar is displayed
    navToolBar.goToHomePage();
    // selectFile(driverName,true,folderPath,"",uploadFileName,"");

    /* Step 3: Cancel the upload */
    // - Click on the cross [x] icon
    // The upload is canceled
  }
  /** == Display events with multiple day == Test case ID: 69111 */
  @Test
  public void test07_DisplayAnEventWithMultipeDay() {

    String Event = "Display events with multiple day";
    String Event_1 = "Display events with multiple day_1";
    String ELEMENT_VERITY_DATE_OLDER =
        "//*[contains(@class,'eventsList')]/li[2]//span[text()='${older_date_before}']/../../../../../li[2]//span[text()='${older_date_after}']";
    String ELEMENT_VERITY_DATE_LASTEST =
        "//*[contains(@class,'eventsList')]/li[1]//span[text()='${lastest_date_before}']/../../../../../li[2]//span[text()='${lastest_date_after}']";
    String older_date_before = getDate(-1, "M/dd/yyyy");
    String older_date_after = getDate(1, "M/dd/yyyy");
    String lastest_date_before = getDate(0, "M/dd/yyyy");
    String lastest_date_after = getDate(1, "M/dd/yyyy");

    info("Go to Calendar page");
    goToCalendarPage();
    info("Add events in calendar");
    event.addQuickEvent(Event, Event, getDate(-1, "M/dd/yyyy"), getDate(1, "M/dd/yyyy"), false);
    event.addQuickEvent(Event_1, Event_1, getDate(0, "M/dd/yyyy"), getDate(1, "M/dd/yyyy"), false);
    naviToolbar.goToHomePage();
    click(ELEMENT_CALENDAR_GADGET_TODAY_LABEL);
    waitForAndGetElement(ELEMENT_CALENDAR_GADGET_TODAY_LABEL);
    waitForAndGetElement(
        ELEMENT_VERITY_DATE_OLDER
            .replace("${older_date_before}", older_date_before)
            .replace("${older_date_after}", older_date_after));
    waitForAndGetElement(
        ELEMENT_VERITY_DATE_LASTEST
            .replace("${lastest_date_before}", lastest_date_before)
            .replace("${lastest_date_after}", lastest_date_after));
    Utils.pause(5000);
    goToCalendarPage();
    event.deleteEventTask(Event_1, selectDayOption.ONEDAY);
    event.deleteEventTask(Event, selectDayOption.ONEDAY);
  }
  /**
   * == Add File activity after uploading a file in CE == Test case ID: 77327 Step 1: - Go to Sites
   * explorer (except personal drive) - Upload a file - Back to the Home page
   */
  @Test
  public void test11_AddFileActivityAfterUploadingAFileInCE() {
    // Declare variable
    String file = "KS_Wiki_Attachment_pdffile.pdf";
    By elementfile = By.linkText(file);

    // Go to SE
    navToolBar.goToSiteExplorer();

    // Upload a file: image, pdf or office document (except personal document drive)
    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", "", "", "", "");

    /*Clear data*/
    info("-- Clear data --");
    navToolBar.goToSiteExplorer();
    cMenu.deleteData(elementfile);
  }
  /**
   * == Not update File activity after creating a new folder == Test case ID: 76991 Step 1: -
   * Connect to Intranet - Open Sites Explorer - Create a new folder - Back to the Home page
   */
  @Test
  public void test01_NotUpdateFileActivityAfterCreatingANewFolder() {
    // Declare variable
    String folder = "folder01";
    By elementFolder = By.linkText(folder);
    // Open Sites Explorer
    info("-- Open Sites Explorer --");
    navToolBar.goToSiteExplorer();

    // Create a new folder
    info("-- Create parent folder --");
    cTemplate.createNewFolder(folder, folderType.None);

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

    // No activity is displayed in the activity stream
    info("-- Check activity after adding a folder --");
    waitForElementNotPresent(activity.ELEMENT_CONTENT_NAME.replace("@{fileName}", folder));

    /*Clear data*/
    info("-- Clear data --");
    info("-- Open Sites Explorer --");
    navToolBar.goToSiteExplorer();
    cMenu.deleteData(elementFolder);
  }
  /**
   * == 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);
  }
  /**
   * == Edit a file from the File activity from intranet home page == Test case ID: 76997 Step 1:
   * Create file activity Step 2: Edit file from activity stream
   */
  @Test
  public void test05_EditAFileFromTheFileActivityFromIntranetHomePage() {
    // Declare variable
    String file = "KS_Wiki_Attachment_pdffile.pdf";
    By elementfile = By.linkText(file);

    /*Step 1: Create file activity*/
    // Go to SE
    navToolBar.goToSiteExplorer();

    // 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 --");
    navToolBar.goToSiteExplorer();
    cMenu.deleteData(elementfile);
  }
  /*
   * CaseId 77703: Post an activity with "Connections" filter selected
   * CaseId 77708: Comment from "Connections"
   * Pre-Condition: john and demo must be connected each other before tests started
   */
  @Test
  public void test04_ActivityComment_ConnectionsFilter() {
    String activity = "Connections filter: Post an activity by demo.";
    String comment = "Connections filter: Comment for an activity by john.";

    // Create data for Pre-Conditions
    naviToolbar.goToConnectionPage();
    conn.connectPeople(fullname_demo);
    magAc.userSignIn(userType.DEVELOPER);
    naviToolbar.goToConnectionPage();
    conn.acceptInvitation(fullname_john);
    magAc.userSignIn(userType.ADMIN);

    // Start test case
    naviToolbar.goToHomePage();

    // Step1: Connections filter is displayed
    selectFileter("Connections");

    // sign-in by demo. Add an activity
    magAc.userSignIn(userType.DEVELOPER);
    naviToolbar.goToHomePage();
    addActivity(true, activity, false, "");

    // sign-in by john. Select Connections filter
    magAc.userSignIn(userType.ADMIN);
    naviToolbar.goToHomePage();
    selectFileter("Connections");

    // Step2: Add a comment. Select All Activities filter.
    addComment(activity, comment);
    selectFileter("All Activities");

    // Select Connections filter
    selectFileter("Connections");

    // Delete activity before exit test cases
    magAc.userSignIn(userType.DEVELOPER);
    naviToolbar.goToHomePage();
    hpActivity.deleteActivity(activity);
    naviToolbar.goToConnectionPage();
    conn.removeConnection(fullname_john);
  }
 /**
  * == Display an event with a long title in Calendar Gadget == Test case ID: 69112 PENDING: Can't
  * find xpath with long title
  */
 @Test(groups = "pending")
 public void test03_DisplayAnEventWithALongTitle() {
   String Event_1 =
       "Display an event with a long title in Calendar Gadget Display an event with a long title in Calendar Gadget Display an event with a long title in Calendar Gadget";
   info("Go to Calendar page");
   goToCalendarPage();
   info("Add events in calendar");
   event.addQuickEvent(Event_1, Event_1, "", "", true);
   naviToolbar.goToHomePage();
   waitForTextPresent(Event_1);
   Utils.pause(5000);
   goToCalendarPage();
   event.deleteEventTask(Event_1, selectDayOption.ONEDAY);
 }
  /**
   * == Displaying of file format (image, pdf, office) in the File activity (2) == Test case ID:
   * 77112 Step 1: - Connect to Intranet - Go to CE and Upload a file: image, pdf or office document
   * (except personal document drive) - Go back intranet home page Verify by comparison width heigh
   * and width: The orientation of the file can be portrait or landscape following its original
   * orientation
   */
  @Test
  public void test08_DisplayingOfFileFormatImagePdfOfficeInTheFileActivity2() {
    // Declare variable
    String file1 = "portrait08.jpg";
    String file2 = "landscape08.jpg";
    By elementfile1 = By.linkText(file1);
    By elementfile2 = By.linkText(file2);

    // Go to SE
    navToolBar.goToSiteExplorer();

    // Upload a file: image, pdf or office document (except personal document drive)
    ecms.uploadFile("TestData/" + file1);
    ecms.uploadFile("TestData/" + file2);

    // 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(file1, "", "File", "", "", "", "", "");
    activity.checkInforAfterAddingDocument(file2, "", "File", "", "", "", "", "");

    // - The orientation of the file can be portrait or landscape following its original orientation
    WebElement element =
        waitForAndGetElement(By.xpath(ELEMENT_GET_URL_IMAGE.replace("${name}", file1)));
    String src = element.getAttribute("src");
    driver.navigate().to(src);
    WebElement image =
        waitForAndGetElement(By.xpath(ELEMENT_GET_URL_IMAGE.replace("${name}", src)));
    int height = image.getSize().getHeight();
    assert (height == 300);

    driver.navigate().back();
    element = waitForAndGetElement(By.xpath(ELEMENT_GET_URL_IMAGE.replace("${name}", file2)));
    src = element.getAttribute("src");
    driver.navigate().to(src);
    image = waitForAndGetElement(By.xpath(ELEMENT_GET_URL_IMAGE.replace("${name}", src)));
    height = image.getSize().getHeight();
    assert (height == 89);
    driver.navigate().back();

    /*Clear data*/
    info("-- Clear data --");
    navToolBar.goToSiteExplorer();
    cMenu.deleteData(elementfile1);
    cMenu.deleteData(elementfile2);
  }
 /** == Display an event scheduled for all the day == Test case ID: 69103 */
 @Test
 public void test02_DisplayAnEventScheduledForAllTheDay() {
   String Event_1 = "Event 69103";
   info("Go to Calendar page");
   goToCalendarPage();
   info("Add events in calendar");
   event.addQuickEvent(Event_1, Event_1, "", "", true);
   naviToolbar.goToHomePage();
   click(ELEMENT_CALENDAR_GADGET_TODAY_LABEL);
   waitForAndGetElement(
       ELEMENT_EVENT_TASK_ITEM_IN_CALENDAR_GADGET
           .replace("${event}", Event_1)
           .replace("${time}", "All Day"));
   goToCalendarPage();
   event.deleteEventTask(Event_1, selectDayOption.ALLDAY);
 }
  /*
   * CaseId 77705: Post an activity with "All activities" filter selected
   * CaseId 77701: Comment from "All Activities"
   */
  @Test
  public void test01_ActivityComment_AllActivitiesFilter() {
    String activity = "All Activities filter: Post an activity.";
    String comment = "All Activities filter: Comment for an activity.";
    naviToolbar.goToHomePage();

    // Step1: All Activities filter is displayed
    selectFileter("All Activities");

    // Add an activity
    addActivity(true, activity, false, "");

    // Step2: Add a comment
    addComment(activity, comment);

    // Delete activity before exit test cases
    hpActivity.deleteActivity(activity);
  }
 /** == Display an event scheduled on multiple day == Test case ID: 69104 */
 @Test
 public void test04_DisplayAnEventScheduledOnMultipeDay() {
   String Event = "event 69104";
   String date1 = getDate(1, "M/dd/yyyy");
   String date2 = getDate(2, "M/dd/yyyy");
   info("Go to Calendar page");
   goToCalendarPage();
   info("Add events in calendar");
   event.addQuickEvent(Event, Event, getDate(1, "MM/dd/yyyy"), getDate(2, "MM/dd/yyyy"), false);
   naviToolbar.goToHomePage();
   click(ELEMENT_CALENDAR_GADGET_NEXTDAY_ARROW);
   waitForAndGetElement(
       ELEMENT_EVENT_TASK_MULTIDATE_ITEM_IN_CALENDAR_GADGET
           .replace("${event}", Event)
           .replace("${totime}", date1)
           .replace("${endtime}", date2));
   goToCalendarPage();
   event.deleteEventTask(Event, selectDayOption.ONEDAY);
 }
 /** == Display a past event in Calendar Gadget == Test case ID: 69113 */
 @Test
 public void test01_DisplayAPastEventInCalendarGadget() {
   String Event_11 = "Event 69113";
   String date = getDate(-1, "M/dd/yyyy");
   info("Go to calendar");
   goToCalendarPage();
   info("Add events in calendar");
   event.addQuickEvent(
       Event_11, Event_11, getDate(-2, "MM/dd/yyyy"), getDate(-1, "MM/dd/yyyy"), false);
   naviToolbar.goToHomePage();
   click(ELEMENT_CALENDAR_GADGET_PREVIOUSDAY_ARROW);
   waitForAndGetElement(ELEMENT_CALENDAR_GADGET_YESTERDAY_LABEL);
   waitForAndGetElement(
       ELEMENT_EVENT_TASK_ITEM_IN_CALENDAR_GADGET
           .replace("${event}", Event_11)
           .replace("${time}", date));
   goToCalendarPage();
   event.deleteEventTask(Event_11, selectDayOption.ALLDAY);
 }
  /** == Display many events in Gadget Calendar == Test case ID: 69108 */
  @Test
  public void test09_DisplayManyEventInGagetCalendar() {

    String Event = "Event 69108";
    String Event_1 = "Event 69108_1";
    String Event_2 = "Event 69108_2";
    String Event_3 = "Event 69108_3";
    String Event_4 = "Event 69108_4";
    String Event_5 = "Event 69108_5";
    String Event_6 = "Event 69108_6";
    int oldSize;
    int newSize;
    By element = By.xpath("//div[@class='calendarPortletData uiBox']");
    oldSize = waitForAndGetElement(element).getSize().getHeight();

    info("Go to Calendar page");
    goToCalendarPage();
    info("Add events in calendar");
    event.addQuickEvent(Event, Event, "", "", true);
    event.addQuickEvent(Event_1, Event_1, "", "", true);
    event.addQuickEvent(Event_2, Event_2, "", "", true);
    event.addQuickEvent(Event_3, Event_3, "", "", true);
    event.addQuickEvent(Event_4, Event_4, "", "", true);
    event.addQuickEvent(Event_5, Event_5, "", "", true);
    event.addQuickEvent(Event_6, Event_6, "", "", true);
    naviToolbar.goToHomePage();
    waitForAndGetElement(ELEMENT_CALENDAR_GADGET_TODAY_LABEL);
    element = By.xpath("//div[@class='calendarPortletData uiBox']");
    newSize = waitForAndGetElement(element).getSize().getHeight();
    info(String.valueOf(newSize));
    info(String.valueOf(oldSize));
    assert (oldSize != newSize);
    Utils.pause(5000);
    goToCalendarPage();
    event.deleteEventTask(Event, selectDayOption.ALLDAY);
    event.deleteEventTask(Event_1, selectDayOption.ALLDAY);
    event.deleteEventTask(Event_2, selectDayOption.ALLDAY);
    event.deleteEventTask(Event_3, selectDayOption.ALLDAY);
    event.deleteEventTask(Event_4, selectDayOption.ALLDAY);
    event.deleteEventTask(Event_5, selectDayOption.ALLDAY);
    event.deleteEventTask(Event_6, selectDayOption.ALLDAY);
  }
  /**
   * == Open the Calendar application on event's details from Calendar Gadget == Test case ID: 69108
   */
  @Test
  public void test10_OpenTheCalendarApplicationOnEventDetailFromCalendarGadget() {

    String Event = "Event 69114";
    String ELEMENT_TITLE_OF_EVENT = "//div[@class='pull-left eventSummary']//a[text()='${Event}']";
    By ELEMENT_PREVIEW_EVENT =
        By.xpath("//div[contains(@class,'uiPreview noRounded uiBox resizable')]");
    info("Go to Calendar page");
    goToCalendarPage();
    info("Add events in calendar");
    event.addQuickEvent(Event, Event, "", "", true);
    naviToolbar.goToHomePage();
    waitForAndGetElement(ELEMENT_CALENDAR_GADGET_TODAY_LABEL);
    click(ELEMENT_TITLE_OF_EVENT.replace("${Event}", Event));
    Utils.pause(1000);
    // waitForAndGetElement(ELEMENT_CALENDAR_PANEL);
    waitForAndGetElement(ELEMENT_PREVIEW_EVENT, 30000, 1, 2);
    button.close();
    info("delete event");
    event.deleteEventTask(Event, selectDayOption.ALLDAY);
  }
  /**
   * == 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);
  }
  /**
   * == Display the content of the File activity == Test case ID: 76995 Step 1: Create file activity
   */
  @Test
  public void test04_DisplayTheContentOfTheFileActivity() {
    // Declare variable
    String file = "KS_Wiki_Attachment_pdffile.pdf";
    By elementfile = By.linkText(file);
    String title = "Title of uploaded file";
    String desc = "Description of uploaded file";

    // Go to SE
    navToolBar.goToSiteExplorer();

    // Upload a file: image, pdf or office document (except personal document drive)
    ecms.uploadFile("TestData/" + file);

    // File's title if exist, or file's name instead
    // File description if exist
    info("Edit title of uploaded file");
    navToolBar.goToSiteExplorer();
    ecms.goToNode(elementfile);
    actBar.goToEditDocument(file);
    ecms.editUploadedFile(file, "", title, desc, "", "");

    // Version (if exist) and file size
    actBar.publishDocument();

    // 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", "", "1", desc, "");
    activity.checkTitleAfterEditing(file, title);

    /*Clear data*/
    info("-- Clear data --");
    navToolBar.goToSiteExplorer();
    cMenu.deleteData(elementfile);
  }
  /** == Display events with same start time and with different duration == Test case ID: 69110 */
  @Test
  public void test08_DisplayAnEventWithSameStartTimeAndWithDifferentDuration() {

    String Event = "Display events with same start time and with different duration";
    String Event_1 = "Display events with same start time and with different duration";

    info("Go to Calendar page");
    goToCalendarPage();
    info("Add events in calendar");
    event.addQuickEvent(Event, Event, getDate(1, "MM/dd/yyyy"), getDate(2, "MM/dd/yyyy"), false);
    event.addQuickEvent(
        Event_1, Event_1, getDate(1, "MM/dd/yyyy"), getDate(3, "MM/dd/yyyy"), false);
    naviToolbar.goToHomePage();
    click(ELEMENT_CALENDAR_GADGET_NEXTDAY_ARROW);
    click(ELEMENT_CALENDAR_GADGET_NEXTDAY_ARROW);
    waitForAndGetElement(ELEMENT_CALENDAR_GADGET_NEXTDAY_ARROW);
    waitForTextPresent(Event);
    waitForTextPresent(Event_1);
    Utils.pause(5000);
    goToCalendarPage();
    event.deleteEventTask(Event_1, selectDayOption.ONEDAY);
    event.deleteEventTask(Event, selectDayOption.ONEDAY);
  }
  /**
   * == Delete a File activity from intranet activity stream by owner == Test case ID: 77027 Step 1:
   * Create file activity Step 2: See delete activity icon Step 3: Delete activity
   */
  @Test
  public void test07_DeleteAFileActivityFromIntranetActivityStreamByOwner() {
    // Declare variable
    String file = "KS_Wiki_Attachment_pdffile.pdf";
    By elementfile = By.linkText(file);

    /*Step 1: Create file activity*/
    // Go to SE
    navToolBar.goToSiteExplorer();

    // 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: See delete activity icon*/
    /*Step 3: Delete activity*/
    activity.deleteActivity(file);

    // 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 --");
    navToolBar.goToSiteExplorer();
    cMenu.deleteData(elementfile);

    // *[contains(text(), 'KS_Wiki_Attachment_pdffile.pdf')]/../../../../../..//*[contains(@id,
    // 'DeleteActivityButton')]
  }
  /**
   * == Show the vertical scroll bar for list of files == Test case ID: 77815 Step 1: Open [Select
   * File] popup Step 2: Open a folder Step 3: Upload files Step 4: Add folders
   */
  @Test
  public void test12_ShowTheVerticalScrollBarForListOfFiles() {
    /*Declare variables*/
    String uploadFileName1 = "ECMS_DMS_SE_Upload_pdffile.pdf";
    String uploadFileName2 = "ECMS_DMS_SE_File.jpg";
    String folder1 = "778151";
    String folder2 = "778152";
    String driverName = "Personal Drives";
    String folderPath = "Personal Documents";
    /* Step 1: Open [Select File] popup */
    // - Connect to Intranet
    // - From [Activity Composer] box, click on [File]
    // - The pop up [Select File] is displayed
    /* Step 2: Open a folder */
    // - Select a drive from the [Select drive] list
    // - Click on a folder
    // - A drive type is selected
    // - The folder is opened
    /* Step 3: Upload files */
    // - Click on [Upload] icon
    // - Double click a file from local
    // - Do this step many times so that many files are uploaded in the current folder
    // - Files are uploaded
    selectFile(driverName, true, folderPath, "", uploadFileName1, "", false);
    button.closeWindow();
    waitForElementNotPresent(ELEMENT_SELECT_FILE_POPUP);
    selectFile(driverName, true, folderPath, "", uploadFileName2, "", false);

    // - The vertical scroll bar is displayed
    WebElement element = waitForAndGetElement(By.id("ListRecords"));
    String str1 =
        String.valueOf(
            ((JavascriptExecutor) driver)
                .executeScript("return arguments[0].clientHeight;", element));
    String str =
        String.valueOf(
            ((JavascriptExecutor) driver)
                .executeScript("return arguments[0].scrollHeight;", element));
    int clientHeight = Integer.parseInt(str1);
    int scrollHeight = Integer.parseInt(str);
    assert clientHeight < scrollHeight;
    button.closeWindow();
    waitForElementNotPresent(ELEMENT_SELECT_FILE_POPUP);

    // Clear data
    navToolBar.goToSiteExplorer();
    actBar.chooseDrive(ecms.ELEMENT_PERSONAL_DRIVE);
    actBar.actionsOnElement(uploadFileName1, actionType.DELETE, true, true);
    actBar.actionsOnElement(uploadFileName2, actionType.DELETE, true, true);
    navToolBar.goToHomePage();

    /* Step 4: Add folders */
    // - Click on [New folder] icon
    // - Input into fields
    // - Click [OK]
    selectFile(driverName, false, folderPath, "", "", folder1, false);
    button.closeWindow();
    waitForElementNotPresent(ELEMENT_SELECT_FILE_POPUP);

    // - Do this step many times so that many folders are added in the current folder
    selectFile(driverName, false, folderPath, "", "", folder2, false);
    click(By.linkText(folderPath));
    Utils.pause(500);
    // - Folders are added
    // - The vertical scroll bar is displayed
    element = waitForAndGetElement(By.id("ListRecords"));
    str1 =
        String.valueOf(
            ((JavascriptExecutor) driver)
                .executeScript("return arguments[0].clientHeight;", element));
    str =
        String.valueOf(
            ((JavascriptExecutor) driver)
                .executeScript("return arguments[0].scrollHeight;", element));
    info(str1);
    info(str);
    clientHeight = Integer.parseInt(str1);
    scrollHeight = Integer.parseInt(str);
    assert clientHeight < scrollHeight;
    button.closeWindow();
    waitForElementNotPresent(ELEMENT_SELECT_FILE_POPUP);

    // Clear data
    navToolBar.goToSiteExplorer();
    actBar.chooseDrive(ecms.ELEMENT_PERSONAL_DRIVE);
    actBar.actionsOnElement(folder1, actionType.DELETE, true, true);
    actBar.actionsOnElement(folder2, actionType.DELETE, true, true);
  }