@Test(
      description = "Measure the time to load the Calendar, month view, 1 appointment",
      groups = {"performance"})
  public void ZmCalendarApp_02() throws HarnessException {

    // Create an appointment
    String subject = "subject" + ZimbraSeleniumProperties.getUniqueString();
    AppointmentItem.createAppointmentSingleDay(
        app.zGetActiveAccount(),
        Calendar.getInstance(),
        60,
        null,
        subject,
        "content" + ZimbraSeleniumProperties.getUniqueString(),
        "location" + ZimbraSeleniumProperties.getUniqueString(),
        null);

    // Start the perf token
    PerfToken token =
        PerfMetrics.startTimestamp(
            PerfKey.ZmCalendarApp, "Load the calendar app, month view, 1 appointment");

    // Go to calendar
    // app.zPageCalendar.zNavigateTo();
    app.zPageCalendar.zClickAt("css=td[id='zb__App__Calendar_title']", "");

    PerfMetrics.waitTimestamp(token);

    // Wait for the app to load
    app.zPageCalendar.zWaitForActive();
  }
  /**
   * Create an all-day appointment on the server
   *
   * @param account The appointment organizer
   * @param date The appointment start date
   * @param duration The appointment duration (in days)
   * @param subject The appointment subject
   * @param content The appointment text content
   * @param location The appointment location (null if none)
   * @param attendees A list of attendees (null for none)
   * @return
   * @throws HarnessException
   */
  public static AppointmentItem createAppointmentAllDay(
      ZimbraAccount account,
      Calendar date,
      int duration,
      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 + "'");

    // Convert the calendar to a ZDate
    ZDate start =
        new ZDate(
            date.get(Calendar.YEAR),
            date.get(Calendar.MONTH) + 1,
            date.get(Calendar.DAY_OF_MONTH),
            12,
            0,
            0);

    account.soapSend(
        "<CreateAppointmentRequest xmlns='urn:zimbraMail'>"
            + "<m l='10'>"
            + "<inv>"
            + "<comp allDay='1' name='"
            + subject
            + "' "
            + loc
            + " draft='0' status='CONF' class='PUB' transp='O' fb='F'>"
            + "<s d='"
            + start.toYYYYMMDD()
            + "'/>"
            + "<e d='"
            + start.addDays(duration > 0 ? duration - 1 : 0).toYYYYMMDD()
            + "'/>"
            + "<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 + ")", start.addDays(-7), start.addDays(7));

    return (result);
  }
  @Bugs(ids = "69132")
  @Test(
      description = "Create simple all day appointment in week view",
      groups = {"smoke"})
  public void CreateAllDayAppointment_01() throws HarnessException {

    // Create appointment
    String apptSubject;
    apptSubject = "appointment" + ZimbraSeleniumProperties.getUniqueString();
    AppointmentItem appt = new AppointmentItem();

    appt.setSubject(apptSubject);
    appt.setContent("content" + ZimbraSeleniumProperties.getUniqueString());
    appt.setAttendees(ZimbraAccount.AccountA().EmailAddress);
    appt.setIsAllDay(true);

    // Open the new mail form
    FormApptNew apptForm = (FormApptNew) app.zPageCalendar.zToolbarPressButton(Button.B_NEW);
    apptForm.zFill(appt);
    apptForm.zSubmit();

    // Verify the new appointment exists on the server
    AppointmentItem actual =
        AppointmentItem.importFromSOAP(
            app.zGetActiveAccount(), "subject:(" + appt.getSubject() + ")");
    ZAssert.assertNotNull(actual, "Verify the new appointment is created");
    ZAssert.assertEquals(
        actual.getSubject(), appt.getSubject(), "Subject: Verify the appointment data");
    ZAssert.assertEquals(
        app.zGetActiveAccount()
            .soapMatch("//mail:GetAppointmentResponse//mail:comp", "allDay", "1"),
        true,
        "");

    // Verify in UI
    app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH);
    ZAssert.assertEquals(
        app.zPageCalendar.sIsElementPresent(app.zPageCalendar.zGetAllDayApptLocator(apptSubject)),
        true,
        "Verify all-day appointment present in UI");
  }
  @Bugs(ids = "69132")
  @Test(
      description = "View a basic appointment in the month view",
      groups = {"functional"})
  public void GetAppointment_01() throws HarnessException {

    // Create an appointment on the server
    String subject = "appointment" + ZimbraSeleniumProperties.getUniqueString();

    AppointmentItem.createAppointmentAllDay(
        app.zGetActiveAccount(),
        Calendar.getInstance(),
        1,
        subject,
        "content" + ZimbraSeleniumProperties.getUniqueString(),
        "location" + ZimbraSeleniumProperties.getUniqueString(),
        null);

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

    // Get the list of appointments in the current view
    List<AppointmentItem> items = app.zPageCalendar.zListGetAppointments();
    ZAssert.assertNotNull(items, "Get the list of appointments");

    // Verify the appointment is in the view
    AppointmentItem found = null;
    for (AppointmentItem item : items) {
      if (item.getSubject().equals(subject)) {
        found = item;
        break;
      }
    }

    ZAssert.assertNotNull(found, "Verify the new appointment appears in the view");
  }
