/**
   * 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());
  }
  @Test
  public void test03_CheckMembershipNotHaveEditPagePermission_AddSpace() {
    String spaceName = "pagespace033";
    String spaceDescription = "KS_Wiki_PagePermission_Other_space_description_03_3";
    By element_space = By.linkText(spaceName);
    String title = "KS_Wiki_PagePermission_Other_Page_03_3";
    String content = "KS_Wiki_PagePermission_Other_Content_03_3";
    By element_page = By.linkText(title);
    String[] userGroup = {"Platform/Content Management", "redactor"};

    // add new space visible and open
    magMember.goToMySpacePage();
    magMember.addNewSpace(spaceName, spaceDescription, "Visible", "Open", "", "");

    info("Add a wiki page");
    goToWikiFromSpace(spaceName);
    addBlankWikiPage(title, content, 0);
    click(element_page);
    setPagePermission(userGroup, 3);
    magAc.signOut();

    info("user james belongs to membership that joins space -> check page permission");
    userJoinSpaceAndCheckPagePermission("james", spaceName, element_space, element_page, content);

    // delete space
    magAc.signIn(DATA_USER_ADMIN, DATA_PASS_ADMIN);
    magMember.restoreData(spaceName, 100000);
  }
  /**
   * == 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);
  }
  /*
   * ==Display event quick result==
   * ID :104237
   * Step 1: search 3.5
   */
  @Test
  public void test02_DisplayEventQuickResult() {
    String eventName = "Gatein 35 party" + getRandomNumber();
    String researchWord = "35";
    String eventDescription =
        "Gatein 35 has been released! It's time to make a party! Enjoy some good sounds and good sushis!";
    String eventLocation = "Tatakis Suchis bar, San Francisco";
    String spaceName = "Engineering" + getRandomNumber();
    info("Test02 - Display Event quick result");

    /*
     * Pre conditions
     */
    magMember.goToMySpacePage();
    magMember.addNewSpace(spaceName, "");
    info("New space added : " + spaceName);
    click(spaceMag.ELEMENT_SPACE_CALENDAR_PORTLET);
    evt.addQuickEvent(
        eventName,
        eventDescription,
        getDate(1, "MM/dd/yyyy 20:00"),
        getDate(1, "MM/dd/yyyy 23:00"),
        false);
    evt.editEvent(
        eventName,
        eventName,
        eventDescription,
        eventLocation,
        getDate(1, "MM/dd/yyyy 20:00"),
        getDate(1, "MM/dd/yyyy 23:00"),
        false);
    info("New event " + eventName + " create");

    /*
     * Step 1 : In search input 3.5
     */
    Utils.pause(2000);
    click(ELEMENT_QUICK_SEARCH_ICON);
    Utils.pause(2000);
    type(ELEMENT_QUICK_SEARCH_TEXTBOX, researchWord, true);
    waitForAndGetElement(
        By.xpath(
            qsPage
                .ELEMENT_QUICK_SEARCH_BOX_RESULTS
                .replace("{$result}", eventName)
                .replace("{$position}", "1")));

    info("Delete all events and tasks");
    goToCalendarPage();
    goToView(selectViewOption.LIST);
    deleteAllTaskEvent();
  }
  /**
   * 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());
  }
  /**
   * == Delete a File activity from space activity stream by owner == Test case ID: 77325 Step 1:
   * Create file activity Step 2: See delete activity icon Step 3: Delete activity
   */
  @Test
  public void test09_DeleteAFileActivityFromSpaceActivityStreamByOwner() {
    // Declare variable
    String file = "KS_Wiki_Attachment_pdffile.pdf";
    String spacename = "Space09";
    String spacedesc = "Description Of Space09";

    /*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: 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 --");
    magMember.goToMySpacePage();
    magMember.deleteSpace(spacename);
  }
  /**
   * == 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);
  }
  public void userJoinSpaceAndCheckPagePermission(
      String user, String spaceName, By element_space, By element_page, String content) {
    magAc.signIn(user, DATA_PASS_ADMIN);
    magMember.joinOpenSpace(spaceName);
    click(element_space);
    click(ELEMENT_WIKI_LINK_IN_SPACE);

    info("User can view page but can not edit page");
    click(element_page);
    waitForTextPresent(content);
    waitForElementNotPresent(ELEMENT_EDIT_PAGE_LINK);
    magAc.signOut();
  }
  /*
   * ==Search on futur events of users calendars==
   * Id : 104239
   * Step 1 : Search Event
   */
  @Test
  public void test06_SearchOnFutureEventsOfUsersCalendars() {
    String spaceName = "Engineering" + getRandomNumber();
    String calendarNamePerso = "Perso" + getRandomNumber();
    String calendarNameShare = "ShareCal" + getRandomNumber();
    String calendarDefault = "John Smith";
    String eventDescription = " ";
    String[] nomShare = {"james"};
    boolean[] editRight = {false};
    String eventName1 = "Future event" + getRandomNumber();
    String eventName2 = "Future event" + getRandomNumber();
    String eventName3 = "Future event" + getRandomNumber();
    String eventName4 = "Future event" + getRandomNumber();
    String eventName5 = "Past event" + getRandomNumber();
    String eventName6 = "Past event" + getRandomNumber();
    String eventName7 = "Past event" + getRandomNumber();
    String eventName8 = "Past event" + getRandomNumber();
    /*
     *  pre condition
     */
    info("Create the engineering space");
    magMember.goToMySpacePage();
    magMember.addNewSpace(spaceName, "");

    goToCalendarPage();
    info("Create a personal calendar");
    addCalendar(calendarNamePerso, "", "blue");

    info("Create a share calendar with James");
    addCalendar(calendarNameShare, "", "pink");
    shareCalendar(calendarNameShare, nomShare, editRight);

    info("Add one past and one future event in the default cal");
    evt.addQuickEvent(
        eventName1,
        eventDescription,
        getDate(1, "MM/dd/yyyy 14:00"),
        getDate(1, "MM/dd/yyyy 15:00"),
        false,
        calendarDefault);
    evt.addQuickEvent(
        eventName5,
        eventDescription,
        getDate(-1, "MM/dd/yyyy 06:00"),
        getDate(-1, "MM/dd/yyyy 07:00"),
        false,
        calendarDefault);

    info("Add one past and one future event in the perso cal");
    evt.addQuickEvent(
        eventName2,
        eventDescription,
        getDate(1, "MM/dd/yyyy 16:00"),
        getDate(1, "MM/dd/yyyy 17:00"),
        false,
        calendarNamePerso);
    evt.addQuickEvent(
        eventName6,
        eventDescription,
        getDate(-1, "MM/dd/yyyy 05:00"),
        getDate(-1, "MM/dd/yyyy 06:00"),
        false,
        calendarNamePerso);

    info("Add one past and one future event in the shared cal");
    evt.addQuickEvent(
        eventName3,
        eventDescription,
        getDate(1, "MM/dd/yyyy 16:00"),
        getDate(1, "MM/dd/yyyy 17:00"),
        false,
        calendarNameShare);
    evt.addQuickEvent(
        eventName7,
        eventDescription,
        getDate(-1, "MM/dd/yyyy 10:00"),
        getDate(-1, "MM/dd/yyyy 11:00"),
        false,
        calendarNameShare);

    info("Add one past and one future event in the engineering cal");
    evt.addQuickEvent(
        eventName4,
        eventDescription,
        getDate(1, "MM/dd/yyyy 18:00"),
        getDate(1, "MM/dd/yyyy 19:00"),
        false,
        spaceName);
    evt.addQuickEvent(
        eventName8,
        eventDescription,
        getDate(-1, "MM/dd/yyyy 12:00"),
        getDate(-1, "MM/dd/yyyy 13:00"),
        false,
        spaceName);

    /*
     * Step 1 : search event
     */
    qsPage.quickSearch("event");
    qsPage.searchInSearchPage(eventName1);
    waitForAndGetElement(qsPage.ELEMENT_RESULT_ITEM.replace("${keySearch}", eventName1));
    qsPage.searchInSearchPage(eventName2);
    waitForAndGetElement(qsPage.ELEMENT_RESULT_ITEM.replace("${keySearch}", eventName2));
    qsPage.searchInSearchPage(eventName3);
    waitForAndGetElement(qsPage.ELEMENT_RESULT_ITEM.replace("${keySearch}", eventName3));
    qsPage.searchInSearchPage(eventName4);
    waitForAndGetElement(qsPage.ELEMENT_RESULT_ITEM.replace("${keySearch}", eventName4));
    qsPage.searchInSearchPage(eventName5);
    waitForElementNotPresent(qsPage.ELEMENT_RESULT_ITEM.replace("${keySearch}", eventName5));
    qsPage.searchInSearchPage(eventName6);
    waitForElementNotPresent(qsPage.ELEMENT_RESULT_ITEM.replace("${keySearch}", eventName6));
    qsPage.searchInSearchPage(eventName7);
    waitForElementNotPresent(qsPage.ELEMENT_RESULT_ITEM.replace("${keySearch}", eventName7));
    qsPage.searchInSearchPage(eventName8);
    waitForElementNotPresent(qsPage.ELEMENT_RESULT_ITEM.replace("${keySearch}", eventName8));

    info("Delete all events and tasks");
    goToCalendarPage();
    goToView(selectViewOption.LIST);
    deleteAllTaskEvent();
  }
  /*
   * https://jira.exoplatform.org/browse/CAL-1117
   * Id test :104241
   * Name: Private events should only be searchable by their owner
   * Step 1 : User James search "SEARCH_EVENT_05".
   */
  @Test(groups = "pending")
  public void test05_PrivateEventsShouldOnlyBeSearchableByTheirOwner() {
    String eventDescription = "SEARCH_EVENT_05";
    String eventName1 = "Private shared" + getRandomNumber();
    String eventName2 = "Public shared" + getRandomNumber();
    String eventName3 = "Unset shared" + getRandomNumber();
    String eventName4 = "Private group" + getRandomNumber();
    String eventName5 = "Public group" + getRandomNumber();
    String eventName6 = "Unset group" + getRandomNumber();
    String spaceName = "Engineering" + getRandomNumber();
    String calendarNameShare = "CalShared" + getRandomNumber();
    String[] nomShare = {"james"};
    boolean[] edit = {false};

    goToCalendarPage();

    info("Create a share calendar with James");
    addCalendar(calendarNameShare, "", "pink");
    shareCalendar(calendarNameShare, nomShare, edit, 1);

    //		 * pre conditions

    info("Add event1 with private privacy");
    evt.addQuickEvent(
        eventName1,
        eventDescription,
        getDate(1, "MM/dd/yyyy 02:00"),
        getDate(1, "MM/dd/yyyy 03:00"),
        false,
        calendarNameShare);
    evt.goToEditEventForm(eventName1);
    click(evt.ELEMENT_PARTICIPANTS_TAB);
    check(evt.ELEMENT_PARTICIPANT_PRIVATE_RADIO, 2);
    waitForAndGetElement(ELEMENT_BUTTON_EVENT_SAVE_EDIT, DEFAULT_TIMEOUT, 1);
    click(ELEMENT_BUTTON_EVENT_SAVE_EDIT);
    waitForElementNotPresent(ELEMENT_BUTTON_EVENT_SAVE_EDIT, DEFAULT_TIMEOUT, 1);

    info("Add event2 with public shared");
    evt.addQuickEvent(
        eventName2,
        eventDescription,
        getDate(1, "MM/dd/yyyy 06:00"),
        getDate(1, "MM/dd/yyyy 07:00"),
        false,
        calendarNameShare);
    evt.goToEditEventForm(eventName2);
    click(evt.ELEMENT_PARTICIPANTS_TAB);
    check(evt.ELEMENT_PARTICIPANT_PUBLIC_RADIO, 2);
    waitForAndGetElement(ELEMENT_BUTTON_EVENT_SAVE_EDIT, DEFAULT_TIMEOUT, 1);
    click(ELEMENT_BUTTON_EVENT_SAVE_EDIT);
    waitForElementNotPresent(ELEMENT_BUTTON_EVENT_SAVE_EDIT, DEFAULT_TIMEOUT, 1);

    info("add event3 with unset privacy");
    evt.addQuickEvent(
        eventName3,
        eventDescription,
        getDate(1, "MM/dd/yyyy 08:00"),
        getDate(1, "MM/dd/yyyy 09:00"),
        false,
        calendarNameShare);

    magMember.goToMySpacePage();
    magMember.addNewSpace(spaceName, "");
    info("New space added : " + spaceName);
    click(spaceMag.ELEMENT_SPACE_CALENDAR_PORTLET);

    info("Add event3 with private privacy");
    evt.addQuickEvent(
        eventName4,
        eventDescription,
        getDate(1, "MM/dd/yyyy 10:00"),
        getDate(1, "MM/dd/yyyy 11:00"),
        false);
    evt.goToEditEventForm(eventName4);
    click(evt.ELEMENT_PARTICIPANTS_TAB);
    check(evt.ELEMENT_PARTICIPANT_PRIVATE_RADIO, 2);
    waitForAndGetElement(ELEMENT_BUTTON_EVENT_SAVE_EDIT, DEFAULT_TIMEOUT, 1);
    click(ELEMENT_BUTTON_EVENT_SAVE_EDIT);
    waitForElementNotPresent(ELEMENT_BUTTON_EVENT_SAVE_EDIT, DEFAULT_TIMEOUT, 1);

    info("Add event4 with public privacy");
    evt.addQuickEvent(
        eventName5,
        eventDescription,
        getDate(1, "MM/dd/yyyy 12:00"),
        getDate(1, "MM/dd/yyyy 13:00"),
        false);
    evt.goToEditEventForm(eventName5);
    click(evt.ELEMENT_PARTICIPANTS_TAB);
    check(evt.ELEMENT_PARTICIPANT_PUBLIC_RADIO, 2);
    waitForAndGetElement(ELEMENT_BUTTON_EVENT_SAVE_EDIT, DEFAULT_TIMEOUT, 1);
    click(ELEMENT_BUTTON_EVENT_SAVE_EDIT);
    waitForElementNotPresent(ELEMENT_BUTTON_EVENT_SAVE_EDIT, DEFAULT_TIMEOUT, 1);

    driver.navigate().refresh();
    Utils.pause(2000);

    info("Add event5 with unset privacy");
    evt.addQuickEvent(
        eventName6,
        eventDescription,
        getDate(1, "MM/dd/yyyy 14:00"),
        getDate(1, "MM/dd/yyyy 15:00"),
        false);

    info("Invit user James in space engineering ");
    click(magMember.ELEMENT_SPACE_SETTING_PORTLET);
    click(magMember.ELEMENT_MEMBER_TAB);
    magMember.inviteSingleUser("James");

    /*
     * step 1 search for  "SEARCH_EVENT_05 "
     */
    info("Log with user James");
    magAcc.userSignIn(userType.AUTHOR);
    info("Accept invitation");
    hGadget.acceptSpaceInvitationGadget(spaceName);
    driver.navigate().refresh();
    info("Search event : " + eventDescription);
    qsPage.quickSearch(eventDescription);
    qsPage.searchInSearchPage(eventDescription);
    info("Check the results");
    waitForElementNotPresent(qsPage.ELEMENT_RESULT_ITEM.replace("${keySearch}", eventName1));
    waitForAndGetElement(qsPage.ELEMENT_RESULT_ITEM.replace("${keySearch}", eventName2));
    waitForAndGetElement(qsPage.ELEMENT_RESULT_ITEM.replace("${keySearch}", eventName3));
    waitForElementNotPresent(qsPage.ELEMENT_RESULT_ITEM.replace("${keySearch}", eventName4));
    waitForAndGetElement(qsPage.ELEMENT_RESULT_ITEM.replace("${keySearch}", eventName5));
    waitForAndGetElement(qsPage.ELEMENT_RESULT_ITEM.replace("${keySearch}", eventName6));

    magAcc.signIn(DATA_USER1, DATA_PASS);
    info("Delete all events and tasks");
    goToCalendarPage();
    goToView(selectViewOption.LIST);
    deleteAllTaskEvent();
  }
  /*
   * ==Display event result==
   * Case ID : 104238
   * Step 1: In quick search input 3.5
   * PLF-5212
   */
  @Test
  public void test03_DisplayEventResult() {
    String eventName = "Gatein 35";
    String researchWord = "35";
    String eventDescription =
        "Gatein 35 has been released! It's time to make a party! Enjoy some good sounds and good sushis!";
    String eventLocation = "Tatakis Suchis bar, San Francisco";
    String spaceName = "Engineering" + getRandomNumber();
    info("Test03 - Display Event result");

    /*
     * Pre conditions
     */
    magMember.goToMySpacePage();
    magMember.addNewSpace(spaceName, "");
    info("New space added : " + spaceName);
    click(spaceMag.ELEMENT_SPACE_CALENDAR_PORTLET);
    setTimezoneForCalendar("(GMT +07:00) Asia/Ho_Chi_Minh");
    evt.addQuickEvent(
        eventName,
        eventDescription,
        getDate(1, "MM/dd/yyyy 20:00"),
        getDate(1, "MM/dd/yyyy 23:00"),
        false);
    evt.editEvent(
        eventName,
        eventName,
        eventDescription,
        eventLocation,
        getDate(1, "MM/dd/yyyy 20:00"),
        getDate(1, "MM/dd/yyyy 23:00"),
        false);
    info("New event " + eventName + " create");

    /*
     * Step 1 : In quick search input 3.5
     */
    qsPage.quickSearch(researchWord);
    qsPage.searchInSearchPage(researchWord);
    waitForAndGetElement(qsPage.ELEMENT_RESULT_ITEM.replace("${keySearch}", researchWord));
    waitForAndGetElement(
        ELEMENT_SEARCH_EVENT_ICON
            .replace("${month}", getDate(1, "MMM"))
            .replace("${date}", getDate(1, "dd")));
    waitForAndGetElement(qsPage.ELEMENT_RESULT_ITEM.replace("${keySearch}", researchWord));
    String searchTaskDate =
        waitForAndGetElement(
                qsPage
                    .ELEMENT_RESULT_LOCATION_DATETIME
                    .replace("${keySearch}", researchWord)
                    .replace("${item}", "Gatein "))
            .getText();
    String searchDate = searchTaskDate.substring(searchTaskDate.indexOf(',') + 1).trim();
    assert searchDate.contains(getDate(1, "MMM"));
    assert searchDate.contains(getDate(1, "dd"));
    assert searchDate.contains("8:00 PM");

    String comtentEvent = waitForAndGetElement(ELEMENT_RESULT_SEARCH_PAGE).getText();
    assert comtentEvent.contains(eventDescription);
    String comtentEvent1 = waitForAndGetElement(ELEMENT_RESULT_SEARCH_PAGE).getText();
    assert comtentEvent1.contains(eventLocation);
    String comtentEvent2 = waitForAndGetElement(ELEMENT_RESULT_SEARCH_PAGE).getText();
    assert comtentEvent2.contains(spaceName);

    info("Delete all events and tasks");
    goToCalendarPage();
    goToView(selectViewOption.LIST);
    deleteAllTaskEvent();
  }