コード例 #1
0
    def test_discovery_screen(self, set_capabilities, setup_logging):
        """
        Scenarios:
            Verify that from Main Dashboard tapping on Discovery tab will load Discovery
            contents in its tab
        """

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

        global_contents = Globals(setup_logging)
        android_new_landing_page = AndroidNewLanding(set_capabilities, setup_logging)
        android_login_page = AndroidLogin(set_capabilities, setup_logging)
        android_whats_new_page = AndroidWhatsNew(set_capabilities, setup_logging)
        android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging)

        assert android_new_landing_page.on_screen() == global_contents.DISCOVERY_LAUNCH_ACTIVITY_NAME
        assert android_new_landing_page.load_login_screen() == Globals.LOGIN_ACTIVITY_NAME
        assert android_login_page.login(
            global_contents.login_user_name,
            global_contents.login_password,
            global_contents.is_first_time
        ) == Globals.WHATS_NEW_ACTIVITY_NAME
        android_whats_new_page.navigate_features()
        assert android_whats_new_page.exit_features() == Globals.MAIN_DASHBOARD_ACTIVITY_NAME

        setup_logging.info('{} is successfully logged in'.format(global_contents.login_user_name))

        assert android_main_dashboard_page.load_discovery_tab().text == strings.MAIN_DASHBOARD_DISCOVERY_TAB
        assert android_main_dashboard_page.load_discovery_tab().is_selected()
コード例 #2
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(TestAndroidMyCoursesList.__name__))

        global_contents = Globals(setup_logging)
        android_new_landing_page = AndroidNewLanding(set_capabilities, setup_logging)
        android_login_page = AndroidLogin(set_capabilities, setup_logging)
        android_whats_new_page = AndroidWhatsNew(set_capabilities, setup_logging)
        android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging)

        assert android_new_landing_page.on_screen() == global_contents.DISCOVERY_LAUNCH_ACTIVITY_NAME
        assert android_new_landing_page.load_login_screen() == Globals.LOGIN_ACTIVITY_NAME
        assert android_login_page.login(
            global_contents.login_user_name,
            global_contents.login_password,
            global_contents.is_first_time
        ) == Globals.WHATS_NEW_ACTIVITY_NAME
        setup_logging.info('{} is successfully logged in'.format(global_contents.login_user_name))

        assert android_whats_new_page.navigate_features()
        assert android_whats_new_page.exit_features() == Globals.MAIN_DASHBOARD_ACTIVITY_NAME
        assert android_main_dashboard_page.load_courses_tab()
コード例 #3
0
    def test_forgot_password_alert(self, set_capabilities, setup_logging):
        """
        Scenarios:
                Verify tapping 'Forgot your password?' will  load 'Reset Password' alert
                Verify following contents are visible on 'Reset Password' alert, 
                Alert Title, Alert Message, Email edit field, Cancel & OK buttons
                Verify tapping 'Cancel' will close 'Reset Password' alert
        """
        try:
            android_login_page = AndroidLogin(set_capabilities, setup_logging)
            android_login_page.get_forgot_password_alert()

            assert android_login_page.get_forgot_password_alert_title(
            ).text == strings.LOGIN_RESET_PASSWORD_ALERT_TITLE
            # assert android_login_page.get_forgot_password_alert_msg().text == strings.LOGIN_RESET_PASSWORD_ALERT_MSG
            assert android_login_page.get_forgot_password_alert_ok_button(
            ).text == strings.LOGIN_RESET_PASSWORD_ALERT_OK
            forgot_password_alert_cancel_button = android_login_page.get_forgot_password_alert_cancel_button(
            ).text
            assert 1 == 0
            assert forgot_password_alert_cancel_button == strings.LOGIN_RESET_PASSWORD_ALERT_CANCEL

            assert android_login_page.close_forgot_password_alert()

        except:
            android_login_page = AndroidLogin(set_capabilities, setup_logging)
            android_global = Globals(object)
            test_case_name = 'test_forgot_password_alert'
            android_global.screenshot(set_capabilities, test_case_name,
                                      setup_logging)
            assert 1 == 0