Example #5
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 = "View a multi-day appointment in the month view",
      groups = {"functional"})
  public void GetAppointment_02() throws HarnessException {

    // Create an appointment on the server
    String subject = "appointment" + ZimbraSeleniumProperties.getUniqueString();

    AppointmentItem.createAppointmentAllDay(
        app.zGetActiveAccount(),
        Calendar.getInstance(),
        2,
        subject,
        "content" + ZimbraSeleniumProperties.getUniqueString(),
        "location" + ZimbraSeleniumProperties.getUniqueString(),
        null);

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

    // Verify appointment displayed in month view
    ZAssert.assertEquals(
        app.zPageCalendar.sIsElementPresent(app.zPageCalendar.zGetAllDayApptLocator(subject)),
        true,
        "Verify appointment present in month view");

    // Below code works fine for single-day all day but for multi-day all day appointment it fails
    // because it finds empty cell

    // List<AppointmentItem> items = app.zPageCalendar.zListGetAppointments();
    // ZAssert.assertNotNull(items, "Get the list of appointments");

    // Verify the appointment is in the view
    // AppointmentItem found = null;
    // for(AppointmentItem item : items) {
    //	if ( item.getSubject().equals(subject) ) {
    //		found = item;
    //		break;
    //	}
    // }

    // ZAssert.assertNotNull(found, "Verify the new appointment appears in the view");

  }
