/**
   * ZimbraAccount.AccountA() sends a two-hour appointment to app.zGetActiveAccount() with subject
   * and start time
   *
   * @param subject
   * @param start
   * @throws HarnessException
   */
  private void SendCreateAppointmentRequest(String subject, ZDate start) throws HarnessException {

    ZimbraAccount.AccountA()
        .soapSend(
            "<CreateAppointmentRequest xmlns='urn:zimbraMail'>"
                + "<m>"
                + "<inv method='REQUEST' type='event' status='CONF' draft='0' class='PUB' fb='B' transp='O' allDay='0' name='"
                + subject
                + "'>"
                + "<s d='"
                + start.toTimeZone(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<e d='"
                + start.addHours(2).toTimeZone(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<or a='"
                + ZimbraAccount.AccountA().EmailAddress
                + "'/>"
                + "<at role='REQ' ptst='NE' rsvp='1' a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</inv>"
                + "<e a='"
                + app.zGetActiveAccount().EmailAddress
                + "' t='t'/>"
                + "<su>"
                + subject
                + "</su>"
                + "<mp content-type='text/plain'>"
                + "<content>content</content>"
                + "</mp>"
                + "</m>"
                + "</CreateAppointmentRequest>");
  }
Exemple #2
0
	@Bugs(ids = "69132")
	@Test(	description = "View a basic all-day appointment in the work week view",
			groups = { "smoke" })
	public void GetAllDayAppointment_01() throws HarnessException {
		
		// Create the appointment on the server
		String apptSubject = "appointment" + ZimbraSeleniumProperties.getUniqueString();
		String apptLocation = "location" + ZimbraSeleniumProperties.getUniqueString();
		String apptBody = "content" + ZimbraSeleniumProperties.getUniqueString();
		
		// Absolute dates in UTC zone
		Calendar now = this.calendarWeekDayUTC;
		ZDate startUTC = new ZDate(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 12, 0, 0);
		ZDate endUTC   = new ZDate(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 14, 0, 0);
		
		// EST timezone string
		String tz = ZTimeZone.TimeZoneEST.getID();

		// Create a meeting request from AccountA to the test account
		ZimbraAccount.AccountA().soapSend(
					"<CreateAppointmentRequest xmlns='urn:zimbraMail'>" +
						"<m>" +
							"<inv>" +
								"<comp status='CONF' fb='B' class='PUB' transp='O' allDay='1' name='"+ apptSubject +"' loc='"+ apptLocation +"'>" +
									"<s d='"+ startUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() +"' tz='"+ tz +"'/>" +
									"<e d='"+ endUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() +"' tz='"+ tz +"'/>" +
									"<at role='REQ' ptst='NE' rsvp='1' a='"+ app.zGetActiveAccount().EmailAddress +"'/>" +
									"<or a='"+ ZimbraAccount.AccountA().EmailAddress + "'/>" +
								"</comp>" +
							"</inv>" +
							"<e a='"+ app.zGetActiveAccount().EmailAddress +"' t='t'/>" +
							"<su>"+ apptSubject + "</su>" +
							"<mp ct='text/plain'>" +
							"<content>"+ apptBody +"</content>" +
							"</mp>" +
						"</m>" +
					"</CreateAppointmentRequest>");
		
		AppointmentItem appt = AppointmentItem.importFromSOAP(app.zGetActiveAccount(), "subject:("+ apptSubject +")", startUTC.addDays(-7), endUTC.addDays(7));
		ZAssert.assertNotNull(appt, "Verify the new appointment is created");

		app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH);
		
		//wait for the appointment displayed in the view
		ZAssert.assertEquals(app.zPageCalendar.sIsElementPresent(app.zPageCalendar.zGetReadOnlyAllDayApptLocator(apptSubject)), true, "Verify all-day appointment is deleted");
		
	}
  @Bugs(ids = "69132")
  @Test(
      description = "Delete an appointment using Delete toolbar button",
      groups = {"smoke"})
  public void DeleteAppointment_01() throws HarnessException {

    // Creating objects for appointment data
    String tz, apptSubject, apptBody;
    tz = ZTimeZone.TimeZoneEST.getID();
    apptSubject = ZimbraSeleniumProperties.getUniqueString();
    apptBody = ZimbraSeleniumProperties.getUniqueString();

    // Absolute dates in UTC zone
    Calendar now = this.calendarWeekDayUTC;
    ZDate startUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            12,
            0,
            0);
    ZDate endUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            14,
            0,
            0);

    app.zGetActiveAccount()
        .soapSend(
            "<CreateAppointmentRequest xmlns='urn:zimbraMail'>"
                + "<m>"
                + "<inv method='REQUEST' type='event' fb='B' transp='O' allDay='0' name='"
                + apptSubject
                + "'>"
                + "<s d='"
                + startUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + tz
                + "'/>"
                + "<e d='"
                + endUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + tz
                + "'/>"
                + "<or a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</inv>"
                + "<mp content-type='text/plain'>"
                + "<content>"
                + apptBody
                + "</content>"
                + "</mp>"
                + "<su>"
                + apptSubject
                + "</su>"
                + "</m>"
                + "</CreateAppointmentRequest>");

    // Right click to appointment and delete it
    app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH);
    app.zPageCalendar.zListItem(Action.A_LEFTCLICK, apptSubject);
    DialogConfirmDeleteAppointment dlgConfirm =
        (DialogConfirmDeleteAppointment) app.zPageCalendar.zToolbarPressButton(Button.B_DELETE);
    dlgConfirm.zClickButton(Button.B_YES);
    dlgConfirm.zWaitForClose();

    ZAssert.assertEquals(
        app.zPageCalendar.zIsAppointmentExists(apptSubject),
        false,
        "Verify appointment is deleted");
  }
  @Bugs(ids = "69132")
  @Test(
      description = "Delete an appointment using keyboard shortcuts (Del & Backspace)",
      groups = {"functional"},
      dataProvider = "DataProviderShortcutKeys")
  public void DeleteAppointment_03(String name, int keyEvent) throws HarnessException {

    // Creating objects for appointment data
    String tz, apptSubject, apptBody;
    tz = ZTimeZone.TimeZoneEST.getID();
    apptSubject = ZimbraSeleniumProperties.getUniqueString();
    apptBody = ZimbraSeleniumProperties.getUniqueString();

    // Absolute dates in UTC zone
    Calendar now = this.calendarWeekDayUTC;
    ZDate startUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            12,
            0,
            0);
    ZDate endUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            14,
            0,
            0);

    app.zGetActiveAccount()
        .soapSend(
            "<CreateAppointmentRequest xmlns='urn:zimbraMail'>"
                + "<m>"
                + "<inv method='REQUEST' type='event' fb='B' transp='O' allDay='0' name='"
                + apptSubject
                + "'>"
                + "<s d='"
                + startUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + tz
                + "'/>"
                + "<e d='"
                + endUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + tz
                + "'/>"
                + "<or a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</inv>"
                + "<mp content-type='text/plain'>"
                + "<content>"
                + apptBody
                + "</content>"
                + "</mp>"
                + "<su>"
                + apptSubject
                + "</su>"
                + "</m>"
                + "</CreateAppointmentRequest>");
    String apptId =
        app.zGetActiveAccount()
            .soapSelectValue("//mail:CreateAppointmentResponse//mail:appt", "id");

    // Delete appointment using keyboard Del and Backspace key
    app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH);
    app.zPageCalendar.zListItem(Action.A_LEFTCLICK, apptSubject);
    DialogConfirmDeleteAppointment dlgConfirm =
        (DialogConfirmDeleteAppointment) app.zPageCalendar.zKeyboardKeyEvent(keyEvent);
    dlgConfirm.zClickButton(Button.B_YES);

    // -- Verification
    app.zGetActiveAccount()
        .soapSend(
            "<SearchRequest xmlns='urn:zimbraMail' types='appointment' calExpandInstStart='"
                + startUTC.addDays(-7).toMillis()
                + "' calExpandInstEnd='"
                + startUTC.addDays(7).toMillis()
                + "'>"
                + "<query>subject:("
                + apptSubject
                + ")</query>"
                + "</SearchRequest>");

    Element[] nodes = app.zGetActiveAccount().soapSelectNodes("//mail:appt");
    ZAssert.assertEquals(nodes.length, 0, "Verify appointment is deleted");
  }