コード例 #4
0
    def test_re_login_smoke(self, setup_logging, set_capabilities):
        """
        Scenarios:
            Verify after re-login with same user "Whats New" screen will not be visible
        """

        global_contents = Globals(setup_logging)
        android_main_dashboard_page = AndroidMainDashboard(
            set_capabilities, setup_logging)

        assert android_main_dashboard_page.get_logout_account_option(
        ).text == strings.ACCOUNT_LOGOUT
        assert android_main_dashboard_page.log_out(
        ) == global_contents.NEW_LOGISTRATION_ACTIVITY_NAME
        setup_logging.info('{} is successfully logged out'.format(
            global_contents.login_user_name))

        android_login_page = AndroidLogin(set_capabilities, setup_logging)
        android_new_landing_page = AndroidNewLanding(set_capabilities,
                                                     setup_logging)

        assert android_new_landing_page.load_login_screen(
        ) == Globals.LOGIN_ACTIVITY_NAME
        login_output = android_login_page.login(
            global_contents.login_user_name, global_contents.login_password,
            False)

        assert login_output == Globals.MAIN_DASHBOARD_ACTIVITY_NAME
        setup_logging.info('{} is successfully logged in'.format(
            global_contents.target_environment))

        setup_logging.info('-- Ending {} Test Case'.format(
            TestAndroidWhatsNew.__name__))
コード例 #5
0
    def test_register_smoke(self, set_capabilities, setup_logging):
        """
        Verify that tapping "Create your account" button after filling all required input(valid) types,
            will validate all inputs and load "Whats new feature screen" with specific user logged in
        Verify that user should be able to log out and re-login with new created account credentials
        """

        android_register_page = AndroidRegister(set_capabilities,
                                                setup_logging)
        global_contents = Globals(setup_logging)

        user_name = global_contents.generate_random_credentials(4)
        email = user_name + '@example.com'
        first_name = global_contents.generate_random_credentials(4)
        last_name = global_contents.generate_random_credentials(4)
        full_name = (first_name + ' ' + last_name)
        password = global_contents.generate_random_credentials(8)
        setup_logging.info(
            'Email - {},  Username - {}, Full Name - {}, Password -{}'.format(
                email, user_name, full_name, password))

        register_output = android_register_page.register(
            email, full_name, user_name, password, global_contents.country)

        global_contents.wait_for_android_activity_to_load(
            set_capabilities, global_contents.REGISTER_ACTIVITY_NAME)

        assert register_output == Globals.WHATS_NEW_ACTIVITY_NAME

        android_whats_new_page = AndroidWhatsNew(set_capabilities,
                                                 setup_logging)
        android_whats_new_page.navigate_features()
        assert android_whats_new_page.exit_features(
        ) == Globals.MAIN_DASHBOARD_ACTIVITY_NAME

        android_main_dashboard_page = AndroidMainDashboard(
            set_capabilities, setup_logging)
        assert android_main_dashboard_page.get_logout_account_option(
        ).text == strings.ACCOUNT_LOGOUT
        assert android_main_dashboard_page.log_out(
        ) == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME

        android_new_landing_page = AndroidNewLanding(set_capabilities,
                                                     setup_logging)
        assert android_new_landing_page.load_login_screen(
        ) == Globals.LOGIN_ACTIVITY_NAME

        android_login_page = AndroidLogin(set_capabilities, setup_logging)

        login_output = android_login_page.login(user_name, password, False)

        assert login_output == Globals.MAIN_DASHBOARD_ACTIVITY_NAME
        setup_logging.info('{} is successfully logged in'.format(user_name))

        setup_logging.info('-- Ending {} Test Case'.format(
            TestAndroidRegister.__name__))
コード例 #6
0
    def test_back_and_forth_smoke(self, set_capabilities, setup_logging):
        """
        Scenarios:
                Verify tapping back icon from 'Sign In' screen navigate user
                    back to 'New Landing' screen.
                Verify that user is able to load EULA screen and get back to Login Screen
                Verify that user is able to load Terms screen and get back to Login Screen
                Verify that user is able to load Privacy screen and get back to Login Screen
        """
        android_login_page = AndroidLogin(set_capabilities, setup_logging)

        assert android_login_page.back_and_forth_login()
