Example #1
0
    def test_login_smoke(self, set_capabilities, setup_logging):
        """
        Scenario:
                Verify that app shows proper error msg/dialog when user try to login with wrong Username or password
                Verify that user can login with valid Username and Password
                Verify that user can log out and back to login screen
        """

        global_contents = Globals(setup_logging)
        ios_login_page = IosLogin(set_capabilities, setup_logging)
        assert ios_login_page.login(
            global_contents.login_wrong_user_name,
            global_contents.login_wrong_password) is False

        ios_login_page.login(global_contents.login_user_name,
                             global_contents.login_password)

        if global_contents.is_first_time:
            ios_whats_new_page = IosWhatsNew(set_capabilities, setup_logging)
            ios_whats_new_page.get_close_button().click()

        else:
            setup_logging.info('navigate_features is not needed')

        setup_logging.info('{} is successfully logged in'.format(
            global_contents.login_user_name))
        ios_main_dashboard_page = IosMainDashboard(set_capabilities,
                                                   setup_logging)
        assert ios_main_dashboard_page.get_drawer_icon(
        ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME
        assert ios_main_dashboard_page.get_account_options(
        )[3].text == strings.ACCOUNT_LOGOUT
        assert ios_main_dashboard_page.log_out().text == strings.LOGIN
        setup_logging.info('{} is successfully logged out'.format(
            global_contents.login_user_name))
Example #2
0
    def test_check_login_smoke(self, login, set_capabilities, setup_logging):
        """
        Scenarios:
            Verify Main Dashboard screen is loaded successfully after successful login
        """

        global_contents = Globals(setup_logging)
        whats_new_page = IosWhatsNew(set_capabilities, setup_logging)

        setup_logging.info('-- Starting {} Test Case'.format(
            IosLoginSmoke.__name__))
        if login:
            setup_logging.info('{} is successfully logged in'.format(
                global_contents.login_user_name))

        if strings.IS_FIRST_TIME:
            assert whats_new_page.exit_features().text == strings.BLANK_FIELD
            strings.IS_FIRST_TIME = False
        else:
            main_dashboard_page = IosMainDashboard(set_capabilities,
                                                   setup_logging)
            assert main_dashboard_page.get_drawer_icon(
            ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME
        setup_logging.info('{} is successfully logged in'.format(
            global_contents.login_user_name))
Example #3
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')

        global_contents = Globals(setup_logging)
        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.BLANK_FIELD
        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
    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')
Example #5
0
    def test_navigate_features_smoke(self, set_capabilities, setup_logging):
        """
            Verify that user can navigate between features
        """

        global_contents = Globals(setup_logging)
        if global_contents.is_first_time:
            ios_whats_new_page = IosWhatsNew(set_capabilities, setup_logging)
            assert ios_whats_new_page.navigate_features().text == strings.WHATS_NEW_DONE

        else:
            setup_logging.info('navigate_features is not needed')
Example #6
0
    def test_landscape_smoke(self, set_capabilities, setup_logging):
        """
        Scenarios:
                Landscape support is added for Whats New screen with following cases,
                Change device orientation to Landscape mode
                Verify Whats New screen is loaded successfully after login
                Verify following contents are visible on screen, 
                    "Screen Title", "Cross Icon", "Main Feature Image",
                     "Feature Title", "Feature Details", "Done"
                Verify all screen contents have their default values
                Verifies that user can navigate between features
                Verifies that user can close New Feature screen and move to Main Dashboard screen
                Verify after re-login with same user "Whats New" screen will not be visible
                Change device orientation to Portrait mode
        """
        global_contents = Globals(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_main_dashboard_page.get_drawer_icon().text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME
        assert ios_main_dashboard_page.get_account_options()[3].text == strings.ACCOUNT_LOGOUT
        assert ios_main_dashboard_page.log_out().text == strings.LOGIN

        assert ios_login_page.login(global_contents.login_user_name, global_contents.login_password)
        assert IosWhatsNew(set_capabilities, setup_logging).get_title_textview()
        setup_logging.info('{} is successfully logged in'.format(global_contents.login_user_name))
        global_contents.turn_orientation(set_capabilities, global_contents.LANDSCAPE_ORIENTATION)
        assert ios_whats_new_page.get_title_textview()
        assert ios_whats_new_page.get_close_button().text == strings.BLANK_FIELD
        assert ios_whats_new_page.get_main_image()
        assert ios_whats_new_page.get_feature_title_textview()
        assert ios_whats_new_page.get_feature_details()
        assert ios_whats_new_page.get_done_button().text == strings.WHATS_NEW_DONE
        assert ios_whats_new_page.navigate_features().text == strings.WHATS_NEW_DONE

        assert ios_main_dashboard_page.get_drawer_icon().text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME
        assert ios_main_dashboard_page.get_account_options()[3].text == strings.ACCOUNT_LOGOUT
        assert ios_main_dashboard_page.log_out().text == strings.LOGIN
        setup_logging.info('{} is successfully logged out'.format(global_contents.login_user_name))

        ios_login_page = IosLogin(set_capabilities, setup_logging)
        login_output = ios_login_page.login(
            global_contents.login_user_name,
            global_contents.login_password,
            False
        )
        assert login_output.text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME
        setup_logging.info('{} is successfully logged in'.format(global_contents.target_environment))
        global_contents.turn_orientation(set_capabilities, global_contents.PORTRAIT_ORIENTATION)

        setup_logging.info('-- Ending Test Case')
Example #7
0
    def test_close_features_screen_smoke(self, set_capabilities, setup_logging):
        """
            Verify that user can close New Feature screen and move to Main Dashboard screen
        """

        global_contents = Globals(setup_logging)
        if global_contents.is_first_time:

            ios_whats_new_page = IosWhatsNew(set_capabilities, setup_logging)
            assert ios_whats_new_page.exit_features().text == strings.BLANK_FIELD

        else:
            setup_logging.info('close_features_screen is not needed')
Example #8
0
    def test_validate_ui_elements_smoke(self, set_capabilities, setup_logging):
        """
        Scenarios:
                Verify following contents are visible on screen, 
                    "Screen Title", "Cross Icon", "Main Feature Image",
                     "Feature Title", "Feature Details", "Done"
                Verify all screen contents have their default values
        """

        global_contents = Globals(setup_logging)
        if global_contents.is_first_time:

            ios_whats_new_page = IosWhatsNew(set_capabilities, setup_logging)

            assert ios_whats_new_page.get_title_textview()
            assert ios_whats_new_page.get_close_button(
            ).text == strings.WHATS_NEW_Close_button
            assert ios_whats_new_page.get_main_image()
            assert ios_whats_new_page.get_feature_title_textview()
            assert ios_whats_new_page.get_feature_details()
            assert ios_whats_new_page.get_close_button(
            ).text == strings.CLOSE_BUTTON_TEXT

        else:
            setup_logging.info('validate_ui_elements is not needed')
            assert True
Example #9
0
    def test_login_smoke(self, set_capabilities, setup_logging):
        """
        Scenario:
                Verify that app shows proper error msg/dialog when user try to login with wrong Username or password
                Verify that user cannot login with wrong username and password
                Verify that user cannot login with wrong username and correct password
                Verify that user cannot login with correct username and wrong password
                Verify that user can login with valid Username and Password
                Verify that user can log out and back to login screen
        """

        global_contents = Globals(setup_logging)
        ios_login_page = IosLogin(set_capabilities, setup_logging)
        assert ios_login_page.login(global_contents.login_wrong_user_name,
                                    global_contents.login_password) is False

        assert ios_login_page.login(
            global_contents.login_user_name,
            global_contents.login_wrong_password) is False

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

        ios_login_page.login(global_contents.login_user_name,
                             global_contents.login_password)

        if strings.IS_FIRST_TIME:
            ios_whats_new_page = IosWhatsNew(set_capabilities, setup_logging)
            assert ios_whats_new_page.exit_features(
            ).text == strings.BLANK_FIELD

        else:
            setup_logging.info('navigate_features is not needed')

        setup_logging.info('{} is successfully logged in'.format(
            global_contents.login_user_name))
        ios_main_dashboard_page = IosMainDashboard(set_capabilities,
                                                   setup_logging)
        assert ios_main_dashboard_page.get_drawer_icon(
        ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME
        ios_main_dashboard_page.get_drawer_icon().click()
        assert ios_main_dashboard_page.log_out().text == strings.LOGIN
        setup_logging.info('{} is successfully logged out'.format(
            global_contents.login_user_name))
Example #10
0
    def login(self, user_name, password, is_first_time=True):
        """
        Login

        Arguments:
            user_name (str): username
            password (str): password
            is_first_time (bool): True or False

        Returns:
            str: Whats New screen Title
        """
        self.get_username_editfield().click()
        self.get_username_editfield().clear()
        self.get_username_editfield().send_keys(user_name)

        self.get_password_editfield().click()
        self.get_password_editfield().send_keys(password)
        self.get_logo().click()
        self.get_sign_in_button().click()

        output = self.global_contents.wait_for_element_visibility(
            self.driver,
            ios_elements.login_wrong_credential_alert_title
        )

        if output:
            self.global_contents.wait_and_get_element(
                self.driver,
                ios_elements.login_wrong_credential_alert_title
            )
            self.global_contents.wait_and_get_element(
                self.driver,
                ios_elements.login_wrong_credential_alert_msg
            )
            wrong_credentials_alert_ok = self.global_contents.wait_and_get_element(
                self.driver,
                ios_elements.login_reset_password_alert_ok_button
            )
            wrong_credentials_alert_ok.click()

            return False

        else:
            if is_first_time is True:
                self.get_allow_notifications_button().click()
                textview_screen_title = IosWhatsNew(self.driver, self.log).get_title_textview()
                self.global_contents.is_first_time = False
            else:
                # textview_screen_title = IosWhatsNew(self.driver, self.log).get_close_button()
                # textview_screen_title.click()

                textview_screen_title = self.global_contents.wait_and_get_element(
                    self.driver,
                    ios_elements.main_dashboard_navigation_icon
                )
        return textview_screen_title
    def test_start_main_dashboard_smoke(self, login, set_capabilities, setup_logging):
        """
        Scenarios:
            Verify Main Dashboard screen is loaded successfully
        """

        global_contents = Globals(setup_logging)

        setup_logging.info('-- Starting Test Case')
        if login:
            setup_logging.info('{} is successfully logged in'.format(global_contents.login_user_name))

        ios_whats_new_page = IosWhatsNew(set_capabilities, setup_logging)
        ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging)

        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
Example #12
0
    def test_start_whats_new_smoke(self, login, setup_logging, set_capabilities):
        """
        Scenarios:
            Verify Whats New screen is loaded successfully
        """

        global_contents = Globals(setup_logging)
        setup_logging.info('-- Starting Test Case')
        if login:
            setup_logging.info('{} is successfully logged in'.format(global_contents.login_user_name))

        if global_contents.is_first_time:
            assert IosWhatsNew(set_capabilities, setup_logging).get_title_textview()
        else:
            textview_screen_title = IosMainDashboard(set_capabilities, setup_logging)
            assert textview_screen_title.get_drawer_icon().text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME
Example #13
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 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