Exemple #5
0
  @Bugs(ids = "69132")
  @Test(
      description = "Cancel meeting using context menu",
      groups = {"functional"})
  public void CancelMeeting_01() throws HarnessException {

    // -- Data setup

    // Creating object for meeting data
    String tz, apptSubject, apptBody, apptAttendee1;
    tz = ZTimeZone.TimeZoneEST.getID();
    apptSubject = ZimbraSeleniumProperties.getUniqueString();
    apptBody = ZimbraSeleniumProperties.getUniqueString();
    apptAttendee1 = ZimbraAccount.AccountA().EmailAddress;

    // Absolute dates in UTC zone
    Calendar now = this.calendarWeekDayUTC;
    ZDate startUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            12,
            0,
            0);
    ZDate endUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            14,
            0,
            0);

    app.zGetActiveAccount()
        .soapSend(
            "<CreateAppointmentRequest xmlns='urn:zimbraMail'>"
                + "<m>"
                + "<inv method='REQUEST' type='event' status='CONF' draft='0' class='PUB' fb='B' transp='O' allDay='0' name='"
                + apptSubject
                + "'>"
                + "<s d='"
                + startUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + tz
                + "'/>"
                + "<e d='"
                + endUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + tz
                + "'/>"
                + "<or a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "<at role='REQ' ptst='NE' rsvp='1' a='"
                + apptAttendee1
                + "' d='2'/>"
                + "</inv>"
                + "<e a='"
                + apptAttendee1
                + "' t='t'/>"
                + "<mp content-type='text/plain'>"
                + "<content>"
                + apptBody
                + "</content>"
                + "</mp>"
                + "<su>"
                + apptSubject
                + "</su>"
                + "</m>"
                + "</CreateAppointmentRequest>");
    String apptId =
        app.zGetActiveAccount().soapSelectValue("//mail:CreateAppointmentResponse", "apptId");

    // -- GUI actions

    // Refresh the view
    app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH);

    // Select the appointment
    app.zPageCalendar.zListItem(Action.A_LEFTCLICK, apptSubject);

    // Right Click -> Delete context menu
    DialogWarning dialog =
        (DialogWarning)
            app.zPageCalendar.zListItem(Action.A_RIGHTCLICK, Button.O_CANCEL_MENU, apptSubject);

    // Click Send Cancellation
    dialog.zClickButton(Button.B_SEND_CANCELLATION);

    // -- Verification

    // Verify the meeting disappears from the view
    ZAssert.assertEquals(
        app.zPageCalendar.sIsElementPresent(app.zPageCalendar.zGetApptLocator(apptSubject)),
        false,
        "Verify meeting is deleted from organizer's calendar");

    // Verify meeting is deleted from attendee's calendar
    //		AppointmentItem canceledAppt = AppointmentItem.importFromSOAP(ZimbraAccount.AccountA(),
    // "subject:("+ apptSubject +")", startUTC, endUTC);
    AppointmentItem canceledAppt =
        AppointmentItem.importFromSOAP(ZimbraAccount.AccountA(), "subject:(" + apptSubject + ")");
    ZAssert.assertNull(canceledAppt, "Verify meeting is deleted from attendee's calendar");
  }
  @Test(
      description = "Grantee views show original of the appointment from grantor's calendar",
      groups = {"functional"})
  public void ShowOriginal_01() throws HarnessException {

    String apptSubject = "appointment" + ZimbraSeleniumProperties.getUniqueString();
    String apptContent = ZimbraSeleniumProperties.getUniqueString();
    String foldername = "folder" + ZimbraSeleniumProperties.getUniqueString();
    String mountpointname = "mountpoint" + ZimbraSeleniumProperties.getUniqueString();

    Calendar now = this.calendarWeekDayUTC;
    ZDate startUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            12,
            0,
            0);
    ZDate endUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            14,
            0,
            0);

    FolderItem calendarFolder =
        FolderItem.importFromSOAP(ZimbraAccount.AccountA(), FolderItem.SystemFolder.Calendar);

    // Create a folder to share
    ZimbraAccount.AccountA()
        .soapSend(
            "<CreateFolderRequest xmlns='urn:zimbraMail'>"
                + "<folder name='"
                + foldername
                + "' l='"
                + calendarFolder.getId()
                + "'/>"
                + "</CreateFolderRequest>");

    FolderItem folder = FolderItem.importFromSOAP(ZimbraAccount.AccountA(), foldername);

    // Share it
    ZimbraAccount.AccountA()
        .soapSend(
            "<FolderActionRequest xmlns='urn:zimbraMail'>"
                + "<action id='"
                + folder.getId()
                + "' op='grant'>"
                + "<grant d='"
                + app.zGetActiveAccount().EmailAddress
                + "' gt='usr' perm='r' view='appointment'/>"
                + "</action>"
                + "</FolderActionRequest>");

    // Mount it
    app.zGetActiveAccount()
        .soapSend(
            "<CreateMountpointRequest xmlns='urn:zimbraMail'>"
                + "<link l='1' name='"
                + mountpointname
                + "'  rid='"
                + folder.getId()
                + "' zid='"
                + ZimbraAccount.AccountA().ZimbraId
                + "' view='appointment' color='5'/>"
                + "</CreateMountpointRequest>");

    // Create appointment
    ZimbraAccount.AccountA()
        .soapSend(
            "<CreateAppointmentRequest xmlns='urn:zimbraMail'>"
                + "<m l='"
                + folder.getId()
                + "' >"
                + "<inv method='REQUEST' type='event' status='CONF' draft='0' class='PUB' fb='B' transp='O' allDay='0' name='"
                + apptSubject
                + "'>"
                + "<s d='"
                + startUTC.toTimeZone(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<e d='"
                + endUTC.toTimeZone(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<or a='"
                + ZimbraAccount.AccountA().EmailAddress
                + "'/>"
                + "<at role='REQ' ptst='NE' rsvp='1' a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</inv>"
                + "<e a='"
                + app.zGetActiveAccount().EmailAddress
                + "' t='t'/>"
                + "<su>"
                + apptSubject
                + "</su>"
                + "<mp content-type='text/plain'>"
                + "<content>"
                + apptContent
                + "</content>"
                + "</mp>"
                + "</m>"
                + "</CreateAppointmentRequest>");
    app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH);

    // Mark ON to mounted calendar folder and select the appointment
    app.zTreeCalendar.zDeSelectCalendarFolder("Calendar");
    app.zTreeCalendar.zSelectMountedFolder(mountpointname);

    // Appointment show original
    SeparateWindowShowOriginal window =
        (SeparateWindowShowOriginal)
            app.zPageCalendar.zListItem(
                Action.A_RIGHTCLICK, Button.O_SHOW_ORIGINAL_MENU, apptSubject);
    try {
      window.zWaitForActive();
      SleepUtil.sleepMedium();
      ZAssert.assertTrue(window.zIsActive(), "Verify the window is active");

      String body = window.sGetBodyText();
      ZAssert.assertStringContains(body, apptSubject, "Verify subject in show original");
      ZAssert.assertStringContains(body, apptContent, "Verify content in show original");
      ZAssert.assertStringContains(body, "BEGIN:VCALENDAR", "Verify BEGIN header in show original");
      ZAssert.assertStringContains(body, "END:VCALENDAR", "Verify END header in show original");
      ZAssert.assertStringContains(
          body,
          "ORGANIZER:mailto:" + ZimbraAccount.AccountA().EmailAddress,
          "Verify organizer value in show original");

    } finally {
      if (window != null) window.zCloseWindow();
    }
  }