コード例 #7
0
    def test_start_login_smoke(self, set_capabilities, setup_logging):
        """
        Scenario:
            Verify Login screen is loaded successfully
        """

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

        android_new_landing_page = AndroidNewLanding(set_capabilities, setup_logging)
        android_login_page = AndroidLogin(set_capabilities, setup_logging)

        assert android_new_landing_page.load_login_screen() == Globals.LOGIN_ACTIVITY_NAME
        assert android_login_page.on_screen() == Globals.LOGIN_ACTIVITY_NAME

        setup_logging.info('Login screen successfully loaded')
コード例 #8
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
コード例 #9
0
    def test_login_smoke(self, set_capabilities, setup_logging):
        """
        Verifies that user can login with valid Username and Password
        """

        global_contents = Globals(setup_logging)
        android_login_page = AndroidLogin(set_capabilities, setup_logging)

        assert android_login_page.login(
            global_contents.login_wrong_user_name,
            global_contents.login_wrong_password) is False

        login_output = android_login_page.login(
            global_contents.login_user_name,
            global_contents.login_password)
        assert login_output == Globals.WHATS_NEW_ACTIVITY_NAME
        setup_logging.info('{} is successfully logged in'.format(global_contents.login_user_name))
        setup_logging.info('-- Ending {} Test Case'.format(TestAndroidLogin.__name__))
コード例 #10
0
    def test_start_course_dashboard_smoke(self, login, set_capabilities,
                                          setup_logging):

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

        global_contents = Globals(setup_logging)
        android_new_landing_page = AndroidNewLanding(set_capabilities,
                                                     setup_logging)
        android_login_page = AndroidLogin(set_capabilities, setup_logging)
        android_whats_new_page = AndroidWhatsNew(set_capabilities,
                                                 setup_logging)
        android_main_dashboard_page = AndroidMainDashboard(
            set_capabilities, setup_logging)
        assert android_whats_new_page.navigate_features()
        assert android_whats_new_page.exit_features(
        ) == Globals.MAIN_DASHBOARD_ACTIVITY_NAME
コード例 #11
0
    def test_landscape_smoke(self, set_capabilities, setup_logging):
        """
        Scenarios:
                Landscape support is added for Main Dashboard screen with following cases,
                Change device orientation to Landscape mode
                Verify following contents are visible on screen, 
                    Logged in user's avatar, Screen Title, Account Icon
                    Courses Tab, Discovery Tab
                Verify that Courses tab will be selected by default
                Verify on tapping Courses will load Courses contents in its tab
                Verify on tapping Discovery will load Discovery contents in its tab
                Verify tapping user's avatar will load User Profile screen
                Verify tapping back/cancel icon from User Profile screen should get back to Main Dashboard screen
                Verify tapping Account Icon will load Account Screen
                Verify tapping back/cancel icon from Account Screen should get back to Main Dashboard screen
                Verify that user can log out successfully, and back on Login screen
        """

        global_contents = Globals(setup_logging)
        android_main_dashboard_page = AndroidMainDashboard(
            set_capabilities, setup_logging)
        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
        login_output = android_login_page.login(
            global_contents.login_user_name, global_contents.login_password,
            False)
        setup_logging.info('{} is successfully logged in'.format(
            global_contents.login_user_name))
        assert login_output == Globals.MAIN_DASHBOARD_ACTIVITY_NAME

        global_contents.turn_orientation(set_capabilities,
                                         global_contents.LANDSCAPE_ORIENTATION)

        assert android_main_dashboard_page.get_profile_icon(
        ).text == strings.BLANK_FIELD
        assert android_main_dashboard_page.get_title_textview(
        ).text == strings.MAIN_DASHBOARD_SCREEN_TITLE
        assert android_main_dashboard_page.get_menu_icon(
        ).text == strings.BLANK_FIELD
        assert android_main_dashboard_page.get_courses_tab(
        ).text == strings.MAIN_DASHBOARD_COURSES_TAB
        assert android_main_dashboard_page.get_discovery_tab(
        ).text == strings.MAIN_DASHBOARD_DISCOVERY_TAB

        assert android_main_dashboard_page.load_discovery_tab(
        ).text == strings.MAIN_DASHBOARD_DISCOVERY_TAB
        assert android_main_dashboard_page.load_discovery_tab().is_selected()
        assert android_main_dashboard_page.load_courses_tab(
        ).text == strings.MAIN_DASHBOARD_COURSES_TAB
        assert android_main_dashboard_page.load_courses_tab().is_selected()
        assert android_main_dashboard_page.load_profile_screen(
        ) == global_contents.PROFILE_ACTIVITY_NAME
        set_capabilities.back()
        assert android_main_dashboard_page.load_account_screen(
        ) == global_contents.ACCOUNT_ACTIVITY_NAME
        set_capabilities.back()

        assert android_main_dashboard_page.log_out(
        ) == global_contents.DISCOVERY_LAUNCH_ACTIVITY_NAME
        setup_logging.info('{} is successfully logged out'.format(
            global_contents.login_user_name))
        global_contents.turn_orientation(set_capabilities,
                                         global_contents.PORTRAIT_ORIENTATION)

        setup_logging.info('-- Ending {} Test Case'.format(
            TestAndroidMainDashboard.__name__))
