"""
Page Object Model for Patient Page
The Patient Page shows the observation data for the patient as well as allows
them to conduct an ad-hoc observation
"""
from liveobs_ui.page_object_models.mobile.mobile_common import BaseMobilePage
from liveobs_ui.selectors.mobile.patient_page_selectors import \
ADHOC_OBS_MENU_BUTTON, OPEN_OBS_MENU, OPEN_OBS_MENU_LIST_ITEMS, \
OPEN_OBS_MENU_CLOSE_BUTTON
[docs]class PatientPage(BaseMobilePage):
"""
Class that handles interacting with patient graphs and ad-hoc observation
menu
"""
[docs] def open_observation_form(self, observation_name):
"""
Open the ad-hoc observation menu, find the specified observation and
open the observation form
:param observation_name: Name of the observation to open
:return: Boolean. Returns if the page is the intended observation
"""
self.open_adhoc_menu()
return self.get_observation_in_list(observation_name)
[docs] def get_observation_in_list(self, observation_name):
"""
Find the specified observation and open the observation form
:param observation_name: Name of the observation to open
:return: Boolean. Returns if the page is the intended observation
"""
observation = self.get_observation_in_menu(observation_name)
if observation:
observation_url = observation.get_attribute('href')
self.click_and_verify_change(
observation, ADHOC_OBS_MENU_BUTTON, hidden=True)
return observation_url in self.driver.current_url
return False