コード例 #1
0
def select_menu(frame_object, menu_name, timeout_secs=10):
    """Select menu with the given name

    Args:
        frame_object (Class): Class of the Frame Object that can read this menu
        menu_name (str): Name of the menu to select
        timeout_secs (int): Timeout in seconds for finding the frame object
    """
    # Get the menus:
    # pylint: disable=stbt-wait-until-callable
    menu = stbt.wait_until(frame_object, timeout_secs=timeout_secs)

    # Check if the menu we want exists:
    menu_item = [x for x in menu.menu_items if x.text == menu_name]
    assert menu_item is not None, 'Menu item {0} not found in this screen'.format(menu_name)

    if menu.message == menu_name:
        return

    for i in range(0, MAX_MENU_LENGTH):
        # pylint: disable=stbt-wait-until-callable
        menu = stbt.wait_until(frame_object, timeout_secs=timeout_secs)
        debug('[SELECT_MENU] Screen {0} selected: {1}->{2}'.format(type(menu).__name__, i, menu.message))

        if menu.message == menu_name:
            debug('[SELECT_MENU] Item found: {0} -> {1}->{2}'.format(type(menu).__name__, i, menu.message))
            break
        stbt.press('KEY_DOWN')
        # Give STB 3 seconds to move the highlighted menu entry
        sleep(3)

    assert menu.message == menu_name, \
        '[SELECT_MENU] ({0}) Selected item is not [{1}]'.format(type(menu).__name__, menu_name)
コード例 #2
0
 def __init__(self, frame, region):
     self.frame = frame
     self.region = region
     self.text_region = get_bottom_text_region(region)
     self.image_region = get_default_image_region(region)
     debug('REGION: {0}'.format(self.text_region))
     if self.text_region is not None:
         self.text = sky_plus_utils.find_text(frame, self.text_region)
         self.selected = sky_plus_utils.match_color(frame, self.text_region,
                                                    YELLOW_BACKGROUND_RGB)
コード例 #3
0
    def is_visible(self):
        # pylint: disable=stbt-frame-object-missing-frame
        logo_visible = stbt.match(INTERACTIVE_SKY_LOGO)
        debug('[INTERACTIVE] Logo visible: {0}'.format(logo_visible))
        if logo_visible:
            title = find_text(self._frame, TITLE_REGION)
            debug('[INTERACTIVE] Text found: {0}'.format(title))
            title_visible = (title == sky_plus_strings.INTERACTIVE)

            return title_visible
        return False
コード例 #4
0
 def is_visible(self):
     # pylint: disable=stbt-frame-object-missing-frame
     logo_visible = stbt.match(mysky_constants.SKY_TOP_LOGO,
                               region=MY_SKY_REGION)
     if logo_visible:
         text = sky_plus_utils.find_text(self._frame,
                                         SS_DEV_MODE_TITLE_REGION)
         debug('[FIND VCN] Text found: {0}'.format(text))
         title_visible = (text == sky_plus_strings.SS_VCN)
         return title_visible
     return False
コード例 #5
0
 def is_visible(self):
     # pylint: disable=stbt-frame-object-missing-frame
     logo_visible = stbt.match(mysky_constants.SKY_TOP_LOGO,
                               region=MY_SKY_REGION)
     debug('[SECRET_SCENE] Logo visible: {0}'.format(logo_visible))
     if logo_visible:
         text = sky_plus_utils.find_text(self._frame,
                                         SECRET_SCENE_TITLE_REGION)
         debug('[SECRET_SCENE] Text found: {0}'.format(text))
         title_visible = (text == sky_plus_strings.INTERACTIVE_MY_SKY)
         return title_visible
     return False
コード例 #6
0
 def is_visible(self):
     # pylint: disable=stbt-frame-object-missing-frame
     logo_visible = stbt.match(mysky_constants.SKY_TOP_LOGO,
                               region=MY_SKY_REGION)
     debug('[MYSKY MAIN] Logo visible: {0}'.format(logo_visible))
     if logo_visible:
         text = sky_plus_utils.find_text(self._frame,
                                         MAIN_MENU_LOADING_REGION)
         debug('[MYSKY MAIN] Text found: {0}'.format(text))
         loading_visible = (text == sky_plus_strings.LOADING)
         light_is_green = ui_ready(self._frame)
         return not loading_visible and light_is_green
     return False
