def when_user_selects_month(context, month): current_page = get_page_context() if current_page == navigation_switch.get('IDA_PAGE'): context.page.select(ida_switch.get('MONTH_BUTTON'), 'button', ida_switch.get(month), 40) else: context.page.select(volta_switch.get('MONTH_BUTTON'), 'button', volta_switch.get(month), 40)
def when_user_selects_month_from_home(context, month, prompt): current_page = get_page_context() context.page = get_page_navigation(context, 'Navigation') context.page.navigate_to(context, prompt) if prompt == navigation_switch.get('IDA_PAGE'): context.page.select(ida_switch.get('MONTH_BUTTON'), 'button', ida_switch.get(month), 40, IdaPage_locators) else: context.page.select(volta_switch.get('MONTH_BUTTON'), 'button', volta_switch.get(month), 40, VoltaPage_locators) context.page.navigate_to(context, current_page) context.page = get_page_object(context, current_page)
def when_user_selects_day(context, day): current_page = get_page_context() if current_page == navigation_switch.get('IDA_PAGE'): context.page.element_tap(ida_switch.get('DAY_BUTTON'), 'button', 40, IdaPage_locators) else: context.page.element_tap(volta_switch.get('DAY_BUTTON'), 'button', 40, VoltaPage_locators)
def when_user_selects_day_from_home(context, day, prompt): current_page = get_page_context() context.page = get_page_navigation(context, 'Navigation') context.page.navigate_to(context, prompt) if prompt == navigation_switch.get('IDA_PAGE'): context.page.element_tap(ida_switch.get('DAY_BUTTON'), 'button', 40, IdaPage_locators) else: context.page.element_tap(volta_switch.get('DAY_BUTTON'), 'button', 40, VoltaPage_locators) context.page.navigate_to(context, current_page) context.page = get_page_object(context, current_page)
def page_is_displayed(self): """You should use the definitons from the BasePage to check if the Page is really displayed""" self.element_is_displayed(switch.get('VOLTA_DATE_PICKER'), 'button', 40)
from selenium.webdriver.common.by import By # It's importing the BasePage class, who has all the definitions that are using the Appium driver. from support.pages.base import BasePage # It's importing the way to search elements through ANDROID_UIAUTOMATOR # from support.android.ui_automator import get_text, get_description # It's importing the constants file from support.constants.volta import switch locators = { 'prompt': { switch.get('VOLTA_DATE_PICKER'): { 'chrome': (By.ID, 'return-fsc-datepicker-popover'), 'firefox': (By.ID, 'return-fsc-datepicker-popover'), 'ie': (By.NAME, 'TODO'), # TODO } }, 'button': { switch.get('VOLTA_DATE_PICKER'): { 'chrome': (By.ID, 'return-fsc-datepicker-popover'), 'firefox': (By.ID, 'return-fsc-datepicker-popover'), 'ie': (By.NAME, 'TODO'), # TODO }, switch.get('DAY_BUTTON'): { 'chrome': (By.XPATH, '//*[@id="return-fsc-datepicker-popover"]/div/div/div[2]/div/table/tbody/tr[1]/td[3]/button'),