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()
Пример #2
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')
Пример #3
0
    def back_and_forth_register(self):
        """
        Load register screen and get back to previous screen

        Returns:
             bool: Returns True if app is back on Register screen
        """

        android_new_landing_page = AndroidNewLanding(self.driver, self.log)

        if self.driver.current_activity == Globals.REGISTER_ACTIVITY_NAME:
            self.driver.back()

            if (self.driver.current_activity
                    == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME
                    and android_new_landing_page.load_register_screen()
                    == Globals.REGISTER_ACTIVITY_NAME):
                self.log.info('Register screen is successfully loaded')
            else:
                self.log.error('New Landing screen is not loaded')
                self.global_contents.flag = False
        else:
            self.log.error('Register screen is not loaded')
            self.global_contents.flag = False

        return self.global_contents.flag
Пример #4
0
    def back_and_forth_login(self):
        """
        Load login screen and get back to previous screen

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

        android_new_landing_page = AndroidNewLanding(self.driver, self.log)

        if self.driver.current_activity == Globals.LOGIN_ACTIVITY_NAME:
            self.get_back_icon().click()

            if (self.driver.current_activity
                    == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME
                    and android_new_landing_page.load_login_screen()
                    == Globals.LOGIN_ACTIVITY_NAME):
                self.global_contents.flag = True
            else:
                self.log.error('New Landing screen is not loaded')
                self.global_contents.flag = False
        else:
            self.log.error('Login screen is not loaded')
            self.global_contents.flag = False

        return self.global_contents.flag
Пример #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(5)
        email = user_name + '@example.com'
        first_name = global_contents.generate_random_credentials(4)
        last_name = global_contents.generate_random_credentials(4)
        name = first_name + ' ' + last_name
        full_name = name
        password = global_contents.generate_random_credentials(8)
        setup_logging.info(
            'Email - {},  Username - {}, Full Name - {}, Password -{}'.format(
                email, user_name, full_name, password))

        android_register_page.back_and_forth_register()
        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.navigate_features(
        ).text == strings.WHATS_NEW_DONE
        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__))
    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 Programs will load Programs 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
        """

        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_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_programs_tab(
        ).text == strings.MAIN_DASHBOARD_PROGRAMS_TAB
        assert android_main_dashboard_page.get_discovery_tab(
        ).text == strings.MAIN_DASHBOARD_DISCOVERY_TAB

        assert android_main_dashboard_page.load_programs_tab(
        ).text == strings.MAIN_DASHBOARD_PROGRAMS_TAB
        assert android_main_dashboard_page.load_programs_tab().is_selected()
        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()
Пример #7
0
    def test_start_register_smoke(self, set_capabilities, setup_logging):
        """
        Scenario:
            Verify Register screen is loaded successfully
        """

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

        android_new_landing_page = AndroidNewLanding(set_capabilities, setup_logging)
        android_register_page = AndroidRegister(set_capabilities, setup_logging)

        android_new_landing_page.load_register_screen()
        assert android_register_page.on_screen() == Globals.REGISTER_ACTIVITY_NAME
Пример #8
0
    def test_start_new_landing_smoke(self, set_capabilities, setup_logging):
        """
        Scenarios:
            Verify New Landing screen is loaded successfully
        """

        setup_logging.info('-- Starting New Landing Test Case --')
        global_contents = Globals(setup_logging)
        android_new_landing = AndroidNewLanding(set_capabilities,
                                                setup_logging)

        assert android_new_landing.on_screen(
        ) == global_contents.DISCOVERY_LAUNCH_ACTIVITY_NAME
Пример #9
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)
        android_new_landing = AndroidNewLanding(set_capabilities,
                                                setup_logging)

        search_courses_screen = android_new_landing.search_courses(
            global_contents.new_landing_search_courses)
        assert search_courses_screen == global_contents.WITHOUT_LOGIN_DISCOVERY_ACTIVITY_NAME
        set_capabilities.back()
        assert android_new_landing.on_screen(
        ) == global_contents.DISCOVERY_LAUNCH_ACTIVITY_NAME
Пример #10
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')
Пример #11
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')
        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
Пример #12
0
    def test_new_landing_back_and_forth_smoke(self, set_capabilities,
                                              setup_logging):
        """
        Scenarios:
                Verify tapping "Login" will load "Sign In" screen
                Verify tapping back/cross icon from 'Sign In' screen navigate user
                    back to 'New Landing' screen
                Verify tapping "Create your Account" loads "Register" screen
                Verify tapping back/cross icon from "Register" screen
                    navigate user back to 'New Landing' screen
        """

        android_new_landing = AndroidNewLanding(set_capabilities,
                                                setup_logging)

        assert android_new_landing.back_and_forth_login()
        assert android_new_landing.back_and_forth_register()

        setup_logging.info('-- Ending New landing Test Case --')
Пример #13
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.navigate_features(
        ).text == strings.WHATS_NEW_DONE
        assert android_whats_new_page.exit_features(
        ) == Globals.MAIN_DASHBOARD_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()
Пример #14
0
    def test_new_landing_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
        """

        android_new_landing = AndroidNewLanding(set_capabilities,
                                                setup_logging)

        assert android_new_landing.get_edx_logo().text == strings.BLANK_FIELD
        android_new_landing.get_welcome_message()
        # assert android_new_landing.get_welcome_message().text == strings.NEW_LANDING_MESSAGE_ANDROID
        assert android_new_landing.get_search_course_icon(
        ).text == strings.NEW_LANDING_SEARCH_COURSES
        assert android_new_landing.get_search_course_editfield(
        ).text == strings.NEW_LANDING_SEARCH_COURSES
        assert android_new_landing.get_signin_button(
        ).text == strings.NEW_LANDING_LOG_IN
        assert android_new_landing.get_register_button(
        ).text == strings.NEW_LANDING_CREATE_YOUR_ACCOUNT