class CompletedShiftsPage(BasePage): view_hours_page = PageUrls.completed_shifts_page def __init__(self, driver): self.driver = driver self.home_page = HomePage(self.driver) self.elements = CompletedShiftsPageLocators() super(CompletedShiftsPage, self).__init__(driver) def go_to_completed_shifts(self): self.home_page.get_completed_shifts_link().click() def edit_hours(self, stime, etime): self.element_by_xpath(self.elements.SHIFT_EDIT_PATH + '//a').click() self.log_shift_timings(stime, etime) def log_shift_timings(self, stime, etime): self.element_by_xpath(self.elements.START_TIME_FORM).clear() self.send_value_to_xpath(self.elements.START_TIME_FORM, stime) self.element_by_xpath(self.elements.END_TIME_FORM).clear() self.send_value_to_xpath(self.elements.END_TIME_FORM, etime) self.submit_form() def submit_form(self): self.element_by_xpath(self.elements.SUBMIT_PATH).submit() def get_info_box(self): return self.element_by_class_name(self.elements.INFO_BOX).text def get_danger_box(self): return self.element_by_class_name(self.elements.DANGER_BOX) def get_shift_job(self): return self.element_by_xpath(self.elements.SHIFT_JOB_PATH).text def get_shift_date(self): return self.element_by_xpath(self.elements.SHIFT_DATE_PATH).text def get_shift_start_time(self): return self.element_by_xpath(self.elements.SHIFT_STIME_PATH).text def get_shift_end_time(self): return self.element_by_xpath(self.elements.SHIFT_ETIME_PATH).text def get_clear_shift_hours(self): return self.element_by_xpath(self.elements.SHIFT_CLEAR_PATH).text def get_edit_shift_hours(self): return self.element_by_xpath(self.elements.SHIFT_EDIT_PATH).text def get_clear_shift_hours_text(self): return self.element_by_xpath(self.elements.CLEAR_SHIFT_HOURS_TEXT).text def click_to_clear_hours(self): self.element_by_xpath(self.elements.SHIFT_CLEAR_PATH + '//a').click()
class UpcomingShiftsPage(BasePage): view_shift_page = PageUrls.upcoming_shifts_page no_shift_message = 'You do not have any upcoming shifts.' def __init__(self, driver): self.driver = driver self.home_page = HomePage(self.driver) self.completed_shifts_page = CompletedShiftsPage(self.driver) self.elements = UpcomingShiftsPageLocators() super(UpcomingShiftsPage, self).__init__(driver) def view_upcoming_shifts(self): self.home_page.get_upcoming_shifts_link().send_keys('\n') def submit_form(self): self.element_by_xpath(self.elements.SUBMIT_PATH).submit() def get_info_box(self): return self.element_by_class_name(self.elements.INFO_BOX).text def get_result_container(self): return self.element_by_xpath(self.elements.CONTAINER) def get_shift_job(self): return self.element_by_xpath(self.elements.SHIFT_JOB_PATH).text def get_shift_date(self): return self.element_by_xpath(self.elements.SHIFT_DATE_PATH).text def get_shift_start_time(self): return self.element_by_xpath(self.elements.SHIFT_STIME_PATH).text def get_shift_end_time(self): return self.element_by_xpath(self.elements.SHIFT_ETIME_PATH).text def get_log_hours(self): return self.element_by_xpath(self.elements.LOG_SHIFT_HOURS_PATH).text def click_to_log_hours(self): self.element_by_xpath(self.elements.LOG_SHIFT_HOURS_PATH + "//a").click() def log_shift_timings(self, stime, etime): self.completed_shifts_page.log_shift_timings(stime, etime) def get_cancel_shift(self): return self.element_by_xpath(self.elements.SHIFT_CANCEL_PATH) def cancel_shift(self): self.element_by_xpath(self.elements.SHIFT_CANCEL_PATH + "//a").click()
class VolunteerProfilePage(BasePage): def __init__(self, driver): self.driver = driver self.home_page = HomePage(self.driver) self.elements = VolunteerProfilePageLocators() super(VolunteerProfilePage, self).__init__(driver) def navigate_to_profile(self): self.home_page.get_volunteer_profile_link().send_keys("\n") def edit_profile(self): self.find_link(self.elements.EDIT_PROFILE_TEXT).send_keys("\n") def fill_values(self, new_details): elements = self.elements self.fill_field(elements.PROFILE_FIRST_NAME, new_details[0]) self.fill_field(elements.PROFILE_LAST_NAME, new_details[1]) self.fill_field(elements.PROFILE_EMAIL, new_details[2]) self.fill_field(elements.PROFILE_ADDRESS, new_details[3]) self.fill_field(elements.PROFILE_CITY, new_details[4]) self.fill_field(elements.PROFILE_STATE, new_details[5]) self.fill_field(elements.PROFILE_COUNTRY, new_details[6]) self.fill_field(elements.PROFILE_PHONE, new_details[7]) self.send_value_to_xpath(elements.SELECT_ORGANIZATION, new_details[8]) self.fill_field(elements.UNLISTED_ORGANIZATION, new_details[9]) self.submit_form() def fill_field(self, xpath, value): field = self.element_by_xpath(xpath) field.clear() field.send_keys(value) def upload_resume(self, path): self.send_value_to_xpath(self.elements.RESUME_FILE, path) def download_resume_text(self): return self.element_by_xpath(self.elements.DOWNLOAD_RESUME).text def get_invalid_format_error(self): return self.element_by_xpath(self.elements.INVALID_FORMAT_MESSAGE).text def submit_form(self): self.element_by_xpath(self.elements.SUBMIT_PATH).submit()
class AdministratorReportPage(BasePage): administrator_report_page = PageUrls.administrator_report_page def __init__(self, driver): self.driver = driver self.home_page = HomePage(self.driver) self.elements = AdministratorReportPageLocators() super(AdministratorReportPage, self).__init__(driver) def go_to_admin_report(self): self.home_page.get_admin_report_link().click() def go_to_view_report_page(self): return self.element_by_xpath(self.elements.VIEW_REPORT).click() def get_volunteer_name(self): return self.element_by_xpath(self.elements.VOLUNTEER_NAME).text def get_hours(self): return self.element_by_xpath(self.elements.HOURS).text def get_shift_summary(self): return self.element_by_xpath( self.elements.REPORT_SHIFT_SUMMARY_PATH).text def get_rejection_context(self): return self.element_by_xpath(self.elements.REJECT_REPORT).text def reject_report(self): self.element_by_xpath(self.elements.REJECT_REPORT + '//a').click() def get_report(self): return self.element_by_xpath(self.elements.REPORT) def get_approval_context(self): return self.element_by_xpath(self.elements.APPROVE_REPORT).text def approve_report(self): self.element_by_xpath(self.elements.APPROVE_REPORT + '//a').click()
class VolunteerReportPage(BasePage): volunteer_history_page = PageUrls.volunteer_history_page volunteer_report_page = PageUrls.volunteer_report_page no_results_message = 'Your criteria did not return any results.' live_server_url = '' def __init__(self, driver): self.driver = driver self.home_page = HomePage(self.driver) self.elements = VolunteerReportPageLocators() super(VolunteerReportPage, self).__init__(driver) def navigate_to_report_page(self): self.home_page.get_volunteer_report_link().click() def get_event_job_selectors(self): select1 = Select( self.element_by_xpath(self.elements.REPORT_EVENT_SELECTOR)) select2 = Select( self.element_by_xpath(self.elements.REPORT_JOB_SELECTOR)) return select1, select2 def fill_report_form(self, dates): self.element_by_xpath(self.elements.REPORT_START_DATE).clear() self.element_by_xpath(self.elements.REPORT_END_DATE).clear() self.send_value_to_xpath(self.elements.REPORT_START_DATE, dates['start']) self.send_value_to_xpath(self.elements.REPORT_END_DATE, dates['end']) self.submit_form() def submit_form(self): self.element_by_xpath(self.elements.SUBMIT_PATH).submit() def get_alert_box_text(self): return self.element_by_class_name(self.elements.NO_RESULT_BOX).text def get_shift_summary(self): return self.element_by_xpath( self.elements.REPORT_SHIFT_SUMMARY_PATH).text
class EventsPage(BasePage): event_list_page = PageUrls.event_list_page job_list_page = PageUrls.job_list_page shift_list_page = PageUrls.shift_list_page organization_list_page = PageUrls.organization_list_page create_organization_page = '/organization/create/' create_job_page = '/job/create/' create_event_page = '/event/create/' jobs_tab = 'Jobs' shift_tab = 'Shifts' organization_tab = 'Organizations' live_server_url = '' def __init__(self, driver): self.driver = driver self.home_page = HomePage(self.driver) self.elements = EventsPageLocators() super(EventsPage, self).__init__(driver) def fill_event_form(self, event): self.element_by_xpath(self.elements.CREATE_EVENT_NAME).clear() self.element_by_xpath(self.elements.CREATE_EVENT_START_DATE).clear() self.element_by_xpath(self.elements.CREATE_EVENT_END_DATE).clear() self.send_value_to_xpath(self.elements.CREATE_EVENT_NAME, event[0]) self.send_value_to_xpath(self.elements.CREATE_EVENT_START_DATE, event[1]) self.send_value_to_xpath(self.elements.CREATE_EVENT_END_DATE, event[2]) self.submit_form() def fill_job_form(self, job): self.element_by_xpath(self.elements.CREATE_JOB_NAME).clear() self.element_by_xpath(self.elements.CREATE_JOB_DESCRIPTION).clear() self.element_by_xpath(self.elements.CREATE_JOB_START_DATE).clear() self.element_by_xpath(self.elements.CREATE_JOB_END_DATE).clear() self.send_value_to_xpath(self.elements.CREATE_EVENT_ID,job[0]) self.send_value_to_xpath(self.elements.CREATE_JOB_NAME,job[1]) self.send_value_to_xpath(self.elements.CREATE_JOB_DESCRIPTION,job[2]) self.send_value_to_xpath(self.elements.CREATE_JOB_START_DATE,job[3]) self.send_value_to_xpath(self.elements.CREATE_JOB_END_DATE,job[4]) self.submit_form() def fill_shift_form(self, shift): self.element_by_xpath(self.elements.CREATE_SHIFT_DATE).clear() self.element_by_xpath(self.elements.CREATE_SHIFT_START_TIME).clear() self.element_by_xpath(self.elements.CREATE_SHIFT_END_TIME).clear() self.element_by_xpath(self.elements.CREATE_SHIFT_MAX_VOLUNTEER).clear() self.send_value_to_xpath(self.elements.CREATE_SHIFT_DATE,shift[0]) self.send_value_to_xpath(self.elements.CREATE_SHIFT_START_TIME,shift[1]) self.send_value_to_xpath(self.elements.CREATE_SHIFT_END_TIME,shift[2]) self.send_value_to_xpath(self.elements.CREATE_SHIFT_MAX_VOLUNTEER,shift[3]) self.submit_form() def fill_organization_form(self, org): self.element_by_xpath(self.elements.ORG_NAME).clear() self.send_value_to_xpath(self.elements.ORG_NAME,org) self.submit_form() def submit_form(self): self.element_by_xpath(self.elements.GENERAL_SUBMIT_PATH).submit() def go_to_events_page(self): self.home_page.get_events_link().send_keys('\n') def navigate_to_event_list_view(self): self.get_page(self.live_server_url, self.event_list_page) def navigate_to_job_list_view(self): self.get_page(self.live_server_url, self.job_list_page) def navigate_to_shift_list_view(self): self.get_page(self.live_server_url, self.shift_list_page) self.element_by_xpath(self.elements.VIEW_SHIFT).click() def navigate_to_organization_view(self): self.get_page(self.live_server_url, self.organization_list_page) def go_to_create_event_page(self): self.click_link('Create Event') def go_to_edit_event_page(self): self.element_by_xpath(self.elements.EDIT_EVENT).click() def go_to_create_job_page(self): self.get_page(self.live_server_url, self.create_job_page) def go_to_edit_job_page(self): self.element_by_xpath(self.elements.EDIT_JOB).click() def go_to_create_shift_page(self): self.click_link('Create Shift') def go_to_edit_shift_page(self): self.element_by_xpath(self.elements.EDIT_SHIFT).click() def go_to_create_organization_page(self): self.get_page(self.live_server_url, self.create_organization_page) def get_deletion_box(self): return self.element_by_class_name(self.elements.DELETION_BOX) def get_deletion_context(self): return self.element_by_class_name(self.elements.DELETION_TOPIC).text def get_message_context(self): return self.element_by_class_name(self.elements.MESSAGE_BOX).text def get_event_name(self): return self.element_by_xpath(self.elements.EVENT_NAME).text def get_warning_context(self): return self.element_by_class_name(self.elements.WARNING_CONTEXT).text def get_danger_message(self): return self.element_by_class_name(self.elements.DANGER_BOX) def get_job_name(self): return self.element_by_xpath(self.elements.JOB_NAME).text def get_job_event(self): return self.element_by_xpath(self.elements.JOB_EVENT).text def get_template_error_message(self): return self.element_by_xpath(self.elements.TEMPLATE_ERROR_MESSAGE).text def get_results(self): return self.element_by_xpath(self.elements.RESULTS) def get_shift_date(self): return self.element_by_xpath(self.elements.SHIFT_DATE).text def get_help_block(self): return self.element_by_class_name(self.elements.HELP_BLOCK) def get_org_name(self): return self.element_by_xpath(self.elements.CREATED_ORG_NAME).text def get_help_blocks(self): return self.elements_by_class_name(self.elements.HELP_BLOCK) def get_event_name_error(self): return self.element_by_xpath(self.elements.EVENT_NAME_ERROR).text def get_event_start_date_error(self): return self.element_by_xpath(self.elements.EVENT_START_DATE_ERROR).text def get_event_end_date_error(self): return self.element_by_xpath(self.elements.EVENT_END_DATE_ERROR).text def get_job_name_error(self): return self.element_by_xpath(self.elements.JOB_NAME_ERROR).text def get_job_start_date_error(self): return self.element_by_xpath(self.elements.JOB_START_DATE_ERROR).text def get_job_end_date_error(self): return self.element_by_xpath(self.elements.JOB_END_DATE_ERROR).text def get_shift_date_error(self): return self.element_by_xpath(self.elements.SHIFT_DATE_ERROR).text def get_shift_start_time_error(self): return self.element_by_xpath(self.elements.SHIFT_START_TIME_ERROR).text def get_shift_end_time_error(self): return self.driver.find_element_by_xpath(self.elements.SHIFT_END_TIME_ERROR).text def get_shift_max_volunteer_error(self): return self.element_by_xpath(self.elements.SHIFT_MAX_VOLUNTEER_ERROR).text def get_shift_job(self): return self.element_by_xpath(self.elements.SHIFT_JOB).text def get_shift_job_start_date(self): return self.element_by_xpath(self.elements.SHIFT_JOB_START_DATE).text def get_shift_job_end_date(self): return self.element_by_xpath(self.elements.SHIFT_JOB_END_DATE).text def get_job_event_start_date(self): return self.element_by_id(self.elements.JOB_EVENT_START_DATE).text def get_job_event_end_date(self): return self.element_by_id(self.elements.JOB_EVENT_END_DATE).text def get_event_name_value(self): return self.get_value_for_xpath(self.elements.CREATE_EVENT_NAME) def get_event_start_date_value(self): return self.get_value_for_xpath(self.elements.CREATE_EVENT_START_DATE) def get_event_end_date_value(self): return self.get_value_for_xpath(self.elements.CREATE_EVENT_END_DATE) def get_job_name_value(self): return self.get_value_for_xpath(self.elements.CREATE_JOB_NAME) def get_job_start_date_value(self): return self.get_value_for_xpath(self.elements.CREATE_JOB_START_DATE) def get_job_end_date_value(self): return self.get_value_for_xpath(self.elements.CREATE_JOB_END_DATE) def get_job_description_value(self): return self.get_value_for_xpath(self.elements.CREATE_JOB_DESCRIPTION) def get_shift_date_value(self): return self.get_value_for_xpath(self.elements.CREATE_SHIFT_DATE) def get_shift_start_time_value(self): return self.get_value_for_xpath(self.elements.CREATE_SHIFT_START_TIME) def get_shift_end_time_value(self): return self.get_value_for_xpath(self.elements.CREATE_SHIFT_END_TIME) def get_shift_max_volunteers(self): return self.get_value_for_xpath(self.elements.CREATE_SHIFT_MAX_VOLUNTEER)
def __init__(self, driver): self.driver = driver self.home_page = HomePage(self.driver) self.elements = EventsPageLocators() super(EventsPage, self).__init__(driver)
class EventSignUpPage(BasePage): no_event_message = 'There are no events.' def __init__(self, driver): self.driver = driver self.home_page = HomePage(self.driver) self.elements = EventSignUpPageLocators() super(EventSignUpPage, self).__init__(driver) def submit_form(self): self.element_by_xpath(self.elements.SUBMIT_PATH).submit() def click_to_view_jobs(self): self.element_by_xpath(self.elements.VIEW_JOBS_PATH+ "//a").click() def click_to_view_shifts(self): self.element_by_xpath(self.elements.VIEW_SHIFTS_PATH + "//a").click() def click_to_sign_up(self): self.element_by_xpath(self.elements.SHIFT_SIGNUP_PATH + "//a").click() def get_view_jobs(self): return self.element_by_xpath(self.elements.VIEW_JOBS_PATH).text def get_view_shifts(self): return self.element_by_xpath(self.elements.VIEW_SHIFTS_PATH).text def get_sign_up(self): return self.element_by_xpath(self.elements.SHIFT_SIGNUP_PATH).text def navigate_to_sign_up(self): self.home_page.get_shift_signup_link().click() def fill_search_form(self, date): self.element_by_id(self.elements.START_DATE_FROM).clear() self.element_by_id(self.elements.START_DATE_TO).clear() self.send_value_to_element_id(self.elements.START_DATE_FROM,date[0]) self.send_value_to_element_id(self.elements.START_DATE_TO,date[1]) self.submit_form() def get_info_box(self): return self.element_by_class_name(self.elements.INFO_BOX) def get_danger_box(self): self.element_by_class_name(self.elements.DANGER_BOX) def get_shift_job(self): return self.element_by_xpath(self.elements.SHIFT_JOB_PATH).text def get_shift_date(self): return self.element_by_xpath(self.elements.SHIFT_DATE_PATH).text def get_shift_start_time(self): return self.element_by_xpath(self.elements.SHIFT_STIME_PATH).text def get_shift_end_time(self): return self.element_by_xpath(self.elements.SHIFT_ETIME_PATH).text def find_table_tag(self): return self.element_by_tag_name('table') def get_event_name(self): return self.element_by_xpath(self.elements.EVENT_NAME).text def get_signed_up_shift_text(self): return self.element_by_xpath(self.elements.UPCOMING_SHIFT_SECTION).text def get_remaining_slots(self): return self.element_by_xpath(self.elements.SLOTS_REMAINING_PATH).text
class EventsPage(BasePage): event_list_page = PageUrls.event_list_page job_list_page = PageUrls.job_list_page shift_list_page = PageUrls.shift_list_page organization_list_page = PageUrls.organization_list_page create_organization_page = '/organization/create/' create_job_page = '/job/create/' create_event_page = '/event/create/' jobs_tab = 'Jobs' shift_tab = 'Shifts' organization_tab = 'Organizations' live_server_url = '' FIELD_REQUIRED = 'This field is required.' NO_EVENT_PRESENT = 'No event found.' START_BEFORE_END = 'Start date must be before the end date' def __init__(self, driver): self.driver = driver self.home_page = HomePage(self.driver) self.elements = EventsPageLocators() super(EventsPage, self).__init__(driver) def fill_event_form(self, event): self.element_by_xpath(self.elements.CREATE_EVENT_NAME).clear() self.element_by_xpath(self.elements.CREATE_EVENT_START_DATE).clear() self.element_by_xpath(self.elements.CREATE_EVENT_END_DATE).clear() self.send_value_to_xpath(self.elements.CREATE_EVENT_NAME, event[0]) self.send_value_to_xpath(self.elements.CREATE_EVENT_START_DATE, event[1]) self.send_value_to_xpath(self.elements.CREATE_EVENT_END_DATE, event[2]) self.submit_form() def fill_job_form(self, job): self.element_by_xpath(self.elements.CREATE_JOB_NAME).clear() self.element_by_xpath(self.elements.CREATE_JOB_DESCRIPTION).clear() self.element_by_xpath(self.elements.CREATE_JOB_START_DATE).clear() self.element_by_xpath(self.elements.CREATE_JOB_END_DATE).clear() self.send_value_to_xpath(self.elements.CREATE_EVENT_ID, job[0]) self.send_value_to_xpath(self.elements.CREATE_JOB_NAME, job[1]) self.send_value_to_xpath(self.elements.CREATE_JOB_DESCRIPTION, job[2]) self.send_value_to_xpath(self.elements.CREATE_JOB_START_DATE, job[3]) self.send_value_to_xpath(self.elements.CREATE_JOB_END_DATE, job[4]) self.submit_form() def fill_shift_form(self, shift): self.element_by_xpath(self.elements.CREATE_SHIFT_DATE).clear() self.element_by_xpath(self.elements.CREATE_SHIFT_START_TIME).clear() self.element_by_xpath(self.elements.CREATE_SHIFT_END_TIME).clear() self.element_by_xpath(self.elements.CREATE_SHIFT_MAX_VOLUNTEER).clear() self.send_value_to_xpath(self.elements.CREATE_SHIFT_DATE, shift[0]) self.send_value_to_xpath(self.elements.CREATE_SHIFT_START_TIME, shift[1]) self.send_value_to_xpath(self.elements.CREATE_SHIFT_END_TIME, shift[2]) self.send_value_to_xpath(self.elements.CREATE_SHIFT_MAX_VOLUNTEER, shift[3]) self.submit_form() def fill_organization_form(self, org): self.element_by_xpath(self.elements.ORG_NAME).clear() self.send_value_to_xpath(self.elements.ORG_NAME, org) self.submit_form() def submit_form(self): self.element_by_xpath(self.elements.GENERAL_SUBMIT_PATH).submit() def go_to_events_page(self): self.home_page.get_events_link().click() def navigate_to_event_list_view(self): self.get_page(self.live_server_url, self.event_list_page) def navigate_to_job_list_view(self): self.get_page(self.live_server_url, self.job_list_page) def navigate_to_shift_list_view(self): self.get_page(self.live_server_url, self.shift_list_page) self.element_by_xpath(self.elements.VIEW_SHIFT).click() def navigate_to_organization_view(self): self.get_page(self.live_server_url, self.organization_list_page) def go_to_create_event_page(self): self.click_link('Create Event') def go_to_details_event_page(self): self.element_by_xpath(self.elements.VIEW_EVENT).click() def go_to_edit_event_page(self): self.element_by_xpath(self.elements.EDIT_EVENT).click() def go_to_create_job_page(self): self.click_link('Create Job') def go_to_edit_job_page(self): self.element_by_xpath(self.elements.EDIT_JOB).click() def go_to_create_shift_page(self): self.click_link('Create Shift') def go_to_edit_shift_page(self): self.element_by_xpath(self.elements.EDIT_SHIFT).click() def go_to_create_organization_page(self): self.click_link('Create Organization') def go_to_edit_organization_page(self): self.element_by_xpath(self.elements.EDIT_ORG).click() def get_deletion_box(self): return self.element_by_class_name(self.elements.DELETION_BOX) def get_delete_event_element(self, relative): return self.element_by_xpath(self.elements.DELETE_EVENT + relative) def get_deletion_context(self): return self.element_by_class_name(self.elements.DELETION_TOPIC).text def get_message_context(self): return self.element_by_class_name(self.elements.MESSAGE_BOX).text def get_event_name(self): return self.element_by_xpath(self.elements.EVENT_NAME).text def get_event_start_date(self): return self.element_by_xpath(self.elements.EVENT_START_DATE).text def get_event_end_date(self): return self.element_by_xpath(self.elements.EVENT_END_DATE).text def get_warning_context(self): return self.element_by_class_name(self.elements.WARNING_CONTEXT).text def get_danger_message(self): return self.element_by_class_name(self.elements.DANGER_BOX) def get_job_name(self): return self.element_by_xpath(self.elements.JOB_NAME).text def get_job_event(self): return self.element_by_xpath(self.elements.JOB_EVENT).text def get_template_error_message(self): return self.element_by_xpath(self.elements.TEMPLATE_ERROR_MESSAGE).text def get_results(self): return self.element_by_xpath(self.elements.RESULTS) def get_shift_date(self): return self.element_by_xpath(self.elements.SHIFT_DATE).text def get_help_block(self): return self.element_by_class_name(self.elements.HELP_BLOCK) def get_org_name(self): return self.element_by_xpath(self.elements.CREATED_ORG_NAME).text def get_unlisted_org_name(self): return self.element_by_xpath(self.elements.UNLISTED_ORG_NAME).text def get_rejection_context(self): return self.element_by_xpath(self.elements.REJECT_ORG).text def reject_org(self): self.element_by_xpath(self.elements.REJECT_ORG + '//a').click() def get_approval_context(self): return self.element_by_xpath(self.elements.APPROVE_ORG).text def approve_org(self): self.element_by_xpath(self.elements.APPROVE_ORG + '//a').click() def get_event_name_error(self): return self.element_by_xpath(self.elements.EVENT_NAME_ERROR).text def get_event_start_date_error(self): return self.element_by_xpath(self.elements.EVENT_START_DATE_ERROR).text def get_event_end_date_error(self): return self.element_by_xpath(self.elements.EVENT_END_DATE_ERROR).text def get_job_name_error(self): return self.element_by_xpath(self.elements.JOB_NAME_ERROR).text def get_job_start_date_error(self): return self.element_by_xpath(self.elements.JOB_START_DATE_ERROR).text def get_job_end_date_error(self): return self.element_by_xpath(self.elements.JOB_END_DATE_ERROR).text def get_shift_date_error(self): return self.element_by_xpath(self.elements.SHIFT_DATE_ERROR).text def get_shift_start_time_error(self): return self.element_by_xpath(self.elements.SHIFT_START_TIME_ERROR).text def get_shift_end_time_error(self): return self.driver.find_element_by_xpath(self.elements.SHIFT_END_TIME_ERROR).text def get_shift_max_volunteer_error(self): return self.element_by_xpath(self.elements.SHIFT_MAX_VOLUNTEER_ERROR).text def get_organization_name_error(self): return self.element_by_xpath(self.elements.ORGANIZATION_NAME_ERROR).text def get_shift_job(self): return self.element_by_xpath(self.elements.SHIFT_JOB).text def get_shift_job_start_date(self): return self.element_by_xpath(self.elements.SHIFT_JOB_START_DATE).text def get_shift_job_end_date(self): return self.element_by_xpath(self.elements.SHIFT_JOB_END_DATE).text def get_job_event_start_date(self): return self.element_by_id(self.elements.JOB_EVENT_START_DATE).text def get_job_event_end_date(self): return self.element_by_id(self.elements.JOB_EVENT_END_DATE).text def get_event_name_value(self): return self.get_value_for_xpath(self.elements.CREATE_EVENT_NAME) def get_event_start_date_value(self): return self.get_value_for_xpath(self.elements.CREATE_EVENT_START_DATE) def get_event_end_date_value(self): return self.get_value_for_xpath(self.elements.CREATE_EVENT_END_DATE) def get_job_name_value(self): return self.get_value_for_xpath(self.elements.CREATE_JOB_NAME) def get_job_start_date_value(self): return self.get_value_for_xpath(self.elements.CREATE_JOB_START_DATE) def get_job_end_date_value(self): return self.get_value_for_xpath(self.elements.CREATE_JOB_END_DATE) def get_job_description_value(self): return self.get_value_for_xpath(self.elements.CREATE_JOB_DESCRIPTION) def get_shift_date_value(self): return self.get_value_for_xpath(self.elements.CREATE_SHIFT_DATE) def get_shift_start_time_value(self): return self.get_value_for_xpath(self.elements.CREATE_SHIFT_START_TIME) def get_shift_end_time_value(self): return self.get_value_for_xpath(self.elements.CREATE_SHIFT_END_TIME) def get_shift_max_volunteers(self): return self.get_value_for_xpath(self.elements.CREATE_SHIFT_MAX_VOLUNTEER) def get_help_blocks(self): blocks = self.elements_by_class_name(self.elements.HELP_BLOCK) return blocks
def __init__(self, driver): self.driver = driver self.home_page = HomePage(self.driver) self.elements = AdministratorReportPageLocators() super(AdministratorReportPage, self).__init__(driver)
def __init__(self, driver): self.driver = driver self.home_page = HomePage(self.driver) self.elements = VolunteerProfilePageLocators() super(VolunteerProfilePage, self).__init__(driver)
def __init__(self, driver): self.driver = driver self.authentication_page = AuthenticationPage(self.driver) self.home_page = HomePage(self.driver) self.elements = VolunteerReportPageLocators() super(VolunteerReportPage, self).__init__(driver)
def __init__(self, driver): self.driver = driver self.home_page = HomePage(self.driver) self.elements = CompletedShiftsPageLocators() super(CompletedShiftsPage, self).__init__(driver)
class CompletedShiftsPage(BasePage): view_hours_page = PageUrls.completed_shifts_page live_server_url = '' def __init__(self, driver): self.driver = driver self.home_page = HomePage(self.driver) self.elements = CompletedShiftsPageLocators() super(CompletedShiftsPage, self).__init__(driver) def go_to_completed_shifts(self): link = self.home_page.get_completed_shifts_link().get_attribute('href') self.get_page('', link) def edit_hours(self, stime, etime): self.element_by_xpath(self.elements.SHIFT_EDIT_PATH + '//a').click() self.log_shift_timings(stime, etime) def log_shift_timings(self, stime, etime): self.element_by_xpath(self.elements.START_TIME_FORM).clear() self.send_value_to_xpath(self.elements.START_TIME_FORM, stime) self.element_by_xpath(self.elements.END_TIME_FORM).clear() self.send_value_to_xpath(self.elements.END_TIME_FORM, etime) self.submit_form() def submit_form(self): self.element_by_xpath(self.elements.SUBMIT_PATH).submit() def get_unlogged_info_box(self): return self.element_by_id(self.elements.UNLOGGED_INFO_BOX).text def get_logged_info_box(self): return self.element_by_id(self.elements.LOGGED_INFO_BOX).text def get_danger_box(self): return self.element_by_class_name(self.elements.DANGER_BOX) def get_unlogged_shift_job(self): return self.element_by_xpath(self.elements.UNLOGGED_SHIFT_JOB_PATH).text def get_unlogged_shift_date(self): return self.element_by_xpath( self.elements.UNLOGGED_SHIFT_DATE_PATH ).text def get_unlogged_shift_start_time(self): return self.element_by_xpath( self.elements.UNLOGGED_SHIFT_STIME_PATH ).text def get_unlogged_shift_end_time(self): return self.element_by_xpath( self.elements.UNLOGGED_SHIFT_ETIME_PATH ).text def get_logged_shift_job(self): return self.element_by_xpath(self.elements.LOGGED_SHIFT_JOB_PATH).text def get_logged_shift_date(self): return self.element_by_xpath(self.elements.LOGGED_SHIFT_DATE_PATH).text def get_logged_shift_start_time(self): return self.element_by_xpath(self.elements.LOGGED_SHIFT_STIME_PATH).text def get_logged_shift_end_time(self): return self.element_by_xpath(self.elements.LOGGED_SHIFT_ETIME_PATH).text def get_log_hours(self): return self.element_by_xpath(self.elements.LOG_SHIFT_HOURS_PATH).text def get_edit_hours(self): return self.element_by_xpath(self.elements.SHIFT_EDIT_PATH).text def click_to_log_hours(self): self.element_by_xpath( self.elements.LOG_SHIFT_HOURS_PATH + "//a").click() def get_edit_shift_hours(self): return self.element_by_xpath(self.elements.SHIFT_EDIT_PATH).text def get_result_container(self): return self.element_by_xpath(self.elements.CONTAINER)
class EventsPage(BasePage): event_list_page = PageUrls.event_list_page job_list_page = PageUrls.job_list_page shift_list_page = PageUrls.shift_list_page organization_list_page = PageUrls.organization_list_page create_organization_page = '/organization/create/' create_job_page = '/job/create/' create_event_page = '/event/create/' jobs_tab = 'Jobs' shift_tab = 'Shifts' organization_tab = 'Organizations' live_server_url = '' def __init__(self, driver): self.driver = driver self.home_page = HomePage(self.driver) self.elements = EventsPageLocators() super(EventsPage, self).__init__(driver) def fill_event_form(self, event): self.element_by_xpath(self.elements.CREATE_EVENT_NAME).clear() self.element_by_xpath(self.elements.CREATE_EVENT_START_DATE).clear() self.element_by_xpath(self.elements.CREATE_EVENT_END_DATE).clear() self.send_value_to_xpath(self.elements.CREATE_EVENT_NAME, event[0]) self.send_value_to_xpath(self.elements.CREATE_EVENT_START_DATE, event[1]) self.send_value_to_xpath(self.elements.CREATE_EVENT_END_DATE, event[2]) self.submit_form() def fill_job_form(self, job): self.element_by_xpath(self.elements.CREATE_JOB_NAME).clear() self.element_by_xpath(self.elements.CREATE_JOB_DESCRIPTION).clear() self.element_by_xpath(self.elements.CREATE_JOB_START_DATE).clear() self.element_by_xpath(self.elements.CREATE_JOB_END_DATE).clear() self.send_value_to_xpath(self.elements.CREATE_EVENT_ID, job[0]) self.send_value_to_xpath(self.elements.CREATE_JOB_NAME, job[1]) self.send_value_to_xpath(self.elements.CREATE_JOB_DESCRIPTION, job[2]) self.send_value_to_xpath(self.elements.CREATE_JOB_START_DATE, job[3]) self.send_value_to_xpath(self.elements.CREATE_JOB_END_DATE, job[4]) self.submit_form() def fill_shift_form(self, shift): self.element_by_xpath(self.elements.CREATE_SHIFT_DATE).clear() self.element_by_xpath(self.elements.CREATE_SHIFT_START_TIME).clear() self.element_by_xpath(self.elements.CREATE_SHIFT_END_TIME).clear() self.element_by_xpath(self.elements.CREATE_SHIFT_MAX_VOLUNTEER).clear() self.send_value_to_xpath(self.elements.CREATE_SHIFT_DATE, shift[0]) self.send_value_to_xpath(self.elements.CREATE_SHIFT_START_TIME, shift[1]) self.send_value_to_xpath(self.elements.CREATE_SHIFT_END_TIME, shift[2]) self.send_value_to_xpath(self.elements.CREATE_SHIFT_MAX_VOLUNTEER, shift[3]) self.submit_form() def fill_organization_form(self, org): self.element_by_xpath(self.elements.ORG_NAME).clear() self.send_value_to_xpath(self.elements.ORG_NAME, org) self.submit_form() def submit_form(self): self.element_by_xpath(self.elements.GENERAL_SUBMIT_PATH).submit() def go_to_events_page(self): self.home_page.get_events_link().send_keys('\n') def navigate_to_event_list_view(self): self.get_page(self.live_server_url, self.event_list_page) def navigate_to_job_list_view(self): self.get_page(self.live_server_url, self.job_list_page) def navigate_to_shift_list_view(self): self.get_page(self.live_server_url, self.shift_list_page) self.element_by_xpath(self.elements.VIEW_SHIFT).click() def navigate_to_organization_view(self): self.get_page(self.live_server_url, self.organization_list_page) def go_to_create_event_page(self): self.click_link('Create Event') def go_to_edit_event_page(self): self.element_by_xpath(self.elements.EDIT_EVENT).click() def go_to_create_job_page(self): self.get_page(self.live_server_url, self.create_job_page) def go_to_edit_job_page(self): self.element_by_xpath(self.elements.EDIT_JOB).click() def go_to_create_shift_page(self): self.click_link('Create Shift') def go_to_edit_shift_page(self): self.element_by_xpath(self.elements.EDIT_SHIFT).click() def go_to_create_organization_page(self): self.get_page(self.live_server_url, self.create_organization_page) def get_deletion_box(self): return self.element_by_class_name(self.elements.DELETION_BOX) def get_deletion_context(self): return self.element_by_class_name(self.elements.DELETION_TOPIC).text def get_message_context(self): return self.element_by_class_name(self.elements.MESSAGE_BOX).text def get_event_name(self): return self.element_by_xpath(self.elements.EVENT_NAME).text def get_warning_context(self): return self.element_by_class_name(self.elements.WARNING_CONTEXT).text def get_danger_message(self): return self.element_by_class_name(self.elements.DANGER_BOX) def get_job_name(self): return self.element_by_xpath(self.elements.JOB_NAME).text def get_job_event(self): return self.element_by_xpath(self.elements.JOB_EVENT).text def get_template_error_message(self): return self.element_by_xpath(self.elements.TEMPLATE_ERROR_MESSAGE).text def get_results(self): return self.element_by_xpath(self.elements.RESULTS) def get_shift_date(self): return self.element_by_xpath(self.elements.SHIFT_DATE).text def get_help_block(self): return self.element_by_class_name(self.elements.HELP_BLOCK) def get_org_name(self): return self.element_by_xpath(self.elements.CREATED_ORG_NAME).text def get_help_blocks(self): return self.elements_by_class_name(self.elements.HELP_BLOCK) def get_event_name_error(self): return self.element_by_xpath(self.elements.EVENT_NAME_ERROR).text def get_event_start_date_error(self): return self.element_by_xpath(self.elements.EVENT_START_DATE_ERROR).text def get_event_end_date_error(self): return self.element_by_xpath(self.elements.EVENT_END_DATE_ERROR).text def get_job_name_error(self): return self.element_by_xpath(self.elements.JOB_NAME_ERROR).text def get_job_start_date_error(self): return self.element_by_xpath(self.elements.JOB_START_DATE_ERROR).text def get_job_end_date_error(self): return self.element_by_xpath(self.elements.JOB_END_DATE_ERROR).text def get_shift_date_error(self): return self.element_by_xpath(self.elements.SHIFT_DATE_ERROR).text def get_shift_start_time_error(self): return self.element_by_xpath(self.elements.SHIFT_START_TIME_ERROR).text def get_shift_end_time_error(self): return self.driver.find_element_by_xpath( self.elements.SHIFT_END_TIME_ERROR).text def get_shift_max_volunteer_error(self): return self.element_by_xpath( self.elements.SHIFT_MAX_VOLUNTEER_ERROR).text def get_shift_job(self): return self.element_by_xpath(self.elements.SHIFT_JOB).text def get_shift_job_start_date(self): return self.element_by_xpath(self.elements.SHIFT_JOB_START_DATE).text def get_shift_job_end_date(self): return self.element_by_xpath(self.elements.SHIFT_JOB_END_DATE).text def get_job_event_start_date(self): return self.element_by_id(self.elements.JOB_EVENT_START_DATE).text def get_job_event_end_date(self): return self.element_by_id(self.elements.JOB_EVENT_END_DATE).text def get_event_name_value(self): return self.get_value_for_xpath(self.elements.CREATE_EVENT_NAME) def get_event_start_date_value(self): return self.get_value_for_xpath(self.elements.CREATE_EVENT_START_DATE) def get_event_end_date_value(self): return self.get_value_for_xpath(self.elements.CREATE_EVENT_END_DATE) def get_job_name_value(self): return self.get_value_for_xpath(self.elements.CREATE_JOB_NAME) def get_job_start_date_value(self): return self.get_value_for_xpath(self.elements.CREATE_JOB_START_DATE) def get_job_end_date_value(self): return self.get_value_for_xpath(self.elements.CREATE_JOB_END_DATE) def get_job_description_value(self): return self.get_value_for_xpath(self.elements.CREATE_JOB_DESCRIPTION) def get_shift_date_value(self): return self.get_value_for_xpath(self.elements.CREATE_SHIFT_DATE) def get_shift_start_time_value(self): return self.get_value_for_xpath(self.elements.CREATE_SHIFT_START_TIME) def get_shift_end_time_value(self): return self.get_value_for_xpath(self.elements.CREATE_SHIFT_END_TIME) def get_shift_max_volunteers(self): return self.get_value_for_xpath( self.elements.CREATE_SHIFT_MAX_VOLUNTEER)
def setUpClass(cls): cls.driver = webdriver.Firefox() cls.driver.maximize_window() cls.home_page = HomePage(cls.driver) cls.authentication_page = AuthenticationPage(cls.driver) super(CheckContentAndRedirection, cls).setUpClass()
def __init__(self, driver): self.driver = driver self.home_page = HomePage(self.driver) self.elements = VolunteerReportPageLocators() super(VolunteerReportPage, self).__init__(driver)
def __init__(self, driver): self.driver = driver self.home_page = HomePage(self.driver) self.elements = EventSignUpPageLocators() super(EventSignUpPage, self).__init__(driver)
class EventSignUpPage(BasePage): no_event_message = 'There are no events.' def __init__(self, driver): self.driver = driver self.home_page = HomePage(self.driver) self.elements = EventSignUpPageLocators() super(EventSignUpPage, self).__init__(driver) def submit_form(self): self.element_by_xpath(self.elements.SUBMIT_PATH).submit() def click_to_view_jobs(self): self.element_by_xpath(self.elements.VIEW_JOBS_PATH + "//a").click() def click_to_view_shifts(self): self.element_by_xpath(self.elements.VIEW_SHIFTS_PATH + "//a").click() def click_to_sign_up(self): self.element_by_xpath(self.elements.SHIFT_SIGNUP_PATH + "//a").click() def get_view_jobs(self): return self.element_by_xpath(self.elements.VIEW_JOBS_PATH).text def get_view_shifts(self): return self.element_by_xpath(self.elements.VIEW_SHIFTS_PATH).text def get_sign_up(self): return self.element_by_xpath(self.elements.SHIFT_SIGNUP_PATH).text def navigate_to_sign_up(self): self.home_page.get_shift_signup_link().click() def fill_search_form(self, date): self.element_by_id(self.elements.START_DATE_FROM).clear() self.element_by_id(self.elements.START_DATE_TO).clear() self.send_value_to_element_id(self.elements.START_DATE_FROM, date[0]) self.send_value_to_element_id(self.elements.START_DATE_TO, date[1]) self.submit_form() def get_info_box(self): return self.element_by_class_name(self.elements.INFO_BOX) def get_danger_box(self): self.element_by_class_name(self.elements.DANGER_BOX) def get_shift_job(self): return self.element_by_xpath(self.elements.SHIFT_JOB_PATH).text def get_shift_date(self): return self.element_by_xpath(self.elements.SHIFT_DATE_PATH).text def get_shift_start_time(self): return self.element_by_xpath(self.elements.SHIFT_STIME_PATH).text def get_shift_end_time(self): return self.element_by_xpath(self.elements.SHIFT_ETIME_PATH).text def find_table_tag(self): return self.element_by_tag_name('table') def get_event_name(self): return self.element_by_xpath(self.elements.EVENT_NAME).text def get_signed_up_shift_text(self): return self.element_by_xpath(self.elements.UPCOMING_SHIFT_SECTION).text def get_remaining_slots(self): return self.element_by_xpath(self.elements.SLOTS_REMAINING_PATH).text