コード例 #1
0
    def test_start_new_landing_smoke(self, set_capabilities, setup_logging):
        """
        Scenarios:
            Verify New Landing screen is loaded successfully
        """

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

        ios_new_landing = IosNewLanding(set_capabilities, setup_logging)
        assert ios_new_landing.get_welcome_message(
        ).text == strings.NEW_LANDING_MESSAGE_IOS
コード例 #2
0
    def test_search_courses_smoke(self, set_capabilities, setup_logging):
        """
        Verifies that user can search courses, and back to New Landing screen
        """

        global_contents = Globals(setup_logging)
        ios_new_landing = IosNewLanding(set_capabilities, setup_logging)
        search_courses = ios_new_landing.search_courses(
            global_contents.new_landing_search_courses).text
        assert search_courses == strings.DISCOVER_CANCEL
        ios_new_landing.cancel_discovery_screen()
        assert ios_new_landing.get_welcome_message(
        ).text == strings.NEW_LANDING_MESSAGE_IOS
コード例 #3
0
    def test_landscape_smoke(self, set_capabilities, setup_logging):
        """
        Scenarios:
                Landscape support is added for New Landing screen with following cases,
                     Change device orientation to Landscape mode
                     Verify all screen contents
                     Verify search courses
                     Verify back and forth from Login screen
                     Verify back and forth from Register Screen
        """

        ios_new_landing = IosNewLanding(set_capabilities, setup_logging)
        global_contents = Globals(setup_logging)

        global_contents.turn_orientation(set_capabilities,
                                         global_contents.LANDSCAPE_ORIENTATION)
        assert ios_new_landing.get_edx_logo().text == strings.LOGIN_EDX_LOGO
        assert ios_new_landing.get_welcome_message(
        ).text == strings.NEW_LANDING_MESSAGE_IOS
        assert ios_new_landing.get_search_course_editfield(
        ).text == strings.NEW_LANDING_SEARCH_COURSES
        assert ios_new_landing.get_signin_button(
        ).text == strings.NEW_LANDING_LOG_IN
        assert ios_new_landing.get_register_button(
        ).text == strings.NEW_LANDING_CREATE_YOUR_ACCOUNT

        search_courses = ios_new_landing.search_courses(
            global_contents.new_landing_search_courses).text
        assert search_courses == strings.DISCOVER_CANCEL
        ios_new_landing.cancel_discovery_screen()
        assert ios_new_landing.get_welcome_message(
        ).text == strings.NEW_LANDING_MESSAGE_IOS

        assert ios_new_landing.back_and_forth_login()
        assert ios_new_landing.back_and_forth_register()

        global_contents.turn_orientation(set_capabilities,
                                         global_contents.PORTRAIT_ORIENTATION)
コード例 #4
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
コード例 #5
0
    def test_ui_elements_smoke(self, set_capabilities, setup_logging):
        """
        Verify following contents are visible on screen, 
            "edX logo", "Message" text-field, "Search Courses" edit-field, "Register" button, "Sign In" button
        Verify all contents have their default values
        """

        ios_new_landing = IosNewLanding(set_capabilities, setup_logging)

        assert ios_new_landing.get_edx_logo().text == strings.LOGIN_EDX_LOGO
        assert ios_new_landing.get_welcome_message(
        ).text == strings.NEW_LANDING_MESSAGE_IOS
        assert ios_new_landing.get_search_course_editfield(
        ).text == strings.NEW_LANDING_SEARCH_COURSES
        assert ios_new_landing.get_signin_button(
        ).text == strings.NEW_LANDING_LOG_IN
        assert ios_new_landing.get_register_button(
        ).text == strings.NEW_LANDING_CREATE_YOUR_ACCOUNT
コード例 #6
0
    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