@Test(dependsOnMethods = "testIsTagPresent", timeOut = 60000) public void testEditEvent() { calendarPage = calendarPage.chooseMonthTab().render(); assertNotNull(calendarPage, "Calendar page month tab isn't opened"); Assert.assertTrue(calendarPage.isEventPresent(CalendarPage.EventType.MONTH_TAB_SINGLE_EVENT, event1), "The " + event1 + " isn't correctly displayed on the month tab"); calendarPage = calendarPage.editEvent(event1, CalendarPage.EventType.MONTH_TAB_SINGLE_EVENT, CalendarPage.ActionEventVia.MONTH_TAB, edit_event1_what, edit_event1_where, edit_event1_description, null, null, null, null, null, false, null).render(); }
public CalendarPage editEvent(String eventName, EventType eventType, ActionEventVia editEventVia, String whatField, String whereField, String description, String startDate, String startTime, String endDate, String endTime, String tags, boolean allDay, String[] removeTag) { logger.info("Edit event with name " + whatField); try { EditEventForm editEventForm = null; CalendarPage calendarPage = new CalendarPage(drone); CalendarContainer calendarContainer = new CalendarContainer(drone); InformationEventForm informationEventForm; if (editEventVia != null) { switch (editEventVia) { case DAY_TAB: calendarPage = (CalendarPage) calendarPage.chooseDayTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; case WEEK_TAB: calendarPage = (CalendarPage) calendarPage.chooseWeekTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; case MONTH_TAB: calendarPage = (CalendarPage) calendarPage.chooseMonthTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; case AGENDA_TAB: calendarPage = (CalendarPage) calendarPage.chooseAgendaTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; default: break; } } else { throw new IllegalArgumentException("Parameter editEventVia is required"); } if (whatField != null && !whatField.isEmpty()) { editEventForm.setWhatField(whatField); } if (whereField != null && !whereField.isEmpty()) { editEventForm.setWhereField(whereField); } if (description != null && !description.isEmpty()) { editEventForm.setDescriptionField(description); } if (description != null && !description.isEmpty()) { editEventForm.setDescriptionField(description); } if (startDate != null && !startDate.isEmpty()) { editEventForm.clickStartDatePicker(); calendarContainer.setDate(startDate); } if (startTime != null && !startTime.isEmpty()) { editEventForm.setStartTimeField(startTime); } if (endDate != null && !endDate.isEmpty()) { editEventForm.clickEndDatePicker(); calendarContainer.setDate(endDate); } if (endTime != null && !endTime.isEmpty()) { editEventForm.setEndTimeField(endTime); } if (tags != null) { editEventForm.setTagsField(tags); editEventForm.clickAddTag(); } if (allDay) { editEventForm.setAllDayCheckbox(); } if (removeTag != null) { editEventForm.removeTag(removeTag); } editEventForm.clickSave(); } catch (TimeoutException te) { logger.debug("The operation has timed out"); } catch (NoSuchElementException nse) { logger.debug("Unable to find the elements"); } drone.waitUntilElementDisappears(EDIT_PANEL, TimeUnit.SECONDS.convert(WAIT_TIME_3000, TimeUnit.MILLISECONDS)); if (tags != null) { String tagXpath = String.format(TAG_LINK, tags.split(" ")[0]); drone.waitUntilElementPresent(By.xpath(tagXpath), TimeUnit.SECONDS.convert(WAIT_TIME_3000, TimeUnit.MILLISECONDS)); } if (removeTag != null) { String tagXpath = String.format(TAG_LINK, removeTag[0]); drone.waitUntilElementDisappears(By.xpath(tagXpath), TimeUnit.SECONDS.convert(WAIT_TIME_3000, TimeUnit.MILLISECONDS)); } return new CalendarPage(drone); }
CalendarPage extends SitePage { public CalendarPage editEvent(String eventName, EventType eventType, ActionEventVia editEventVia, String whatField, String whereField, String description, String startDate, String startTime, String endDate, String endTime, String tags, boolean allDay, String[] removeTag) { logger.info("Edit event with name " + whatField); try { EditEventForm editEventForm = null; CalendarPage calendarPage = new CalendarPage(drone); CalendarContainer calendarContainer = new CalendarContainer(drone); InformationEventForm informationEventForm; if (editEventVia != null) { switch (editEventVia) { case DAY_TAB: calendarPage = (CalendarPage) calendarPage.chooseDayTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; case WEEK_TAB: calendarPage = (CalendarPage) calendarPage.chooseWeekTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; case MONTH_TAB: calendarPage = (CalendarPage) calendarPage.chooseMonthTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; case AGENDA_TAB: calendarPage = (CalendarPage) calendarPage.chooseAgendaTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; default: break; } } else { throw new IllegalArgumentException("Parameter editEventVia is required"); } if (whatField != null && !whatField.isEmpty()) { editEventForm.setWhatField(whatField); } if (whereField != null && !whereField.isEmpty()) { editEventForm.setWhereField(whereField); } if (description != null && !description.isEmpty()) { editEventForm.setDescriptionField(description); } if (description != null && !description.isEmpty()) { editEventForm.setDescriptionField(description); } if (startDate != null && !startDate.isEmpty()) { editEventForm.clickStartDatePicker(); calendarContainer.setDate(startDate); } if (startTime != null && !startTime.isEmpty()) { editEventForm.setStartTimeField(startTime); } if (endDate != null && !endDate.isEmpty()) { editEventForm.clickEndDatePicker(); calendarContainer.setDate(endDate); } if (endTime != null && !endTime.isEmpty()) { editEventForm.setEndTimeField(endTime); } if (tags != null) { editEventForm.setTagsField(tags); editEventForm.clickAddTag(); } if (allDay) { editEventForm.setAllDayCheckbox(); } if (removeTag != null) { editEventForm.removeTag(removeTag); } editEventForm.clickSave(); } catch (TimeoutException te) { logger.debug("The operation has timed out"); } catch (NoSuchElementException nse) { logger.debug("Unable to find the elements"); } drone.waitUntilElementDisappears(EDIT_PANEL, TimeUnit.SECONDS.convert(WAIT_TIME_3000, TimeUnit.MILLISECONDS)); if (tags != null) { String tagXpath = String.format(TAG_LINK, tags.split(" ")[0]); drone.waitUntilElementPresent(By.xpath(tagXpath), TimeUnit.SECONDS.convert(WAIT_TIME_3000, TimeUnit.MILLISECONDS)); } if (removeTag != null) { String tagXpath = String.format(TAG_LINK, removeTag[0]); drone.waitUntilElementDisappears(By.xpath(tagXpath), TimeUnit.SECONDS.convert(WAIT_TIME_3000, TimeUnit.MILLISECONDS)); } return new CalendarPage(drone); } }
CalendarPage extends SitePage { public CalendarPage editEvent(String eventName, EventType eventType, ActionEventVia editEventVia, String whatField, String whereField, String description, String startDate, String startTime, String endDate, String endTime, String tags, boolean allDay, String[] removeTag) { logger.info("Edit event with name " + whatField); try { EditEventForm editEventForm = null; CalendarPage calendarPage = new CalendarPage(drone); CalendarContainer calendarContainer = new CalendarContainer(drone); InformationEventForm informationEventForm; if (editEventVia != null) { switch (editEventVia) { case DAY_TAB: calendarPage = (CalendarPage) calendarPage.chooseDayTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; case WEEK_TAB: calendarPage = (CalendarPage) calendarPage.chooseWeekTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; case MONTH_TAB: calendarPage = (CalendarPage) calendarPage.chooseMonthTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; case AGENDA_TAB: calendarPage = (CalendarPage) calendarPage.chooseAgendaTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; default: break; } } else { throw new IllegalArgumentException("Parameter editEventVia is required"); } if (whatField != null && !whatField.isEmpty()) { editEventForm.setWhatField(whatField); } if (whereField != null && !whereField.isEmpty()) { editEventForm.setWhereField(whereField); } if (description != null && !description.isEmpty()) { editEventForm.setDescriptionField(description); } if (description != null && !description.isEmpty()) { editEventForm.setDescriptionField(description); } if (startDate != null && !startDate.isEmpty()) { editEventForm.clickStartDatePicker(); calendarContainer.setDate(startDate); } if (startTime != null && !startTime.isEmpty()) { editEventForm.setStartTimeField(startTime); } if (endDate != null && !endDate.isEmpty()) { editEventForm.clickEndDatePicker(); calendarContainer.setDate(endDate); } if (endTime != null && !endTime.isEmpty()) { editEventForm.setEndTimeField(endTime); } if (tags != null) { editEventForm.setTagsField(tags); editEventForm.clickAddTag(); } if (allDay) { editEventForm.setAllDayCheckbox(); } if (removeTag != null) { editEventForm.removeTag(removeTag); } editEventForm.clickSave(); } catch (TimeoutException te) { logger.debug("The operation has timed out"); } catch (NoSuchElementException nse) { logger.debug("Unable to find the elements"); } drone.waitUntilElementDisappears(EDIT_PANEL, TimeUnit.SECONDS.convert(WAIT_TIME_3000, TimeUnit.MILLISECONDS)); if (tags != null) { String tagXpath = String.format(TAG_LINK, tags.split(" ")[0]); drone.waitUntilElementPresent(By.xpath(tagXpath), TimeUnit.SECONDS.convert(WAIT_TIME_3000, TimeUnit.MILLISECONDS)); } if (removeTag != null) { String tagXpath = String.format(TAG_LINK, removeTag[0]); drone.waitUntilElementDisappears(By.xpath(tagXpath), TimeUnit.SECONDS.convert(WAIT_TIME_3000, TimeUnit.MILLISECONDS)); } return new CalendarPage(drone); } CalendarPage(WebDrone drone); }
CalendarPage extends SitePage { public CalendarPage editEvent(String eventName, EventType eventType, ActionEventVia editEventVia, String whatField, String whereField, String description, String startDate, String startTime, String endDate, String endTime, String tags, boolean allDay, String[] removeTag) { logger.info("Edit event with name " + whatField); try { EditEventForm editEventForm = null; CalendarPage calendarPage = new CalendarPage(drone); CalendarContainer calendarContainer = new CalendarContainer(drone); InformationEventForm informationEventForm; if (editEventVia != null) { switch (editEventVia) { case DAY_TAB: calendarPage = (CalendarPage) calendarPage.chooseDayTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; case WEEK_TAB: calendarPage = (CalendarPage) calendarPage.chooseWeekTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; case MONTH_TAB: calendarPage = (CalendarPage) calendarPage.chooseMonthTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; case AGENDA_TAB: calendarPage = (CalendarPage) calendarPage.chooseAgendaTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; default: break; } } else { throw new IllegalArgumentException("Parameter editEventVia is required"); } if (whatField != null && !whatField.isEmpty()) { editEventForm.setWhatField(whatField); } if (whereField != null && !whereField.isEmpty()) { editEventForm.setWhereField(whereField); } if (description != null && !description.isEmpty()) { editEventForm.setDescriptionField(description); } if (description != null && !description.isEmpty()) { editEventForm.setDescriptionField(description); } if (startDate != null && !startDate.isEmpty()) { editEventForm.clickStartDatePicker(); calendarContainer.setDate(startDate); } if (startTime != null && !startTime.isEmpty()) { editEventForm.setStartTimeField(startTime); } if (endDate != null && !endDate.isEmpty()) { editEventForm.clickEndDatePicker(); calendarContainer.setDate(endDate); } if (endTime != null && !endTime.isEmpty()) { editEventForm.setEndTimeField(endTime); } if (tags != null) { editEventForm.setTagsField(tags); editEventForm.clickAddTag(); } if (allDay) { editEventForm.setAllDayCheckbox(); } if (removeTag != null) { editEventForm.removeTag(removeTag); } editEventForm.clickSave(); } catch (TimeoutException te) { logger.debug("The operation has timed out"); } catch (NoSuchElementException nse) { logger.debug("Unable to find the elements"); } drone.waitUntilElementDisappears(EDIT_PANEL, TimeUnit.SECONDS.convert(WAIT_TIME_3000, TimeUnit.MILLISECONDS)); if (tags != null) { String tagXpath = String.format(TAG_LINK, tags.split(" ")[0]); drone.waitUntilElementPresent(By.xpath(tagXpath), TimeUnit.SECONDS.convert(WAIT_TIME_3000, TimeUnit.MILLISECONDS)); } if (removeTag != null) { String tagXpath = String.format(TAG_LINK, removeTag[0]); drone.waitUntilElementDisappears(By.xpath(tagXpath), TimeUnit.SECONDS.convert(WAIT_TIME_3000, TimeUnit.MILLISECONDS)); } return new CalendarPage(drone); } CalendarPage(WebDrone drone); @SuppressWarnings("unchecked") @Override CalendarPage render(RenderTime timer); @SuppressWarnings("unchecked") @Override CalendarPage render(); @SuppressWarnings("unchecked") @Override CalendarPage render(long time); AddEventForm clickOnAddEvent(); AddEventForm clickOnTabOrButtonAddEvent(ActionEventVia createEventVia); CalendarPage createEvent(String whatField, String whereField, String description, boolean allDay); CalendarPage createEvent(ActionEventVia createEventVia, String whatField, String whereField, String description, String startDate, String startTime, String endDate, String endTime, String tags, boolean allDay); CalendarPage createEvent(ActionEventVia createEventVia, String whatField, String whereField, String description, String startYear, String startMonth, String startDate, String startTime, String endYear, String endMonth, String endDate, String endTime, String tags, boolean allDay); boolean isAddEventPresent(); CalendarPage editEvent(String eventName, EventType eventType, ActionEventVia editEventVia, String whatField, String whereField, String description, String startDate, String startTime, String endDate, String endTime, String tags, boolean allDay, String[] removeTag); CalendarPage deleteEvent(String eventName, EventType eventType, ActionEventVia editEventVia); HtmlPage chooseDayTab(); HtmlPage chooseWeekTab(); HtmlPage chooseMonthTab(); HtmlPage chooseAgendaTab(); boolean isDayTabOpened(); boolean isWeekTabOpened(); boolean isMonthTabOpened(); boolean isAgendaTabOpened(); boolean isEventPresent(EventType eventType, String eventName); CalendarPage showAllHours(); boolean showAllHoursButtonDisplayed(); CalendarPage showWorkingHours(); boolean showWorkingHoursButtonDisplayed(); boolean checkTableHours(HoursFromTable xpath); InformationEventForm clickOnEvent(EventType eventType, String eventName); String clickIcalFeedButton(); String getIcalFeedHref(); boolean isShowAllItemsPresent(); CalendarPage clickShowAllItems(); boolean isTagPresent(String tagName); CalendarPage clickTagLink(String tagName); boolean isAddEventClickable(ActionEventVia viaTab); int getTheNumOfEvents(ActionEventVia viaTab); }
CalendarPage extends SitePage { public CalendarPage editEvent(String eventName, EventType eventType, ActionEventVia editEventVia, String whatField, String whereField, String description, String startDate, String startTime, String endDate, String endTime, String tags, boolean allDay, String[] removeTag) { logger.info("Edit event with name " + whatField); try { EditEventForm editEventForm = null; CalendarPage calendarPage = new CalendarPage(drone); CalendarContainer calendarContainer = new CalendarContainer(drone); InformationEventForm informationEventForm; if (editEventVia != null) { switch (editEventVia) { case DAY_TAB: calendarPage = (CalendarPage) calendarPage.chooseDayTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; case WEEK_TAB: calendarPage = (CalendarPage) calendarPage.chooseWeekTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; case MONTH_TAB: calendarPage = (CalendarPage) calendarPage.chooseMonthTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; case AGENDA_TAB: calendarPage = (CalendarPage) calendarPage.chooseAgendaTab(); informationEventForm = calendarPage.clickOnEvent(eventType, eventName); editEventForm = informationEventForm.clickOnEditEvent(); break; default: break; } } else { throw new IllegalArgumentException("Parameter editEventVia is required"); } if (whatField != null && !whatField.isEmpty()) { editEventForm.setWhatField(whatField); } if (whereField != null && !whereField.isEmpty()) { editEventForm.setWhereField(whereField); } if (description != null && !description.isEmpty()) { editEventForm.setDescriptionField(description); } if (description != null && !description.isEmpty()) { editEventForm.setDescriptionField(description); } if (startDate != null && !startDate.isEmpty()) { editEventForm.clickStartDatePicker(); calendarContainer.setDate(startDate); } if (startTime != null && !startTime.isEmpty()) { editEventForm.setStartTimeField(startTime); } if (endDate != null && !endDate.isEmpty()) { editEventForm.clickEndDatePicker(); calendarContainer.setDate(endDate); } if (endTime != null && !endTime.isEmpty()) { editEventForm.setEndTimeField(endTime); } if (tags != null) { editEventForm.setTagsField(tags); editEventForm.clickAddTag(); } if (allDay) { editEventForm.setAllDayCheckbox(); } if (removeTag != null) { editEventForm.removeTag(removeTag); } editEventForm.clickSave(); } catch (TimeoutException te) { logger.debug("The operation has timed out"); } catch (NoSuchElementException nse) { logger.debug("Unable to find the elements"); } drone.waitUntilElementDisappears(EDIT_PANEL, TimeUnit.SECONDS.convert(WAIT_TIME_3000, TimeUnit.MILLISECONDS)); if (tags != null) { String tagXpath = String.format(TAG_LINK, tags.split(" ")[0]); drone.waitUntilElementPresent(By.xpath(tagXpath), TimeUnit.SECONDS.convert(WAIT_TIME_3000, TimeUnit.MILLISECONDS)); } if (removeTag != null) { String tagXpath = String.format(TAG_LINK, removeTag[0]); drone.waitUntilElementDisappears(By.xpath(tagXpath), TimeUnit.SECONDS.convert(WAIT_TIME_3000, TimeUnit.MILLISECONDS)); } return new CalendarPage(drone); } CalendarPage(WebDrone drone); @SuppressWarnings("unchecked") @Override CalendarPage render(RenderTime timer); @SuppressWarnings("unchecked") @Override CalendarPage render(); @SuppressWarnings("unchecked") @Override CalendarPage render(long time); AddEventForm clickOnAddEvent(); AddEventForm clickOnTabOrButtonAddEvent(ActionEventVia createEventVia); CalendarPage createEvent(String whatField, String whereField, String description, boolean allDay); CalendarPage createEvent(ActionEventVia createEventVia, String whatField, String whereField, String description, String startDate, String startTime, String endDate, String endTime, String tags, boolean allDay); CalendarPage createEvent(ActionEventVia createEventVia, String whatField, String whereField, String description, String startYear, String startMonth, String startDate, String startTime, String endYear, String endMonth, String endDate, String endTime, String tags, boolean allDay); boolean isAddEventPresent(); CalendarPage editEvent(String eventName, EventType eventType, ActionEventVia editEventVia, String whatField, String whereField, String description, String startDate, String startTime, String endDate, String endTime, String tags, boolean allDay, String[] removeTag); CalendarPage deleteEvent(String eventName, EventType eventType, ActionEventVia editEventVia); HtmlPage chooseDayTab(); HtmlPage chooseWeekTab(); HtmlPage chooseMonthTab(); HtmlPage chooseAgendaTab(); boolean isDayTabOpened(); boolean isWeekTabOpened(); boolean isMonthTabOpened(); boolean isAgendaTabOpened(); boolean isEventPresent(EventType eventType, String eventName); CalendarPage showAllHours(); boolean showAllHoursButtonDisplayed(); CalendarPage showWorkingHours(); boolean showWorkingHoursButtonDisplayed(); boolean checkTableHours(HoursFromTable xpath); InformationEventForm clickOnEvent(EventType eventType, String eventName); String clickIcalFeedButton(); String getIcalFeedHref(); boolean isShowAllItemsPresent(); CalendarPage clickShowAllItems(); boolean isTagPresent(String tagName); CalendarPage clickTagLink(String tagName); boolean isAddEventClickable(ActionEventVia viaTab); int getTheNumOfEvents(ActionEventVia viaTab);  }