Example #7
0
  @Bugs(ids = "62137")
  @Test(
      description = "Bug 62137 - 'http://<server>?app=calendar' broken with/without login to zcs",
      groups = {"functional"})
  public void Bug62137_01() throws HarnessException {

    // Creating object for appointment data
    String tz, apptSubject, apptBody, apptAttendee;
    tz = ZTimeZone.TimeZoneEST.getID();
    apptSubject = ZimbraSeleniumProperties.getUniqueString();
    apptBody = ZimbraSeleniumProperties.getUniqueString();
    apptAttendee = 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' 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='"
                + apptAttendee
                + "' d='2'/>"
                + "</inv>"
                + "<mp content-type='text/plain'>"
                + "<content>"
                + apptBody
                + "</content>"
                + "</mp>"
                + "<su>"
                + apptSubject
                + "</su>"
                + "</m>"
                + "</CreateAppointmentRequest>");

    // Reload the application, with app=calendar query parameter
    ZimbraURI uri = new ZimbraURI(ZimbraURI.getBaseURI());
    uri.addQuery("app", "calendar");
    app.zPageCalendar.sOpen(uri.toString());

    // Verify the page becomes active
    app.zPageMain.zWaitForActive();
    app.zPageCalendar.zWaitForActive();
    ZAssert.assertTrue(app.zPageCalendar.zIsActive(), "Verify the page becomes active");

    // Verify the appointment appears in the view
    boolean found = false;
    List<AppointmentItem> items = app.zPageCalendar.zListGetAppointments();
    for (AppointmentItem item : items) {
      if (apptSubject.equals(item.getSubject())) {
        found = true;
        break;
      }
    }

    ZAssert.assertTrue(found, "Verify appt gets displayed in work week view");
  }
  @Test(
      description =
          "Create weekly recurring invite with attendee and location with every Monday, end after 2 occurrences",
      groups = {"smoke"})
  public void WeeklyEveryXdayEndAfterYoccurrences_01() throws HarnessException {

    // Create appointment data
    AppointmentItem appt = new AppointmentItem();
    String apptSubject, apptAttendee, apptContent, apptLocation;
    ZimbraResource location = new ZimbraResource(ZimbraResource.Type.LOCATION);

    apptSubject = ZimbraSeleniumProperties.getUniqueString();
    apptAttendee = ZimbraAccount.AccountA().EmailAddress;
    apptContent = ZimbraSeleniumProperties.getUniqueString();
    apptLocation = location.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),
            20,
            0,
            0);
    ZDate endUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            22,
            0,
            0);

    appt.setSubject(apptSubject);
    appt.setAttendees(apptAttendee);
    appt.setStartTime(startUTC);
    appt.setEndTime(endUTC);
    appt.setLocation(apptLocation);
    appt.setContent(apptContent);

    // Compose appointment and send it to invitee
    FormApptNew apptForm = (FormApptNew) app.zPageCalendar.zToolbarPressButton(Button.B_NEW);
    apptForm.zFill(appt);
    apptForm.zRepeat(
        Button.O_EVERY_WEEK_MENU,
        Button.B_EVERY_X_RADIO_BUTTON,
        "Monday",
        Button.B_END_AFTER_X_OCCURRENCES_RADIO_BUTTON,
        "2");
    ZAssert.assertStringContains(
        app.zPageCalendar.zGetRecurringLink(),
        "Every Monday End after 2 occurrence(s) Effective ",
        "Recurring link: Verify the appointment data");

    apptForm.zSubmit();
    SleepUtil.sleepLong(); // SOAP gives wrong response

    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");
    app.zGetActiveAccount()
        .soapSend("<GetAppointmentRequest  xmlns='urn:zimbraMail' id='" + attendeeInvId + "'/>");

    String ruleFrequency =
        app.zGetActiveAccount().soapSelectValue("//mail:appt//mail:rule", "freq");
    String count = app.zGetActiveAccount().soapSelectValue("//mail:appt//mail:count", "num");
    String interval = app.zGetActiveAccount().soapSelectValue("//mail:appt//mail:interval", "ival");
    String weekday = app.zGetActiveAccount().soapSelectValue("//mail:appt//mail:wkday", "day");

    // Verify appointment exists on server meeting with correct recurring details
    AppointmentItem actual =
        AppointmentItem.importFromSOAP(
            app.zGetActiveAccount(),
            "subject:(" + appt.getSubject() + ")",
            appt.getStartTime().addDays(-7),
            appt.getEndTime().addDays(7));
    ZAssert.assertNotNull(actual, "Verify the new appointment is created");
    ZAssert.assertEquals(
        actual.getSubject(), appt.getSubject(), "Subject: Verify the appointment data");
    ZAssert.assertEquals(
        actual.getAttendees(), apptAttendee, "Attendees: Verify the appointment data");
    ZAssert.assertEquals(
        actual.getLocation(), apptLocation, "Location: Verify the appointment data");
    ZAssert.assertEquals(ruleFrequency, "WEE", "Repeat frequency: Verify the appointment data");
    ZAssert.assertEquals(count, "2", "No. of occurrences: Verify the appointment data");
    ZAssert.assertEquals(interval, "1", "Repeat interval: Verify the appointment data");
    ZAssert.assertEquals(weekday, "MO", "Weekday: Verify the appointment data");
    ZAssert.assertEquals(
        actual.getContent(), appt.getContent(), "Content: Verify the appointment data");

    // Verify location free/busy status shows as psts=AC
    String locationStatus =
        app.zGetActiveAccount().soapSelectValue("//mail:at[@a='" + apptLocation + "']", "ptst");
    ZAssert.assertEquals(
        locationStatus, "AC", "Verify that the location status shows as 'ACCEPTED'");

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

    attendeeInvId = ZimbraAccount.AccountA().soapSelectValue("//mail:appt", "invId");
    ZimbraAccount.AccountA()
        .soapSend("<GetAppointmentRequest  xmlns='urn:zimbraMail' id='" + attendeeInvId + "'/>");

    ruleFrequency = app.zGetActiveAccount().soapSelectValue("//mail:appt//mail:rule", "freq");
    count = app.zGetActiveAccount().soapSelectValue("//mail:appt//mail:count", "num");
    interval = app.zGetActiveAccount().soapSelectValue("//mail:appt//mail:interval", "ival");
    weekday = app.zGetActiveAccount().soapSelectValue("//mail:appt//mail:wkday", "day");

    // Verify the attendee receives the meeting with correct recurring details
    AppointmentItem received =
        AppointmentItem.importFromSOAP(
            ZimbraAccount.AccountA(),
            "subject:(" + appt.getSubject() + ")",
            appt.getStartTime().addDays(-7),
            appt.getEndTime().addDays(7));
    ZAssert.assertNotNull(received, "Verify the new appointment is created");
    ZAssert.assertEquals(
        received.getSubject(), appt.getSubject(), "Subject: Verify the appointment data");
    ZAssert.assertEquals(
        received.getAttendees(), apptAttendee, "Attendees: Verify the appointment data");
    ZAssert.assertEquals(
        received.getLocation(), apptLocation, "Location: Verify the appointment data");
    ZAssert.assertEquals(ruleFrequency, "WEE", "Repeat frequency: Verify the appointment data");
    ZAssert.assertEquals(count, "2", "No. of occurrences: Verify the appointment data");
    ZAssert.assertEquals(interval, "1", "Repeat interval: Verify the appointment data");
    ZAssert.assertEquals(weekday, "MO", "Weekday: Verify the appointment data");
    ZAssert.assertEquals(
        received.getContent(), appt.getContent(), "Content: Verify the appointment data");

    // Verify the attendee receives the invitation
    MailItem invite =
        MailItem.importFromSOAP(ZimbraAccount.AccountA(), "subject:(" + appt.getSubject() + ")");
    ZAssert.assertNotNull(invite, "Verify the invite is received");
    ZAssert.assertEquals(
        invite.dSubject, appt.getSubject(), "Subject: Verify the appointment data");

    // Go to next/previous week and verify correct number of recurring instances
    app.zPageCalendar.zToolbarPressButton(Button.B_NEXT_PAGE);
    SleepUtil.sleepMedium(); // Let UI draw first and important for calendar testcases reliability
    ZAssert.assertEquals(
        app.zPageCalendar.zGetApptCountWorkWeekView(),
        2,
        "Verify correct no. of recurring instances are present in calendar view");

    app.zPageCalendar.zToolbarPressButton(Button.B_NEXT_PAGE);
    app.zPageCalendar.zToolbarPressButton(Button.B_NEXT_PAGE);
    SleepUtil.sleepMedium(); // Let UI draw first and important for calendar testcases reliability
    ZAssert.assertEquals(
        app.zPageCalendar.zGetApptCountWorkWeekView(),
        0,
        "Verify correct no. of recurring instances are present in calendar view");
  }
  @Test(
      description =
          "Close modifying appt and take action from warning dialog : Save Changes and send updates",
      groups = {"functional"})
  public void ModifyAppointment_01() throws HarnessException {

    // Create appointment data
    String tz, apptSubject, apptAttendee1, apptAttendee2;
    apptSubject = ZimbraSeleniumProperties.getUniqueString();
    apptAttendee1 = ZimbraAccount.AccountA().EmailAddress;
    apptAttendee2 = ZimbraAccount.AccountB().EmailAddress;

    // Absolute dates in UTC zone
    tz = ZTimeZone.TimeZoneEST.getID();
    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);

    // Create appointment
    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'/>"
                + "<at role='REQ' ptst='NE' rsvp='1' a='"
                + apptAttendee2
                + "' d='2'/>"
                + "</inv>"
                + "<e a='"
                + ZimbraAccount.AccountA().EmailAddress
                + "' t='t'/>"
                + "<mp content-type='text/plain'>"
                + "<content>"
                + ZimbraSeleniumProperties.getUniqueString()
                + "</content>"
                + "</mp>"
                + "<su>"
                + apptSubject
                + "</su>"
                + "</m>"
                + "</CreateAppointmentRequest>");
    app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH);

    // Remove attendee and close the appt
    app.zPageCalendar.zListItem(Action.A_DOUBLECLICK, apptSubject);
    FormApptNew apptForm = new FormApptNew(app);
    apptForm.zRemoveAttendee(apptAttendee2);
    apptForm.zToolbarPressButton(Button.B_CLOSE);

    DialogConfirmModification confirmClose =
        (DialogConfirmModification) new DialogConfirmModification(app, app.zPageCalendar);
    confirmClose.zClickButton(Button.B_SAVE_MODIFICATION);
    DialogSendUpdatetoAttendees sendUpdateDialog =
        (DialogSendUpdatetoAttendees) new DialogSendUpdatetoAttendees(app, app.zPageCalendar);
    sendUpdateDialog.zClickButton(Button.B_OK);

    // Verify if an attendee is removed from appt and attendee gets update
    AppointmentItem actual =
        AppointmentItem.importFromSOAP(app.zGetActiveAccount(), "subject:(" + apptSubject + ")");
    ZAssert.assertEquals(actual.getSubject(), apptSubject, "Subject: Verify the appointment data");
    ZAssert.assertStringDoesNotContain(
        actual.getAttendees(), apptAttendee2, "Attendees: Verify the attendee data");

    // Verify attendee2 receives cancellation message
    ZimbraAccount.AccountB()
        .soapSend(
            "<SearchRequest xmlns='urn:zimbraMail' types='message'>"
                + "<query>subject:"
                + (char) 34
                + "Cancelled: "
                + apptSubject
                + (char) 34
                + "</query>"
                + "</SearchRequest>");
    String id = ZimbraAccount.AccountB().soapSelectValue("//mail:m", "id");
    ZAssert.assertNotNull(id, "Verify attendee2 receives cancelled meeting message");

    // Verify appointment is deleted from attendee2's calendar
    AppointmentItem removedAttendee =
        AppointmentItem.importFromSOAP(ZimbraAccount.AccountB(), "subject:(" + apptSubject + ")");
    ZAssert.assertNull(removedAttendee, "Verify meeting is deleted from attendee2's calendar");
  }
  @Test(
      description =
          "Close modifying appt and take action from warning dialog : Dont save But keep open",
      groups = {"functional"})
  public void ModifyAppointment_03() throws HarnessException {

    // Creating object for appointment data
    AppointmentItem appt = new AppointmentItem();
    String tz, apptSubject, apptAttendee1, apptAttendee2, editApptSubject;
    tz = ZTimeZone.TimeZoneEST.getID();

    apptSubject = ZimbraSeleniumProperties.getUniqueString();
    editApptSubject = ZimbraSeleniumProperties.getUniqueString();
    apptAttendee1 = ZimbraAccount.AccountA().EmailAddress;
    apptAttendee2 = ZimbraAccount.AccountB().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'/>"
                + "<at role='REQ' ptst='NE' rsvp='1' a='"
                + apptAttendee2
                + "' d='2'/>"
                + "</inv>"
                + "<e a='"
                + ZimbraAccount.AccountA().EmailAddress
                + "' t='t'/>"
                + "<mp content-type='text/plain'>"
                + "<content>"
                + ZimbraSeleniumProperties.getUniqueString()
                + "</content>"
                + "</mp>"
                + "<su>"
                + apptSubject
                + "</su>"
                + "</m>"
                + "</CreateAppointmentRequest>");
    app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH);
    String apptId =
        app.zGetActiveAccount().soapSelectValue("//mail:CreateAppointmentResponse", "apptId");

    // Try to remove attendee and press close button
    app.zPageCalendar.zListItem(Action.A_DOUBLECLICK, apptSubject);
    FormApptNew apptForm = new FormApptNew(app);
    appt.setSubject(editApptSubject);
    apptForm.zRemoveAttendee(apptAttendee2);
    apptForm.zToolbarPressButton(Button.B_CLOSE);

    DialogConfirmModification confirmClose =
        (DialogConfirmModification) new DialogConfirmModification(app, app.zPageCalendar);
    confirmClose.zClickButton(Button.B_DONTSAVE_KEEP_OPEN);
    confirmClose.zClickButton(Button.B_SAVE_MODIFICATION);

    // Verify 'Save Appointment' dialog is closed
    ZAssert.assertFalse(confirmClose.zIsActive(), "Verify 'Save Appointment' dialog is closed");

    // Verify new appt page is still open
    ZAssert.assertFalse(apptForm.zVerifyNewApptTabClosed(), "Verify new appt page is still open");

    app.zGetActiveAccount()
        .soapSend("<GetAppointmentRequest  xmlns='urn:zimbraMail' id='" + apptId + "'/>");
    AppointmentItem modifyAppt =
        AppointmentItem.importFromSOAP(ZimbraAccount.AccountA(), "subject:(" + apptSubject + ")");

    // Verify that appointment subject is not modified
    ZAssert.assertEquals(
        app.zGetActiveAccount()
            .soapMatch("//mail:GetAppointmentResponse//mail:comp", "name", apptSubject),
        true,
        "");

    // Verify meeting attendees remains as it is
    ZAssert.assertStringContains(
        modifyAppt.getAttendees(),
        apptAttendee2,
        "Attendees: Verify attendee1 is present in the meeting invite");
    ZAssert.assertStringContains(
        modifyAppt.getAttendees(),
        apptAttendee1,
        "Attendees: Verify attendee2 is present in the meeting invite");
  }
