コード例 #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_start_login_smoke(self, set_capabilities, setup_logging):
        """
        Scenario:
                Verify Login screen is loaded successfully
        """

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

        ios_new_landing_page = IosNewLanding(set_capabilities, setup_logging)
        assert ios_new_landing_page.load_login_screen().text == strings.LOGIN

        setup_logging.info('Login screen successfully loaded')
コード例 #3
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(
            TestIosRegister.__name__))

        ios_new_landing_page = IosNewLanding(set_capabilities, setup_logging)
        ios_register_page = IosRegister(set_capabilities, setup_logging)

        ios_new_landing_page.load_register_screen()
        assert ios_register_page.get_register_divider_textview(
        ).text == strings.REGISTER_SCREEN_REGISTER_WITH
コード例 #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_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
        """

        ios_new_landing = IosNewLanding(set_capabilities, setup_logging)
        assert ios_new_landing.back_and_forth_login()
        assert ios_new_landing.back_and_forth_register()

        setup_logging.info('-- Ending {} Test Case'.format(
            TestIosNewLanding.__name__))
コード例 #6
0
    def back_and_forth_new_landing(self):
        """
        From Login screen tapping back will load New Landing screen and tapping Login will
            load Login screen

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

        ios_new_landing = IosNewLanding(self.driver, self.log)

        if self.on_screen().text == strings.LOGIN:
            self.driver.back()
            if ios_new_landing.load_login_screen().text != strings.LOGIN:
                self.log.error('Problem - New Landing screen is not loaded')
                self.global_contents.flag = False
        else:
            self.log.info('Problem - Login screen is not loaded')
            self.global_contents.flag = False

        return self.global_contents.flag
コード例 #7
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
コード例 #8
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
        """

        ios_new_landing_page = IosNewLanding(self.driver, self.log)

        if self.get_register_divider_textview(
        ).text == strings.REGISTER_SCREEN_REGISTER_WITH:
            self.driver.back()
            if ios_new_landing_page.load_register_screen(
            ).text == strings.REGISTER_SCREEN_REGISTER_WITH:
                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('Not on Register screen')
            self.global_contents.flag = False

        return self.global_contents.flag
コード例 #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)
        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
コード例 #10
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
コード例 #11
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)