Exemple #7
0
  @Bugs(ids = "69132")
  @Test(
      description =
          "Delete instance of series appointment (every week) using keyboard shortcuts Del & Backspace",
      groups = {"functional"},
      dataProvider = "DataProviderShortcutKeys")
  public void DeleteInstance_06(String name, int keyEvent) throws HarnessException {

    // -- Data Setup

    // Appointment data
    String tz, apptSubject, apptBody;
    tz = ZTimeZone.TimeZoneEST.getID();
    apptSubject = "subject" + ZimbraSeleniumProperties.getUniqueString();
    apptBody = "body" + ZimbraSeleniumProperties.getUniqueString();

    // Absolute dates in UTC zone
    Calendar now = this.calendarWeekDayUTC;
    ZDate startTime =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            12,
            0,
            0);
    ZDate endTime =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            14,
            0,
            0);

    app.zGetActiveAccount()
        .soapSend(
            "<CreateAppointmentRequest xmlns='urn:zimbraMail'>"
                + "<m>"
                + "<inv method='REQUEST' type='event' fb='B' transp='O' allDay='0' name='"
                + apptSubject
                + "'>"
                + "<s d='"
                + startTime.toTimeZone(tz).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + tz
                + "'/>"
                + "<e d='"
                + endTime.toTimeZone(tz).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + tz
                + "'/>"
                + "<or a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "<recur>"
                + "<add>"
                + "<rule freq='MON'>"
                + "<interval ival='1'/>"
                + "</rule>"
                + "</add>"
                + "</recur>"
                + "</inv>"
                + "<mp content-type='text/plain'>"
                + "<content>"
                + apptBody
                + "</content>"
                + "</mp>"
                + "<su>"
                + apptSubject
                + "</su>"
                + "</m>"
                + "</CreateAppointmentRequest>");

    // -- GUI actions

    // Delete instance and verify corresponding UI
    app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH);

    app.zPageCalendar.zListItem(Action.A_LEFTCLICK, apptSubject);

    DialogWarning dialogSeriesOrInstance =
        (DialogWarning) app.zPageCalendar.zKeyboardKeyEvent(keyEvent);
    dialogSeriesOrInstance.zClickButton(Button.B_DELETE_THIS_INSTANCE);
    DialogWarning confirmDelete = (DialogWarning) dialogSeriesOrInstance.zClickButton(Button.B_OK);
    confirmDelete.zClickButton(Button.B_YES);

    // -- Verification

    // On the server, verify the appointment is in the trash
    app.zGetActiveAccount()
        .soapSend(
            "<SearchRequest xmlns='urn:zimbraMail' types='appointment' calExpandInstStart='"
                + startTime.addDays(-7).toMillis()
                + "' calExpandInstEnd='"
                + endTime.addDays(7).toMillis()
                + "'>"
                + "<query>is:anywhere "
                + apptSubject
                + "</query>"
                + "</SearchRequest>");

    // http://bugzilla.zimbra.com/show_bug.cgi?id=63412 - "Deleting instance from calendar series
    // does not allow for user restoration from the Trash can"
    // http://bugzilla.zimbra.com/show_bug.cgi?id=13527#c4 - "Moving an instance from one cal to
    // other, moves complete series"
    // For now, nothing should be returned in the SearchResponse
    //
    //		String folderID = app.zGetActiveAccount().soapSelectValue("//mail:appt", "l");
    //		ZAssert.assertEquals(
    //				folderID,
    //				FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Trash).getId(),
    //				"Verify appointment is in the trash folder");

    Element[] appts = app.zGetActiveAccount().soapSelectNodes("//mail:appt");
    ZAssert.assertEquals(
        appts.length, 0, "Verify the appt element does not exist ... See also bug 63412");

    // Verify the appointment is not in the GUI view
    // ZAssert.assertEquals(app.zPageCalendar.sIsElementPresent(app.zPageCalendar.zGetApptLocator(apptSubject)), false, "Verify instance is deleted from the calendar");
    boolean deleted =
        app.zPageCalendar.zWaitForElementDeleted(
            app.zPageCalendar.zGetApptLocator(apptSubject), "10000");
    ZAssert.assertEquals(deleted, true, "Verify instance is deleted from the calendar");
  }
  @Bugs(ids = "69132")
  @Test(
      description = "View a basic appointment in the free busy view",
      groups = {"functional"})
  public void GetAppointment_01() throws HarnessException {

    // Create the appointment on the server
    // Create the message data to be sent
    String subject = "appointment" + ZimbraSeleniumProperties.getUniqueString();

    // Absolute dates in UTC zone
    Calendar now = Calendar.getInstance();
    ZDate startUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            12,
            0,
            0);
    ZDate endUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            14,
            0,
            0);

    // EST timezone string
    String tz = ZTimeZone.TimeZoneEST.getID();

    // Create an appointment
    app.zGetActiveAccount()
        .soapSend(
            "<CreateAppointmentRequest xmlns='urn:zimbraMail'>"
                + "<m>"
                + "<inv>"
                + "<comp status='CONF' fb='B' class='PUB' transp='O' allDay='0' name='"
                + subject
                + "' >"
                + "<s d='"
                + startUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + tz
                + "'/>"
                + "<e d='"
                + endUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + tz
                + "'/>"
                + "<or a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</comp>"
                + "</inv>"
                + "<su>"
                + subject
                + "</su>"
                + "<mp ct='text/plain'>"
                + "<content>content</content>"
                + "</mp>"
                + "</m>"
                + "</CreateAppointmentRequest>");

    // -- GUI Actions

    // Go to F/B view
    SleepUtil.sleepMedium();
    app.zPageCalendar.zToolbarPressPulldown(Button.B_LISTVIEW, Button.O_LISTVIEW_FREEBUSY);

    // -- Verification

    // Verify the appointment appears on the page
    SleepUtil.sleepMedium(); // test fails without sleep because calendar view rendering takes time
    ZAssert.assertTrue(
        app.zPageCalendar.zGetApptLocatorFreeBusyView(
            app.zGetActiveAccount().EmailAddress, subject),
        "Verify attendee free/busy row exists");
  }
  @Bugs(ids = "69132")
  @Test(
      description = "Accept a meeting using Accept button from invitation message",
      groups = {"smoke"})
  public void AcceptMeeting_01() throws HarnessException {

    // ------------------------ Test data ------------------------------------

    String apptSubject = "appointment" + ZimbraSeleniumProperties.getUniqueString();

    Calendar now = Calendar.getInstance();
    ZDate startUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            12,
            0,
            0);
    ZDate endUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            14,
            0,
            0);

    // --------------- Creating invitation (organizer) ----------------------------

    ZimbraAccount.AccountA()
        .soapSend(
            "<CreateAppointmentRequest xmlns='urn:zimbraMail'>"
                + "<m>"
                + "<inv method='REQUEST' type='event' status='CONF' draft='0' class='PUB' fb='B' transp='O' allDay='0' name='"
                + apptSubject
                + "'>"
                + "<s d='"
                + startUTC.toTimeZone(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<e d='"
                + endUTC.toTimeZone(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<or a='"
                + ZimbraAccount.AccountA().EmailAddress
                + "'/>"
                + "<at role='REQ' ptst='NE' rsvp='1' a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</inv>"
                + "<e a='"
                + app.zGetActiveAccount().EmailAddress
                + "' t='t'/>"
                + "<su>"
                + apptSubject
                + "</su>"
                + "<mp content-type='text/plain'>"
                + "<content>content</content>"
                + "</mp>"
                + "</m>"
                + "</CreateAppointmentRequest>");

    // --------------- Login to attendee & accept invitation
    // ----------------------------------------------------

    // Refresh the view
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // Select the invitation
    DisplayMail display = (DisplayMail) app.zPageMail.zListItem(Action.A_LEFTCLICK, apptSubject);

    // Click Accept
    display.zPressButton(Button.B_ACCEPT);

    // ---------------- Verification at organizer & invitee side both
    // -------------------------------------

    // --- Check that the organizer shows the attendee as "ACCEPT" ---

    // Organizer: Search for the appointment (InvId)
    ZimbraAccount.AccountA()
        .soapSend(
            "<SearchRequest xmlns='urn:zimbraMail' types='appointment' calExpandInstStart='"
                + startUTC.addDays(-10).toMillis()
                + "' calExpandInstEnd='"
                + endUTC.addDays(10).toMillis()
                + "'>"
                + "<query>"
                + apptSubject
                + "</query>"
                + "</SearchRequest>");

    String organizerInvId = ZimbraAccount.AccountA().soapSelectValue("//mail:appt", "invId");

    // Get the appointment details
    ZimbraAccount.AccountA()
        .soapSend("<GetAppointmentRequest  xmlns='urn:zimbraMail' id='" + organizerInvId + "'/>");

    String attendeeStatus =
        ZimbraAccount.AccountA()
            .soapSelectValue(
                "//mail:at[@a='" + app.zGetActiveAccount().EmailAddress + "']", "ptst");

    // Verify attendee status shows as psts=AC
    ZAssert.assertEquals(attendeeStatus, "AC", "Verify that the attendee shows as 'ACCEPTED'");

    // --- Check that the attendee showing status as "ACCEPT" ---

    // Attendee: Search for the appointment (InvId)
    app.zGetActiveAccount()
        .soapSend(
            "<SearchRequest xmlns='urn:zimbraMail' types='appointment' calExpandInstStart='"
                + startUTC.addDays(-10).toMillis()
                + "' calExpandInstEnd='"
                + endUTC.addDays(10).toMillis()
                + "'>"
                + "<query>"
                + apptSubject
                + "</query>"
                + "</SearchRequest>");

    String attendeeInvId = app.zGetActiveAccount().soapSelectValue("//mail:appt", "invId");

    // Get the appointment details
    app.zGetActiveAccount()
        .soapSend("<GetAppointmentRequest  xmlns='urn:zimbraMail' id='" + attendeeInvId + "'/>");

    String myStatus =
        app.zGetActiveAccount()
            .soapSelectValue(
                "//mail:at[@a='" + app.zGetActiveAccount().EmailAddress + "']", "ptst");

    // Verify attendee status shows as psts=AC
    ZAssert.assertEquals(myStatus, "AC", "Verify that the attendee shows as 'ACCEPTED'");
  }
  @Bugs(ids = "69132")
  @Test(
      description = "Accept meeting using 'Accept -> Edit Reply' and verify modified content",
      groups = {"functional"})
  public void AcceptMeeting_04() throws HarnessException {

    // ------------------------ Test data ------------------------------------

    String apptSubject = "appointment" + ZimbraSeleniumProperties.getUniqueString();
    String modifiedBody = "modified" + ZimbraSeleniumProperties.getUniqueString();

    Calendar now = Calendar.getInstance();
    ZDate startUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            12,
            0,
            0);
    ZDate endUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            14,
            0,
            0);

    // --------------- Creating invitation (organizer) ----------------------------

    ZimbraAccount.AccountA()
        .soapSend(
            "<CreateAppointmentRequest xmlns='urn:zimbraMail'>"
                + "<m>"
                + "<inv method='REQUEST' type='event' status='CONF' draft='0' class='PUB' fb='B' transp='O' allDay='0' name='"
                + apptSubject
                + "'>"
                + "<s d='"
                + startUTC.toTimeZone(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<e d='"
                + endUTC.toTimeZone(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<or a='"
                + ZimbraAccount.AccountA().EmailAddress
                + "'/>"
                + "<at role='REQ' ptst='NE' rsvp='1' a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</inv>"
                + "<e a='"
                + app.zGetActiveAccount().EmailAddress
                + "' t='t'/>"
                + "<su>"
                + apptSubject
                + "</su>"
                + "<mp content-type='text/plain'>"
                + "<content>content</content>"
                + "</mp>"
                + "</m>"
                + "</CreateAppointmentRequest>");

    // --------------- Login to attendee & accept invitation
    // ----------------------------------------------------

    // Refresh the view
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // Select the invitation
    DisplayMail display = (DisplayMail) app.zPageMail.zListItem(Action.A_LEFTCLICK, apptSubject);

    // Click Accept -> Edit Reply , which will open a new reply compose
    FormMailNew editReply =
        (FormMailNew) display.zPressButtonPulldown(Button.B_ACCEPT, Button.O_ACCEPT_EDIT_REPLY);
    editReply.zFillField(Field.Body, modifiedBody);
    editReply.zSubmit();

    // ---------------- Verification at organizer & invitee side both
    // -------------------------------------

    // --- Check that the organizer shows the attendee as "ACCEPT" ---

    // Organizer: Search for the appointment (InvId)
    ZimbraAccount.AccountA()
        .soapSend(
            "<SearchRequest xmlns='urn:zimbraMail' types='appointment' calExpandInstStart='"
                + startUTC.addDays(-10).toMillis()
                + "' calExpandInstEnd='"
                + endUTC.addDays(10).toMillis()
                + "'>"
                + "<query>"
                + apptSubject
                + "</query>"
                + "</SearchRequest>");

    String organizerInvId = ZimbraAccount.AccountA().soapSelectValue("//mail:appt", "invId");

    // Get the appointment details
    ZimbraAccount.AccountA()
        .soapSend("<GetAppointmentRequest  xmlns='urn:zimbraMail' id='" + organizerInvId + "'/>");

    String attendeeStatus =
        ZimbraAccount.AccountA()
            .soapSelectValue(
                "//mail:at[@a='" + app.zGetActiveAccount().EmailAddress + "']", "ptst");

    // Verify attendee status shows as psts=AC
    ZAssert.assertEquals(attendeeStatus, "AC", "Verify that the attendee shows as 'ACCEPTED'");

    // --- Check that the attendee showing status as "ACCEPT" ---

    // Attendee: Search for the appointment (InvId)
    app.zGetActiveAccount()
        .soapSend(
            "<SearchRequest xmlns='urn:zimbraMail' types='appointment' calExpandInstStart='"
                + startUTC.addDays(-10).toMillis()
                + "' calExpandInstEnd='"
                + endUTC.addDays(10).toMillis()
                + "'>"
                + "<query>"
                + apptSubject
                + "</query>"
                + "</SearchRequest>");

    String attendeeInvId = app.zGetActiveAccount().soapSelectValue("//mail:appt", "invId");

    // Get the appointment details
    app.zGetActiveAccount()
        .soapSend("<GetAppointmentRequest  xmlns='urn:zimbraMail' id='" + attendeeInvId + "'/>");

    String myStatus =
        app.zGetActiveAccount()
            .soapSelectValue(
                "//mail:at[@a='" + app.zGetActiveAccount().EmailAddress + "']", "ptst");

    // Verify attendee status shows as psts=AC
    ZAssert.assertEquals(myStatus, "AC", "Verify that the attendee shows as 'ACCEPTED'");

    // Organizer: Search for the appointment response
    String inboxId =
        FolderItem.importFromSOAP(ZimbraAccount.AccountA(), FolderItem.SystemFolder.Inbox).getId();

    ZimbraAccount.AccountA()
        .soapSend(
            "<SearchRequest xmlns='urn:zimbraMail' types='message'>"
                + "<query>inid:"
                + inboxId
                + " subject:("
                + apptSubject
                + ")</query>"
                + "</SearchRequest>");

    // Verify message body content
    String body = ZimbraAccount.AccountA().soapSelectValue("//mail:m/mail:fr", null);
    ZAssert.assertStringContains(body, modifiedBody, "Verify modified body value");
  }
Exemple #11
0
  @Test(
      description =
          "Grantee opens appointment from grantor's calendar and close it without making any changes",
      groups = {"functional"})
  public void Close_01() throws HarnessException {

    String apptSubject = "appointment" + ZimbraSeleniumProperties.getUniqueString();
    String apptContent = ZimbraSeleniumProperties.getUniqueString();
    String foldername = "folder" + ZimbraSeleniumProperties.getUniqueString();
    String mountpointname = "mountpoint" + ZimbraSeleniumProperties.getUniqueString();

    Calendar now = this.calendarWeekDayUTC;
    ZDate startUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            12,
            0,
            0);
    ZDate endUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            14,
            0,
            0);

    FolderItem calendarFolder =
        FolderItem.importFromSOAP(ZimbraAccount.AccountA(), FolderItem.SystemFolder.Calendar);

    // Create a folder to share
    ZimbraAccount.AccountA()
        .soapSend(
            "<CreateFolderRequest xmlns='urn:zimbraMail'>"
                + "<folder name='"
                + foldername
                + "' l='"
                + calendarFolder.getId()
                + "' view='appointment'/>"
                + "</CreateFolderRequest>");

    FolderItem folder = FolderItem.importFromSOAP(ZimbraAccount.AccountA(), foldername);

    // Share it
    ZimbraAccount.AccountA()
        .soapSend(
            "<FolderActionRequest xmlns='urn:zimbraMail'>"
                + "<action id='"
                + folder.getId()
                + "' op='grant'>"
                + "<grant d='"
                + app.zGetActiveAccount().EmailAddress
                + "' gt='usr' perm='r' view='appointment'/>"
                + "</action>"
                + "</FolderActionRequest>");

    // Mount it
    app.zGetActiveAccount()
        .soapSend(
            "<CreateMountpointRequest xmlns='urn:zimbraMail'>"
                + "<link l='1' name='"
                + mountpointname
                + "'  rid='"
                + folder.getId()
                + "' zid='"
                + ZimbraAccount.AccountA().ZimbraId
                + "' view='appointment' color='5'/>"
                + "</CreateMountpointRequest>");

    // Create appointment
    ZimbraAccount.AccountA()
        .soapSend(
            "<CreateAppointmentRequest xmlns='urn:zimbraMail'>"
                + "<m l='"
                + folder.getId()
                + "' >"
                + "<inv method='REQUEST' type='event' status='CONF' draft='0' class='PUB' fb='B' transp='O' allDay='0' name='"
                + apptSubject
                + "'>"
                + "<s d='"
                + startUTC.toTimeZone(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<e d='"
                + endUTC.toTimeZone(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<or a='"
                + ZimbraAccount.AccountA().EmailAddress
                + "'/>"
                + "<at role='REQ' ptst='NE' rsvp='1' a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</inv>"
                + "<e a='"
                + app.zGetActiveAccount().EmailAddress
                + "' t='t'/>"
                + "<su>"
                + apptSubject
                + "</su>"
                + "<mp content-type='text/plain'>"
                + "<content>"
                + apptContent
                + "</content>"
                + "</mp>"
                + "</m>"
                + "</CreateAppointmentRequest>");
    app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH);

    // Mark ON to mounted calendar folder and select the appointment
    app.zTreeCalendar.zMarkOnOffCalendarFolder("Calendar");
    app.zTreeCalendar.zMarkOnOffMountedFolder(mountpointname);

    // Open appointment
    app.zPageCalendar.zListItem(Action.A_RIGHTCLICK, Button.O_OPEN_MENU, apptSubject);
    app.zPageCalendar.zToolbarPressButton(Button.B_CLOSE);

    // Make sure there is no warning or any other dialog (below code should fail if any)
    app.zPageCalendar.zListItem(Action.A_RIGHTCLICK, Button.O_OPEN_MENU, apptSubject);
    app.zPageCalendar.zToolbarPressButton(Button.B_CLOSE);
  }
  /**
   * Create a single-day appointment on the server
   *
   * @param account Appointment Organizer
   * @param start Start time of the appointment, which will be rounded to the nearest hour
   * @param duration Duration of the appointment, in minutes
   * @param timezone Timezone of the appointment (null if default)
   * @param subject Subject of the appointment
   * @param content Content of the appointment (text)
   * @param location Location of the appointment (null if none)
   * @param attendees List of attendees for the appointment
   * @return
   * @throws HarnessException
   */
  public static AppointmentItem createAppointmentSingleDay(
      ZimbraAccount account,
      Calendar start,
      int duration,
      TimeZone tz,
      String subject,
      String content,
      String location,
      List<ZimbraAccount> attendees)
      throws HarnessException {

    // If location is null, don't specify the loc attribute
    String loc = (location == null ? "" : "loc='" + location + "'");

    // TODO: determine the timezone
    String timezoneString = ZTimeZone.TimeZoneEST.getID();

    // Convert the calendar to a ZDate
    ZDate beginning =
        new ZDate(
            start.get(Calendar.YEAR),
            start.get(Calendar.MONTH) + 1,
            start.get(Calendar.DAY_OF_MONTH),
            start.get(Calendar.HOUR_OF_DAY),
            0,
            0);
    ZDate ending = beginning.addMinutes(duration);

    account.soapSend(
        "<CreateAppointmentRequest xmlns='urn:zimbraMail'>"
            + "<m l='10'>"
            + "<inv>"
            + "<comp name='"
            + subject
            + "' "
            + loc
            + " draft='0' status='CONF' class='PUB' transp='O' fb='B'>"
            + "<s d='"
            + beginning.toTimeZone(timezoneString).toYYYYMMDDTHHMMSS()
            + "' tz='"
            + timezoneString
            + "'/>"
            + "<e d='"
            + ending.toTimeZone(timezoneString).toYYYYMMDDTHHMMSS()
            + "' tz='"
            + timezoneString
            + "'/>"
            + "<or a='"
            + account.EmailAddress
            + "'/>"
            + "</comp>"
            + "</inv>"
            + "<su>"
            + subject
            + "</su>"
            + "<mp ct='text/plain'>"
            + "<content>"
            + content
            + "</content>"
            + "</mp>"
            + "</m>"
            + "</CreateAppointmentRequest>");

    AppointmentItem result =
        AppointmentItem.importFromSOAP(
            account, "subject:(" + subject + ")", beginning.addDays(-7), beginning.addDays(7));

    return (result);
  }