Example #11
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");
  }
  @Bugs(ids = "69132")
  @Test(
      description = "Modify appointment with subject & body and verify it",
      groups = {"smoke"})
  public void ModifyAppointment_01() throws HarnessException {

    // Creating object for appointment data
    AppointmentItem appt = new AppointmentItem();
    String tz, apptSubject, apptBody, editApptSubject, editApptBody;
    tz = ZTimeZone.TimeZoneEST.getID();
    apptSubject = ZimbraSeleniumProperties.getUniqueString();
    apptBody = ZimbraSeleniumProperties.getUniqueString();
    editApptSubject = ZimbraSeleniumProperties.getUniqueString();
    editApptBody = 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", "apptId");

    // Switch to work week view
    app.zPageCalendar.zToolbarPressPulldown(Button.B_LISTVIEW, Button.O_LISTVIEW_WORKWEEK);
    app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH);

    // Open appointment & modify subject, body and save it
    app.zPageCalendar.zListItem(Action.A_DOUBLECLICK, apptSubject);
    SleepUtil.sleepMedium();
    FormApptNew apptForm = new FormApptNew(app);
    appt.setSubject(editApptSubject);
    appt.setContent(editApptBody);
    apptForm.zFill(appt);
    apptForm.zToolbarPressButton(Button.B_SAVEANDCLOSE);

    // Use GetAppointmentRequest to verify the changes are saved
    SleepUtil.sleepSmall(); // test fails without sleep
    app.zGetActiveAccount()
        .soapSend("<GetAppointmentRequest  xmlns='urn:zimbraMail' id='" + apptId + "'/>");
    ZAssert.assertEquals(
        app.zGetActiveAccount()
            .soapMatch("//mail:GetAppointmentResponse//mail:comp", "name", editApptSubject),
        true,
        "");
    ZAssert.assertEquals(
        app.zGetActiveAccount()
            .soapMatch("//mail:GetAppointmentResponse//mail:desc", null, editApptBody),
        true,
        "");
  }
  public static AppointmentItem importFromSOAP(Element GetAppointmentResponse)
      throws HarnessException {

    if (GetAppointmentResponse == null) throw new HarnessException("Element cannot be null");

    AppointmentItem appt = null;

    try {

      // Make sure we only have the GetMsgResponse part
      Element getAppointmentResponse =
          ZimbraAccount.SoapClient.selectNode(
              GetAppointmentResponse, "//mail:GetAppointmentResponse");
      if (getAppointmentResponse == null)
        throw new HarnessException("Element does not contain GetAppointmentResponse");

      Element m = ZimbraAccount.SoapClient.selectNode(getAppointmentResponse, "//mail:appt");
      if (m == null) throw new HarnessException("Element does not contain an appt element");

      // Create the object
      appt = new AppointmentItem();

      if (m != null) {

        // Appointment id
        appt.dApptID = m.getAttribute("id");
      }

      String parentFolder = m.getAttribute("l");
      if (parentFolder != null) {

        // Parent folder
        appt.dFolder = parentFolder;
      }

      Element sElement = ZimbraAccount.SoapClient.selectNode(m, "//mail:s");
      if (sElement != null) {

        // Start time
        appt.dStartTime = new ZDate(sElement);
      }

      Element eElement = ZimbraAccount.SoapClient.selectNode(m, "//mail:e");
      if (eElement != null) {

        // End time
        appt.dEndTime = new ZDate(eElement);
      }

      Element compElement = ZimbraAccount.SoapClient.selectNode(m, "//mail:comp");
      if (compElement != null) {

        // Subject
        appt.dSubject = compElement.getAttribute("name");

        // Location
        appt.dLocation = compElement.getAttribute("loc");

        // Display
        appt.dDisplay = compElement.getAttribute("fb");
      }

      Element oElement = ZimbraAccount.SoapClient.selectNode(m, "//mail:or");
      if (oElement != null) {

        // Organizer
        appt.dOrganizer = oElement.getAttribute("a");
      }
      Element mpElement = ZimbraAccount.SoapClient.selectNode(m, "//mail:mp");
      if (mpElement != null) {

        // Get multipart
        appt.dMultipart = mpElement;
      }
      // Parse the required attendees
      ArrayList<String> attendees = new ArrayList<String>();
      Element[] requiredElements =
          ZimbraAccount.SoapClient.selectNodes(m, "//mail:at[@role='REQ']");
      for (Element e : requiredElements) {
        attendees.add(e.getAttribute("a"));
      }
      if (attendees.size() > 0) {
        appt.dAttendees = AppointmentItem.StringListToCommaSeparated(attendees);
      }

      // Parse the optional attendees
      ArrayList<String> optionals = new ArrayList<String>();
      Element[] optionalElements =
          ZimbraAccount.SoapClient.selectNodes(m, "//mail:at[@role='OPT']");
      for (Element e : optionalElements) {
        optionals.add(e.getAttribute("a"));
      }
      if (optionals.size() > 0) {
        appt.dOptionals = AppointmentItem.StringListToCommaSeparated(optionals);
      }

      if (appt.dLocation == "") {

        Element equipElement = ZimbraAccount.SoapClient.selectNode(m, "//mail:at[@cutype='RES']");
        if (equipElement != null) {

          // Equipment
          appt.dEquipment = equipElement.getAttribute("a");
        }

      } else if (appt.dLocation != null) {

        Element equipElement =
            ZimbraAccount.SoapClient.selectNode(m, "//mail:at[@cutype='RES'][2]");
        if (equipElement != null) {

          // Equipment
          appt.dEquipment = equipElement.getAttribute("a");
        }
      }

      Element descElement = ZimbraAccount.SoapClient.selectNode(m, "//mail:fr");
      if (descElement != null) {

        // Body
        appt.dContent = descElement.getTextTrim();
      }

      return (appt);

    } catch (Exception e) {
      throw new HarnessException(
          "Could not parse GetMsgResponse: " + GetAppointmentResponse.prettyPrint(), e);
    } finally {
      if (appt != null) logger.info(appt.prettyPrint());
    }
  }
  /**
   * 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);
  }