コード例 #7
0
def open_and_basic_check_interactive_menu():
    """Open the My Messages app and make basic checks"""
    stbt.press('KEY_INTERACTIVE')
    sleep(1)
    menu = stbt.wait_until(InteractiveMainMenu)
    assert menu.is_visible, '[Interactive] Main menu is not visible'

    menu_items = menu.menu_items
    for item in menu_items:
        debug('Item text: {0}'.format(item.text))
        debug('Item selected: {0}'.format(item.selected))
    assert len(menu_items) == 9, '[Interactive] Main menu should have 9 items, but has {0}'.format(len(menu_items))
    return menu
コード例 #8
0
    def is_visible(self):
        # pylint: disable=stbt-frame-object-missing-frame
        logo_visible = stbt.match(
            interactive_constants.INTERACTIVE_SKY_LOGO_SD)
        debug('[MY ACCOUNT] Logo visible: {0}'.format(logo_visible))
        if logo_visible:
            title = find_text(self._frame, MA_TITLE_REGION)
            debug('[MY ACCOUNT] Title found: {0}'.format(title))
            title_visible = (title == sky_plus_strings.MY_ACCOUNT)

            background_visible = stbt.match(MA_BACKGROUND,
                                            region=MA_BACKGROUND_REGION)

            return title_visible and background_visible
        return False
コード例 #9
0
def basic_check_mysky():
    """Make basic checks for MySKy"""
    menu = stbt.wait_until(MySkyMainMenu, timeout_secs=MY_SKY_OPEN_TIMEOUT)
    assert menu.is_visible, '[MySky] Main menu is not visible'

    menu_items = menu.menu_items
    for item in menu_items:
        debug('Item text: {0}'.format(item.text))
        debug('Item selected: {0}'.format(item.selected))
    # TODO: Check problems with weather:
    assert len(menu_items) == 3 or len(
        menu_items
    ) == 4, '[MySky] Main menu should have 3 or 4 items, but has {0}'.format(
        len(menu_items))
    return menu
コード例 #10
0
def setup_vcn(vcn):
    """Set fake VCN"""
    itu.clear_test()
    try:
        debug('[SETTING VCN]: {0}'.format(vcn))
        open_developer_mode()
        stbt.press('KEY_UP')
        sleep(5)
        # pylint: disable=unused-variable
        for i in range(0, 9):
            stbt.press('KEY_LEFT')
            sleep(0.1)
        itu.press_digits(vcn)
        sleep(5)
        stbt.press('KEY_DOWN')
        # pylint: disable=stbt-unused-return-value
        stbt.wait_until(SecretSceneMainMenu)
    finally:
        itu.clear_test()
コード例 #11
0
def open_and_check_mysky():
    """Open the MySky app and make some checks"""
    menu = open_and_basic_check_mysky()
    menu_items = menu.menu_items

    item = [
        x for x in menu_items if x.text == sky_plus_strings.MANAGE_YOUR_ACCOUNT
    ][0]
    match_result = match(mysky_constants.MENU_MANAGE_YOUR_ACCOUNT,
                         frame=menu._frame,
                         region=item.region)
    debug('match_result: {0}{1}'.format(match_result.match,
                                        match_result.first_pass_result))
    if sky_plus_utils.IMAGE_DEBUG_MODE:
        cv2.imwrite('matching_menu_{0}.jpg'.format(time.time()),
                    sky_plus_utils.crop_image(menu._frame, item.region))
    assert match_result.match, '[MySky] Could not find {0} menu'.format(
        mysky_constants.MENU_MANAGE_YOUR_ACCOUNT)
    item = [x for x in menu_items
            if x.text == sky_plus_strings.FIX_A_PROBLEM][0]
    match_result = match(mysky_constants.MENU_FIX_A_PROBLEM,
                         frame=menu._frame,
                         region=item.region)
    debug('match_result: {0}{1}'.format(match_result.match,
                                        match_result.first_pass_result))
    assert match_result.match, '[MySky] Could not find {0} menu'.format(
        sky_plus_strings.FIX_A_PROBLEM)

    message = menu.message
    debug('Item message: {0}'.format(message))
    assert message == sky_plus_strings.EXPLORE_MORE, \
        '[MySky] Selected item should be [{0}], but is [{1}]'.format(sky_plus_strings.EXPLORE_MORE, message)

    return menu
