Exemplo n.º 1
0
def f(context, page_name):
    return {
        switch.get('NAVIGATION'): pages.NavigationPage(context),
        switch.get('HOME_PAGE'): pages.HomePage(context),
        switch.get('RESULT_PAGE'): pages.ResultPage(context),
        switch.get('IDA_PAGE'): pages.IdaPage(context),
        switch.get('VOLTA_PAGE'): pages.VoltaPage(context)
    }[page_name]
Exemplo n.º 2
0
    def set_mother_page(page):
        """Set the Mother Page to all the pages

        On most of the applications, the mother page is the Home/Landing/Welcome screen.
        So, may not have several code lines here.
        """
        if page == switch.get('PAGENAME_SCREEN'):
            BasePage.mother_page = switch.get('PAGENAME_SCREEN')
Exemplo n.º 3
0
 def navigate_to(self, context, page):
     if page == navigation_switch.get('HOME_PAGE'):  # Desired page
         pass
     elif page == navigation_switch.get('IDA_PAGE'):  # Desired page
         self.element_tap(home_switch.get('IDA_BUTTON'), 'button', 40,
                          HomePage_locators)
     elif page == navigation_switch.get('VOLTA_PAGE'):  # Desired page
         self.element_tap(home_switch.get('VOLTA_BUTTON'), 'button', 40,
                          HomePage_locators)
Exemplo n.º 4
0
def given_user_accessed_signin_from(context, current_page, desired_page):
    context.page = get_page_navigation(context, 'Navigation')
    context.page.navigate_to(context, desired_page)
    if desired_page == navigation_switch.get('HOME_SCREEN'):
        context.page.element_tap(home_switch.get('SIGNIN_BUTTON'), 'button', 40, HomePage_locators)
    elif desired_page == navigation_switch.get('MYTRIPS_SCREEN'):
        context.page.element_tap(mytrips_switch.get('SIGNIN_BUTTON'), 'button', 40, MyTripsPage_locators)
    elif desired_page == navigation_switch.get('MORE_SCREEN'):
        context.page.element_tap(more_switch.get('SIGNIN_BUTTON'), 'button', 40, MorePage_locators)
    context.page = get_page_object(context, current_page)
    context.page.page_is_displayed()
Exemplo n.º 5
0
 def navigate_to(self, context, page):
     if page == navigation_switch.get('HOME_SCREEN'):  # Desired page
         pass
     elif page == navigation_switch.get('MYTRIPS_SCREEN'):
         self.element_tap(home_switch.get('MYTRIPS_BUTTON'), 'button', 40,
                          HomePage_locators)
     elif page == navigation_switch.get('MORE_SCREEN'):
         self.element_tap(home_switch.get('MORE_BUTTON'), 'button', 40,
                          HomePage_locators)
     elif page == navigation_switch.get('SIGNIN_SCREEN'):
         self.element_tap(home_switch.get('SIGNIN_BUTTON'), 'button', 40,
                          HomePage_locators)
Exemplo n.º 6
0
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)
Exemplo n.º 7
0
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)
Exemplo n.º 8
0
def given_user_authenticated(context, page):
    given_app_displays_page(context, page)
    def fill_fields(context):
        context.page.element_tap(signin_switch.get('USERNAME_BUTTON'), 'button', 40, SigninPage_locators)
        context.page.send_value(signin_switch.get('USERNAME_FIELD'), 'label', signin_switch.get('VALID_USERNAME'), 40, SigninPage_locators)
        context.page.element_tap(signin_switch.get('PASSWORD_BUTTON'), 'button', 40, SigninPage_locators)
        context.page.send_value(signin_switch.get('PASSWORD_FIELD'), 'label', signin_switch.get('VALID_PASSWORD'), 40, SigninPage_locators)
        context.page.element_tap(signin_switch.get('SIGNIN_BUTTON'), 'button', 40, SigninPage_locators)
    if page == navigation_switch.get('HOME_SCREEN'):
        context.page.element_tap(home_switch.get('SIGNIN_BUTTON'), 'button', 40, HomePage_locators)
        fill_fields(context)
    elif page == navigation_switch.get('MYTRIPS_SCREEN'):
        context.page.element_tap(mytrips_switch.get('SIGNIN_BUTTON'), 'button', 40, MyTripsPage_locators)
        fill_fields(context)
    elif page == navigation_switch.get('MORE_SCREEN'):
        context.page.element_tap(more_switch.get('SIGNIN_BUTTON'), 'button', 40, MorePage_locators)
        fill_fields(context)
Exemplo n.º 9
0
def f(context, page_name):
    return {
        switch.get('NAVIGATION'): pages.NavigationPage(context),
        switch.get('HOME_SCREEN'): pages.HomePage(context),
        switch.get('MYTRIPS_SCREEN'): pages.MyTripsPage(context),
        switch.get('MORE_SCREEN'): pages.MorePage(context),
        switch.get('SIGNIN_SCREEN'): pages.SigninPage(context),
        switch.get('FORGOTPASSWORD_SCREEN'): pages.ForgotpasswordPage(context),
        switch.get('FORGOTUSERNAME_SCREEN'): pages.ForgotusernamePage(context),
        switch.get('HAWAIIANMILLES_SCREEN'): pages.HawaiianmillesPage(context)
    }[page_name]
Exemplo n.º 10
0
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)
Exemplo n.º 11
0
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 before_feature(context, feature):
    BasePage.set_page_name(switch.get('HOME_SCREEN'))
    BasePage.set_mother_page(switch.get('HOME_SCREEN'))
Exemplo n.º 13
0
def before_feature(context, feature):
    BasePage.set_page_name(navigation_switch.get('HOME_PAGE'))