def test_start_login_smoke(self, set_capabilities, setup_logging):
        """
        Scenario:
                Verify Login screen is loaded successfully
        """

        setup_logging.info('-- Starting {} Test Case'.format(
            TestIosLogin.__name__))

        ios_new_landing_page = IosNewLanding(set_capabilities, setup_logging)
        assert ios_new_landing_page.load_login_screen().text == strings.LOGIN

        setup_logging.info('Login screen successfully loaded')
Exemple #2
0
def login(set_capabilities, setup_logging):
    """
    Login user based on env given, it will be reusable in tests

    Arguments:
            set_capabilities(webdriver): webdriver object
            setup_logging (logger): logger object

    Returns:
            True: if login is successful
    """

    log = setup_logging
    global_contents = Globals(log)
    is_first_time = True

    if global_contents.target_environment == strings.ANDROID:
        android_new_landing_page = AndroidNewLanding(set_capabilities,
                                                     setup_logging)
        android_login_page = AndroidLogin(set_capabilities, setup_logging)
        assert android_new_landing_page.on_screen(
        ) == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME
        assert android_new_landing_page.load_login_screen(
        ) == Globals.LOGIN_ACTIVITY_NAME
        log.info('Login screen successfully loaded')
        login_output = android_login_page.login(
            global_contents.login_user_name, global_contents.login_password)
        setup_logging.info('{} is successfully logged in'.format(
            global_contents.login_user_name))
        assert login_output == Globals.WHATS_NEW_ACTIVITY_NAME

    elif global_contents.target_environment == strings.IOS:
        ios_new_landing_page = IosNewLanding(set_capabilities, setup_logging)
        ios_login_page = IosLogin(set_capabilities, setup_logging)

        assert ios_new_landing_page.get_welcome_message(
        ).text == strings.NEW_LANDING_MESSAGE_IOS
        assert ios_new_landing_page.load_login_screen().text == strings.LOGIN

        log.info('Login screen successfully loaded')
        assert ios_login_page.login(global_contents.login_user_name,
                                    global_contents.login_password)

        is_first_time = False
        log.info('{} is successfully logged in'.format(
            global_contents.login_user_name))

    return is_first_time
    def back_and_forth_new_landing(self):
        """
        From Login screen tapping back will load New Landing screen and tapping Login will
            load Login screen

        Returns:
             bool: Returns True if app is back on Login screen from New Landing screen
        """

        ios_new_landing = IosNewLanding(self.driver, self.log)

        if self.on_screen().text == strings.LOGIN:
            self.driver.back()
            if ios_new_landing.load_login_screen().text != strings.LOGIN:
                self.log.error('Problem - New Landing screen is not loaded')
                self.global_contents.flag = False
        else:
            self.log.info('Problem - Login screen is not loaded')
            self.global_contents.flag = False

        return self.global_contents.flag
    def test_start_my_courses_list_smoke(self, set_capabilities,
                                         setup_logging):
        """
        Scenarios:
            Verify that from Main Dashboard tapping Courses tab will load My Courses
                list(of specific logged in user) in its tab
        """

        setup_logging.info('-- Starting {} Test Case'.format(
            TestIosMyCoursesList.__name__))

        global_contents = Globals(setup_logging)
        global_contents.is_first_time = False
        ios_new_landing_page = IosNewLanding(set_capabilities, setup_logging)
        ios_login_page = IosLogin(set_capabilities, setup_logging)
        ios_whats_new_page = IosWhatsNew(set_capabilities, setup_logging)
        ios_main_dashboard_page = IosMainDashboard(set_capabilities,
                                                   setup_logging)

        assert ios_new_landing_page.get_welcome_message(
        ).text == strings.NEW_LANDING_MESSAGE_IOS
        assert ios_new_landing_page.load_login_screen().text == strings.LOGIN
        assert ios_login_page.login(global_contents.login_user_name,
                                    global_contents.login_password,
                                    global_contents.is_first_time)
        setup_logging.info('{} is successfully logged in'.format(
            global_contents.login_user_name))

        if global_contents.is_first_time:
            assert ios_whats_new_page.exit_features(
            ).text == strings.MAIN_DASHBOARD_SCREEN_TITLE
        else:
            assert ios_main_dashboard_page.get_drawer_icon(
            ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME

        assert ios_main_dashboard_page.load_courses_tab(
        ).text == strings.SELECTED_BY_DEFAULT