コード例 #12
0
    def test_ui_elements(self, set_capabilities, setup_logging):
        """
        Scenarios:
        Verify following contents are visible on screen 
            "Back icon", "Sign In" Title, "User name or e-mail address" label, User Name edit-field
            Password edit-field, "Forgot your password?" option, "Sign In" button,
            "Or sing in with" label, "Facebook" button, "Google" button,
            "By signing in to this app, you agree to the" label,
            "edX Terms of Service and Honor Code" option
        Verify all screen contents have their default values
        """
        try:
            android_login_page = AndroidLogin(set_capabilities, setup_logging)

            assert android_login_page.get_title_textview(
            ).text == strings.LOGIN
            assert android_login_page.get_username_editfield(
            ).text == strings.BLANK_FIELD
            assert android_login_page.get_password_editfield(
            ).text == strings.BLANK_FIELD
            # assert android_login_page.get_password_editfield().text == strings.LOGIN_PASSWORD_WATER_MARK
            assert android_login_page.get_forgot_password_textview(
            ).text == strings.LOGIN_FORGOT_PASSWORD
            assert android_login_page.get_sign_in_button(
            ).text == strings.LOGIN
            login_with_email_divider = android_login_page.get_login_with_email_divider_textview(
            ).text
            assert login_with_email_divider == strings.LOGIN_ANDROID_WITH_EMAIL_DIVIDER
            assert android_login_page.get_facebook_textview(
            ).text == strings.FACEBOOK_OPTION
            assert android_login_page.get_google_textview(
            ).text == strings.GOOGLE_OPTION
            assert android_login_page.get_agreement_textview(
            ).text == strings.LOGIN_ANDROID_AGREEMENT
        except:
            android_login_page = AndroidLogin(set_capabilities, setup_logging)
            android_global = Globals(object)
            test_case_name = 'test_ui_elements'
            android_global.screenshot(set_capabilities, test_case_name,
                                      setup_logging)
            assert 1 == 0
コード例 #13
0
    def test_start_login_smoke(self, set_capabilities, setup_logging):
        """
        Scenario:
            Verify Login screen is loaded successfully
        """
        try:
            setup_logging.info('-- Starting {} Test Case'.format(
                TestAndroidLogin.__name__))

            android_new_landing_page = AndroidNewLanding(
                set_capabilities, setup_logging)
            android_login_page = AndroidLogin(set_capabilities, setup_logging)

            assert android_new_landing_page.load_login_screen(
            ) == Globals.LOGIN_ACTIVITY_NAME
            assert android_login_page.on_screen(
            ) == Globals.LOGIN_ACTIVITY_NAME

            setup_logging.info('Login screen successfully loaded')
            android_login_page.wifi_toggle()
            android_login_page.location_toggle()

            # set_capabilities.driver.toggle_wifi()
        except:
            android_login_page = AndroidLogin(set_capabilities, setup_logging)
            android_global = Globals(object)
            test_case_name = 'test_start_login_smoke'
            android_global.screenshot(set_capabilities, test_case_name,
                                      setup_logging)
            android_login_page.wifi_toggle()
            android_login_page.location_toggle()