コード例 #12
0
    def is_visible(self):
        # pylint: disable=stbt-frame-object-missing-frame
        logo_visible = stbt.match(
            interactive_constants.INTERACTIVE_SKY_LOGO_SD)
        debug('[MY MESSAGES] Logo visible: {0}'.format(logo_visible))
        if logo_visible:
            title = find_text(self._frame, MM_TITLE_REGION)
            debug('[MY MESSAGES] Title found: {0}'.format(title))
            title_visible = (title == sky_plus_strings.MY_MESSAGES)

            subtitle = find_text(self._frame, MM_SUBTITLE_REGION)
            debug('[MY MESSAGES] Subtitle found: {0}'.format(subtitle))
            subtitle_visible = (subtitle == sky_plus_strings.MM_SUBTITLE)

            pin_visible = stbt.match(MM_PIN_ENTRY)

            return title_visible and subtitle_visible and pin_visible
        return False
コード例 #13
0
def test_acceptance_simple_my_account_navigation():
    """Open My Account menu and navigate
    Automates: https://interactiveqa.testrail.net/index.php?/cases/view/26
    """
    itu.clear_test()
    try:
        itu.go_to_channel(interactive_constants.CHANNEL_SKY_ONE_HD)
        menu = mysky_frame_objects.open_and_basic_check_manage_your_account()

        # Navigate menus:
        stbt.press('KEY_DOWN')
        assert stbt.wait_until(lambda: ManageYourAccountMenu().message == sky_plus_strings.PACKAGE_AND_SETTINGS), \
            '[MySky] Selected item is not [{0}]'.format(sky_plus_strings.PACKAGE_AND_SETTINGS)
        stbt.press('KEY_DOWN')
        assert stbt.wait_until(lambda: ManageYourAccountMenu().message == sky_plus_strings.DETAILS_AND_MESSAGES), \
            '[MySky] Selected item is not [{0}]'.format(sky_plus_strings.DETAILS_AND_MESSAGES)
        stbt.press('KEY_DOWN')
        assert stbt.wait_until(lambda: ManageYourAccountMenu().message == sky_plus_strings.EXPLORE_MORE), \
            '[MySky] Selected item is not [{0}]'.format(sky_plus_strings.EXPLORE_MORE)
        stbt.press('KEY_UP')
        assert stbt.wait_until(lambda: ManageYourAccountMenu().message == sky_plus_strings.DETAILS_AND_MESSAGES), \
            '[MySky] Selected item is not [{0}]'.format(sky_plus_strings.DETAILS_AND_MESSAGES)
        stbt.press('KEY_UP')
        assert stbt.wait_until(lambda: ManageYourAccountMenu().message == sky_plus_strings.PACKAGE_AND_SETTINGS), \
            '[MySky] Selected item is not [{0}]'.format(sky_plus_strings.PACKAGE_AND_SETTINGS)
        stbt.press('KEY_UP')
        assert stbt.wait_until(lambda: ManageYourAccountMenu().message == sky_plus_strings.BILLS_AND_PAYMENTS), \
            '[MySky] Selected item is not [{0}]'.format(sky_plus_strings.BILLS_AND_PAYMENTS)

        # Check images:
        menu_items = menu.menu_items
        item = [
            x for x in menu_items
            if x.text == sky_plus_strings.BILLS_AND_PAYMENTS
        ][0]
        match_result = match(MYA_BILLS_PAYMENTS,
                             frame=menu._frame,
                             region=item.region)
        debug('match_result: {0}{1}'.format(match_result.match,
                                            match_result.first_pass_result))
        item = [
            x for x in menu_items
            if x.text == sky_plus_strings.PACKAGE_AND_SETTINGS
        ][0]
        match_result = match(MYA_PACKAGE_SETTINGS,
                             frame=menu._frame,
                             region=item.region)
        debug('match_result: {0}{1}'.format(match_result.match,
                                            match_result.first_pass_result))
        item = [
            x for x in menu_items
            if x.text == sky_plus_strings.DETAILS_AND_MESSAGES
        ][0]
        match_result = match(MYA_DETAILS_MESSAGES,
                             frame=menu._frame,
                             region=item.region)
        debug('match_result: {0}{1}'.format(match_result.match,
                                            match_result.first_pass_result))
        item = [
            x for x in menu_items if x.text == sky_plus_strings.EXPLORE_MORE
        ][0]
        match_result = match(MYA_MY_OFFERS,
                             frame=menu._frame,
                             region=item.region)
        debug('match_result: {0}{1}'.format(match_result.match,
                                            match_result.first_pass_result))
    finally:
        itu.clear_test()