Exemple #1
0
    def test_validate_ui_elements_smoke(self, set_capabilities, setup_logging):
        """
        Scenarios:
            Verify following contents on Header, Profile icon, "Courses" title, Account Icon
                Verify that My Courses(enrolled) List has following contents in each course,
                    Course Name, Course Start/End date
            Verify that "Looking for a new challenge?" label and "Find a Course" button are available
        """
        ios_main_dashboard_page = IosMainDashboard(set_capabilities,
                                                   setup_logging)
        ios_my_courses_list = IosMyCoursesList(set_capabilities, setup_logging)

        assert ios_main_dashboard_page.get_profile_icon(
        ).text == strings.MAIN_DASHBOARD_PROFILE
        assert ios_main_dashboard_page.get_title_textview_portrait_mode(
        ).text == strings.BLANK_FIELD
        assert ios_main_dashboard_page.get_drawer_icon(
        ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME
        assert ios_main_dashboard_page.get_courses_tab(
        ).text == strings.SELECTED_BY_DEFAULT
        assert ios_main_dashboard_page.get_discovery_tab(
        ).text == strings.MAIN_DASHBOARD_DISCOVERY_TAB

        assert ios_my_courses_list.get_my_courses_list_row()

        if ios_my_courses_list.get_my_courses_list_row():
            assert ios_my_courses_list.get_my_course_name()
            assert ios_my_courses_list.get_my_course_details()
        else:
            setup_logging.info('No course enrolled by this user.')
    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 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 following input types are optional,
                "Gender" spinner
                "Year of birth" spinner
                "Highest level of education completed" spinner
                "Tell us why you're interested in edX" label with edit-field below
            Verify that user should be able to log out and re-login with new created account credentials
        """

        ios_register_page = IosRegister(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)
        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))

        ios_register_page.submit_register_form(email, full_name, user_name,
                                               password,
                                               global_contents.country)

        assert ios_whats_new_page.get_title_textview()
        assert ios_whats_new_page.navigate_features(
        ).text == strings.WHATS_NEW_DONE
        assert ios_whats_new_page.exit_features(
        ).text == strings.MAIN_DASHBOARD_SCREEN_TITLE

        logout_option = ios_main_dashboard_page.get_account_options()[
            global_contents.fourth_existence].text
        assert logout_option == strings.ACCOUNT_LOGOUT
        assert ios_main_dashboard_page.log_out().text == strings.LOGIN
        setup_logging.info('{} is successfully logged out'.format(user_name))

        assert ios_login_page.login(user_name, password, False)
        setup_logging.info('{} is successfully logged in'.format(user_name))
        assert ios_main_dashboard_page.get_title_textview_portrait_mode(
        ).text == strings.MAIN_DASHBOARD_SCREEN_TITLE

        setup_logging.info('-- Ending Test Case')
    def test_validate_ui_elements_smoke(self, set_capabilities, setup_logging):
        """
        Scenarios:
                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
        """

        ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging)

        assert ios_main_dashboard_page.get_profile_icon().text == strings.MAIN_DASHBOARD_PROFILE
        assert ios_main_dashboard_page.get_title_textview_portrait_mode().text == strings.MAIN_DASHBOARD_SCREEN_TITLE
        assert ios_main_dashboard_page.get_drawer_icon().text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME
        assert ios_main_dashboard_page.get_courses_tab().text == strings.SELECTED_BY_DEFAULT
        assert ios_main_dashboard_page.get_discovery_tab().text == strings.MAIN_DASHBOARD_DISCOVERY_TAB
    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 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 following input types are optional,
                "Gender" spinner
                "Year of birth" spinner
                "Highest level of education completed" spinner
                "Tell us why you're interested in edX" label with edit-field below
            Verify that user should be able to log out and re-login with new created account credentials
        """

        ios_register_page = IosRegister(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)
        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)
        full_name = (first_name + ' ' + last_name)
        password = global_contents.generate_random_credentials(8)

        ios_register_page.submit_register_form('',
                                               full_name,
                                               user_name,
                                               password,
                                               click_country=False)
        ios_register_page.validate_required_optional_fields()
        assert ios_register_page.get_email_validation_textview(
        ).text == strings.REGISTER_EMAIL_BLANK_ERROR

        ios_register_page.submit_register_form(email,
                                               '',
                                               user_name,
                                               password,
                                               click_country=False)
        ios_register_page.validate_required_optional_fields()
        assert ios_register_page.get_full_name_validation_textview(
        ).text == strings.REGISTER_FULL_NAME_BLANK_ERROR

        ios_register_page.submit_register_form(email,
                                               full_name,
                                               '',
                                               password,
                                               click_country=False)
        ios_register_page.validate_required_optional_fields()
        assert ios_register_page.get_username_validation_textview(
        ).text == strings.REGISTER_USER_NAME_BLANK_ERROR

        ios_register_page.submit_register_form(email,
                                               full_name,
                                               user_name,
                                               '',
                                               click_country=False)
        ios_register_page.validate_required_optional_fields()
        assert ios_register_page.get_password_validation_textview(
        ).text == strings.REGISTER_PASSWORD_BLANK_ERROR

        setup_logging.info(
            'Email - {},  Username - {}, Full Name - {}, Password -{}'.format(
                email, user_name, full_name, password))

        ios_register_page.submit_register_form(email, full_name, user_name,
                                               password)

        assert ios_whats_new_page.get_title_textview()

        assert ios_whats_new_page.navigate_features(
        ).text == strings.CLOSE_BUTTON_TEXT
        assert ios_whats_new_page.exit_features().text == strings.BLANK_FIELD

        assert ios_main_dashboard_page.load_account_screen(
        ).text == strings.PROFILE_SCREEN_TITLE
        assert ios_main_dashboard_page.log_out().text == strings.LOGIN
        setup_logging.info('{} is successfully logged out'.format(user_name))

        assert ios_login_page.login(user_name, password)
        setup_logging.info('{} is successfully logged in'.format(user_name))
        assert ios_main_dashboard_page.get_title_textview_portrait_mode(
        ).text == strings.MAIN_DASHBOARD_SCREEN_TITLE