Esempio n. 1
0
def test_tuning_channels_20plus_times():
    for _ in " " * 3: stbt.press('KEY_EXIT')
    if not stbt.wait_until(lambda: stbt.match("images/env/do_you_want_to_upgrade.png")) and not stbt.wait_until(
            lambda: stbt.match("images/env/channel_unavailable.png")):
        assert stbt.wait_until(lambda: stbt.wait_for_motion()), \
            "Live TV not reached at test start"
    channels = [21, 24, 27, 29]
    t = 0
    for _ in range(5):
        for ch in channels:
            t += 1
            for x in list(str(ch)):
                stbt.press("KEY_" + x)
                sleep(0.6)
            sleep(4)
            if stbt.match('images/dvr/continue_to_miniguide.png') and t == 1:
                for _ in " " * 2: stbt.press('KEY_RIGHT')
                for _ in " " * 2: stbt.press('KEY_ENTER')
                stbt.press('KEY_RIGHT')
                stbt.press('KEY_ENTER')
            print (t)
            if not stbt.wait_until(lambda: stbt.match("images/env/do_you_want_to_upgrade.png")) and not stbt.wait_until(
                    lambda: stbt.match("images/env/channel_unavailable.png")):
                assert stbt.wait_until(lambda: stbt.wait_for_motion()), \
                    "New channel " + str(ch) + " not reached on channel change number " + t
Esempio n. 2
0
 def check_image(self,
                 image_to_find,
                 region=None,
                 timeout_secs=configuration.image_check_time_out_secs):
     image_name = image_to_find.split("/")[-1:][0]
     if region is not None:
         img_region = stbt.Region(region["x"],
                                  region["y"],
                                  width=region["width"],
                                  height=region["height"])
         if stbt.wait_until(
                 lambda: stbt.match(image_to_find, region=img_region),
                 timeout_secs=timeout_secs):
             self.LogResults.info(
                 "Image check passed using: {}".format(image_name))
             return True
         else:
             self.LogResults.warning(
                 "Image check failed using: {}".format(image_name))
             return False
     else:
         if stbt.wait_until(lambda: stbt.match(image_to_find),
                            timeout_secs=timeout_secs):
             self.LogResults.info(
                 "Image check passed using: {}".format(image_name))
             return True
         else:
             self.LogResults.warning(
                 "Image check failed using: {}".format(image_name))
             return False
Esempio n. 3
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)
Esempio n. 4
0
def dismissPopupIfPresent(scope={}):
    if popup.PopupBox():
        #TO DO check if it is safe to press OK to dismiss any popup which appears.
        stbt.press("KEY_OK")
    if stbt.wait_until(lambda: not popup.PopupBox()):
        return
    else:
        stbt.press("KEY_OK")
        assert stbt.wait_until(lambda: not popup.PopupBox())
def tune_to_channel(channel_number):
    """This function tunes to channel number (channel_number)"""

    stbt.draw_text('Tune to channel                  : Channel %s', channel_number)

    for digit in str(channel_number):
        stbt.press('KEY_' + digit)
        wait(0.5)

    stbt.wait_until(lambda: ChannelBanner().is_visible, timeout_secs=5)
Esempio n. 6
0
 def cancel(self):
     if self.selection == "CANCEL":
         stbt.press("KEY_ENTER")
     else:
         stbt.press("KEY_RIGHT")
         assert wait_until(
             lambda: ConfirmRentalDialog().selection == "CANCEL"), \
             "Failed to select dialog's CANCEL button"
         stbt.press("KEY_ENTER")
     assert wait_until(lambda: not ConfirmRentalDialog()), \
         "'Confirm Rental' dialog didn't disappear after selecting CANCEL"
Esempio n. 7
0
 def confirm(self):
     if self.selection == "CONFIRM":
         stbt.press("KEY_ENTER")
     else:
         stbt.press("KEY_LEFT")
         assert wait_until(
             lambda: ConfirmRentalDialog().selection == "CONFIRM"), \
             "Failed to select dialog's CONFIRM button"
         stbt.press("KEY_ENTER")
     assert wait_until(lambda: not ConfirmRentalDialog()), \
         "'Confirm Rental' dialog didn't disappear after selecting CONFIRM"
Esempio n. 8
0
def getProgram_Title(scope={}):
    print "Looking for title"
    stbt.press("KEY_INFO")
    stbt.wait_until(lambda: infobanner.Infobanner())
    sleep(2)
    current_selection_text = stbt.ocr(
        region=stbt.Region(x=317, y=633, right=838, bottom=683),
        mode=stbt.OcrMode.SINGLE_LINE,
        lang='nld',
        # tesseract_config={'load_system_dawg':False, 'load_freq_dawg':False},
    )
    return {"programTitle": current_selection_text}
def open_and_basic_check_manage_your_account():
    """Open the Manage your account menu and make basic checks"""
    open_and_basic_check_mysky()

    # Open menu:
    stbt.press('KEY_DOWN')
    assert stbt.wait_until(lambda: MySkyMainMenu().message == sky_plus_strings.MANAGE_YOUR_ACCOUNT), \
        '[MySky] Selected item is not [{0}]'.format(sky_plus_strings.MANAGE_YOUR_ACCOUNT)
    stbt.press('KEY_SELECT')

    menu = stbt.wait_until(ManageYourAccountMenu)
    assert menu.is_visible, '[ManageYourAccount] Menu is not visible'
    return menu
Esempio n. 10
0
def test_get_frame_press_tap_and_swipe(adb):  # pylint:disable=redefined-outer-name
    def match_any(basename):
        f = adb.get_frame()
        return (match("images/galaxy-ace-2/" + basename, f) or
                match("images/moto-x2/" + basename, f))

    adb.press("KEYCODE_HOME")
    m = wait_until(lambda: match_any("app-icon.png"))
    assert m
    adb.tap(m.region)
    assert wait_until(lambda: match_any("app.png"))
    adb.swipe((240, 0), (240, 600))
    assert wait_until(lambda: match_any("settings-icon.png"))
Esempio n. 11
0
def test_get_frame_press_tap_and_swipe(adb):  # pylint:disable=redefined-outer-name
    def match_any(basename):
        f = adb.get_frame()
        return (match("images/galaxy-ace-2/" + basename, f)
                or match("images/moto-x2/" + basename, f))

    adb.press("KEYCODE_HOME")
    m = wait_until(lambda: match_any("app-icon.png"))
    assert m
    adb.tap(m.region)
    assert wait_until(lambda: match_any("app.png"))
    adb.swipe((240, 0), (240, 600))
    assert wait_until(lambda: match_any("settings-icon.png"))
Esempio n. 12
0
def test_play_VOD_50plus_times():
    for _ in " " * 3: stbt.press('KEY_EXIT')
    VideoStore.open()

    # Find an asset that hasn't been rented yet.
    for _ in range(20):  # Try 20 assets

        # Wait for asset title to stabilise -- it loads slightly after the
        # Video Store logo appears.
        title = wait_until(lambda: VideoStore().selection, stable_secs=1)

        print "Checking asset to see if we can rent it: %s" % title
        stbt.press("KEY_ENTER")
        asset = wait_until(Asset, timeout_secs=20)

        if asset.rentable:
            print "Asset is rentable; trying to rent it"
            asset.rent()
            try:
                stbt.wait_for_motion(timeout_secs=30,
                                     mask="images/vod/mask-out-playbar.png")
                print "Successfully rented: %s" % title
                break
            except stbt.MotionTimeout:
                if UnableToPlayDialog():
                    UnableToPlayDialog().dismiss()
                else:
                    assert False, "Didn't detect video playback *nor* " \
                                  "the 'Unable to Play' dialog."

        stbt.press("KEY_LAST")
        assert wait_until(VideoStore), \
            "Didn't detect VideoStore main carousel after pressing back"
        stbt.press("KEY_RIGHT")
        assert wait_until(
            # pylint:disable=cell-var-from-loop
            lambda: VideoStore().selection != title), \
            "Carousel selection didn't change after pressing right"
    else:
        assert False, "Didn't find rentable playable asset after 20 attempts"

    for _ in range(50):
        stbt.press('KEY_EXIT')
        MyLibrary.open().navigate_to("Expiring Soon", title)
        # MyLibrary.open().navigate_to("Expiring Soon")
        stbt.press('KEY_ENTER')
        assert wait_until(lambda: Asset().title == title)
        assert Asset().selected_button.text == "RESTART"
        stbt.press('KEY_ENTER')
        assert stbt.wait_for_motion(timeout_sec=20)
Esempio n. 13
0
def test_20_trickplay_buttons_on_TSB_iguide():
    if stbt.wait_until(lambda: stbt.match("images/dvr/i_pause.png")):
        stbt.press('KEY_PLAY')
    count = 0
    while True:
        if not stbt.wait_until(lambda: stbt.wait_for_motion(timeout_secs=10)):
            stbt.press('KEY_CHANNELUP')
        else:
            break
        count += 1
        assert count < 4, \
            "No motion found on Live after 4 channel changes"
    sleep(2)
    stbt.press('KEY_PAUSE')
    assert stbt.wait_until(lambda: stbt.match("images/dvr/i_pause.png")), \
        "Unable to pause Live"
    sleep(80)
    for _ in range(10):
        stbt.press('KEY_PLAY')
        assert stbt.wait_until(lambda: stbt.match("images/dvr/i_play.png")), \
            "Unable to play Live after pause"
        stbt.press('KEY_REWIND')
        assert stbt.wait_until(lambda: stbt.match("images/dvr/i_rewind.png")), \
            "Unable to rewind Live"
        for _ in " " * 2: stbt.press('KEY_FASTFORWARD')
        assert stbt.wait_until(lambda: stbt.match("images/dvr/i_fastforward.png")), \
            "Unable to fastforward Live"
        stbt.press('KEY_PLAY')
        assert stbt.wait_until(lambda: stbt.match("images/dvr/i_play.png")), \
            "Unable to play Live"
        stbt.press('KEY_PAUSE')
        assert stbt.wait_until(lambda: stbt.match("images/dvr/i_pause.png")), \
            "Unable to pause Live"
Esempio n. 14
0
def add_verification_NBC():
    
    start=getText(176,528,243,553)
    
    sleep(3)
    end=getText(176,528,243,553)
    
    if start.replace('O', '0').split(':',len(start))[1] in end.replace('O', '0').split(':',len(end))[1]:
        infoMessageWith_Screenshots ("Advertisement is playing")
        
        wait_until(lambda: getText(176,528,243,553).replace('O', '0').split(':',len(end))[1] not in end.replace('O', '0').split(':',len(end))[1],
                      timeout_secs=60)
    else:
        infoMessageWith_Screenshots ("Advertisement is not playing")  
Esempio n. 15
0
def test_20_trickplay_buttons_on_TSB():
    for _ in " " * 3: stbt.press('KEY_EXIT')
    if stbt.wait_until(lambda: stbt.match("images/dvr/pause.png")):
        stbt.press('KEY_PLAYPAUSE')
    count = 0
    while True:
        if not stbt.wait_until(lambda: stbt.wait_for_motion(timeout_secs=10)):
            stbt.press('KEY_CHANNELUP')
        else:
            break
        count += 1
        assert count < 4, \
            "No motion found on Live after 4 channel changes"
    sleep(2)
    stbt.press('KEY_PLAYPAUSE')
    assert stbt.wait_until(lambda: stbt.match("images/dvr/pause.png")), \
        "Unable to pause Live"
    sleep(50)
    for _ in range(5):
        stbt.press('KEY_PLAYPAUSE')
        assert stbt.wait_until(lambda: stbt.match("images/dvr/play.png")), \
            "Unable to play Live after pause"
        stbt.press('KEY_LEFT')
        assert stbt.wait_until(lambda: stbt.match("images/dvr/rewind.png")), \
            "Unable to rewind Live"
        for _ in " " * 2: stbt.press('KEY_RIGHT')
        assert stbt.wait_until(lambda: stbt.match("images/dvr/fastforward.png")), \
            "Unable to fastforward Live"
        stbt.press('KEY_PLAYPAUSE')
        assert stbt.wait_until(lambda: stbt.match("images/dvr/play.png")), \
            "Unable to play Live"
        stbt.press('KEY_PLAYPAUSE')
        assert stbt.wait_until(lambda: stbt.match("images/dvr/pause.png")), \
            "Unable to pause Live"
Esempio n. 16
0
def lircd():
    with named_temporary_directory("stbt-lirc-test") as tmpdir:
        socket = os.path.join(tmpdir, "lircd.socket")
        logfile = os.path.join(tmpdir, "lircd.log")
        proc = subprocess.Popen(
            ["lircd", "--nodaemon", "--loglevel=info", "--logfile=/dev/stderr",
             "--driver=file", "--device", logfile,  # lircd output
             "--output", socket,  # lircd reads instructions from here
             "--pidfile=%s/lircd.pid" % tmpdir,
             _find_file("Apple_TV.lircd.conf")])
        wait_until(lambda: (
            os.path.exists(socket) or proc.poll() is not None))

        with scoped_process(proc):
            yield namedtuple("Lircd", "socket logfile")(socket, logfile)
Esempio n. 17
0
 def to_home():
     for _ in range(5):
         stbt.press("KEY_HOME")
         menu = wait_until(Menu, predicate=lambda m: m.selection == "Home")
         if menu:
             return menu
     assert False, "Failed to find Roku Home after pressing KEY_HOME 5 times"
Esempio n. 18
0
def to_roku_home():
    for _ in range(5):
        press("KEY_HOME")
        if wait_until(lambda: find_selection().text == "Home"):
            break
    else:
        assert False, "Failed to find Roku Home after pressing HOME 5 times"
Esempio n. 19
0
def test_that_wait_until_returns_first_stable_value(mock_time):

    def MR(match, x):
        time.sleep(1)  # advance the mock time by 1 second
        return stbt.MatchResult(
            time.time(), match, stbt.Region(x=x, y=0, width=10, height=2),
            first_pass_result=1,
            frame=numpy.random.randint(0, 255, (2, 2, 3)).astype(numpy.uint8),
            image="reference.png")

    def g():
        yield MR(False, x=1)
        yield MR(True, x=2)
        yield MR(True, x=3)
        yield MR(True, x=4)
        yield MR(True, x=4)
        yield MR(True, x=4)
        yield MR(True, x=4)
        yield MR(True, x=4)

    results = g()

    def match():
        return next(results)

    result = wait_until(match, predicate=lambda x: x and x.region,
                        stable_secs=2)
    assert result.match
    assert result.region.x == 4
    assert result.time == 1497000004
Esempio n. 20
0
def to_roku_home():
    for _ in range(5):
        press("KEY_HOME")
        if wait_until(lambda: find_selection().text == "Home"):
            break
    else:
        assert False, "Failed to find Roku Home after pressing HOME 5 times"
Esempio n. 21
0
def test_remote_control():
    """Simple test to see if the remote control is reliable.

    Presses left & right, and checks that each press has the necessary effect
    in the Home menu.
    """

    assert wait_until(lambda: not HomeMenu().is_visible)
    stbt.press("KEY_MENU")
    assert wait_until(lambda: HomeMenu().selection == "televisie")

    for _ in range(10):
        stbt.press("KEY_RIGHT")
        assert wait_until(lambda: HomeMenu().selection == "shop")
        stbt.press("KEY_LEFT")
        assert wait_until(lambda: HomeMenu().selection == "televisie")
Esempio n. 22
0
 def to_home():
     for _ in range(5):
         stbt.press("KEY_HOME")
         menu = wait_until(Menu, predicate=lambda m: m.selection == "Home")
         if menu:
             return menu
     assert False, "Failed to find Roku Home after pressing KEY_HOME 5 times"
Esempio n. 23
0
def test_that_wait_until_returns_first_stable_value(mock_time):
    def MR(match, x):
        time.sleep(1)  # advance the mock time by 1 second
        return stbt.MatchResult(time.time(),
                                match,
                                stbt.Region(x=x, y=0, width=10, height=2),
                                first_pass_result=1,
                                frame=numpy.random.randint(
                                    0, 255, (2, 2, 3)).astype(numpy.uint8),
                                image="reference.png")

    def g():
        yield MR(False, x=1)
        yield MR(True, x=2)
        yield MR(True, x=3)
        yield MR(True, x=4)
        yield MR(True, x=4)
        yield MR(True, x=4)
        yield MR(True, x=4)
        yield MR(True, x=4)

    results = g()

    def match():
        return next(results)

    result = wait_until(match,
                        predicate=lambda x: x and x.region,
                        stable_secs=2)
    assert result.match
    assert result.region.x == 4
    assert result.time == 1497000004
Esempio n. 24
0
def test_DVR_playback_50plus_times_no_TTS():
    # Turn off TTS
    for _ in " " * 3: stbt.press('KEY_EXIT')
    count = 0
    # GNarration_setting("Off")
    for _ in range(51):
        count = 0
        for _ in " " * 3: stbt.press('KEY_EXIT')
        sleep(3)
        stbt.press('KEY_MYDVR')
        sleep(3)
        if stbt.match('images/dvr/cancel_a_recording.png'):
            for _ in " " * 2: stbt.press('KEY_RIGHT')
            for _ in " " * 2: stbt.press('KEY_ENTER')
            stbt.press('KEY_RIGHT')
            stbt.press('KEY_ENTER')
        assert stbt.wait_until(lambda: stbt.match("images/dvr/my_dvr.png")), \
            "MyDVR not launched"
        while True:
            stbt.press('KEY_ENTER')
            sleep(1)
            if stbt.match('images/cta/watch.png') or stbt.match('images/cta/resume.png'): break
            count += 1
            assert count < 20, \
                "Could not find recording to play in DVR page"
        sleep(2)
        stbt.press('KEY_ENTER')
        sleep(3)
        assert stbt.wait_for_motion(timeout_secs=20)
Esempio n. 25
0
def test_DVR_on_reboot():
    count = 0
    while True:
        if stbt.is_screen_black(): break
        count += 1
        sleep(3)
        assert count < 10, \
        "STB did not reboot within 30 seconds with osdiag RebootNow"
    count = 0
    while True:
        stbt.press('KEY_POWER')
        sleep(5)
        if stbt.match('images/menu/stick_around.png') or stbt.match(
                'images/menu/reboot_logo.png'):
            break
        sleep(5)
        count += 1
        assert count < 18, \
        "Stick Around screen is not shown after reboot within 3 minutes"
    stbt.wait_for_motion(timeout_secs=300)
    stbt.press('KEY_RECORD')
    assert stbt.wait_until(lambda: stbt.match("images/dvr/edit_ep_rec.png") or stbt.match("images/dvr/ch_bar_rec.png")), \
    "RECORD press on live TV did not set recording, or prompt for edit recording"
    mydvr_launch()
    count = 0
    while True:
        stbt.press('KEY_ENTER')
        if stbt.match('images/cta/watch.png'): break
        count += 1
        assert count < 16, \
        "Could not find recording to play in DVR page"
    stbt.press('KEY_ENTER')
    assert stbt.wait_for_motion(timeout_secs=20)
Esempio n. 26
0
def miniguide_launch():
    stbt.press('KEY_EXIT')
    stbt.press('KEY_ENTER')
    time.sleep(1.2)
    stbt.press('KEY_ENTER')
    assert stbt.wait_until(lambda: stbt.match("images/miniguide/miniguide.png")), \
    "Miniguide not launched"
Esempio n. 27
0
def movies_launch():
    menu_launch()
    stbt.press('KEY_CHANNELUP')
    for _ in " " * 4:
        stbt.press('KEY_DOWN')
    stbt.press('KEY_ENTER')
    assert stbt.wait_until(lambda: stbt.match("images/vod/movies_logo.png")), \
    "Movies not launched"
Esempio n. 28
0
def tv_shows_launch():
    menu_launch()
    stbt.press('KEY_CHANNELUP')
    for _ in " " * 3:
        stbt.press('KEY_DOWN')
    stbt.press('KEY_ENTER')
    assert stbt.wait_until(lambda: stbt.match("images/vod/tv_shows_logo.png")), \
    "TV Shows not launched"
Esempio n. 29
0
def my_library_launch():
    menu_launch()
    stbt.press('KEY_CHANNELUP')
    for _ in " " * 2:
        stbt.press('KEY_DOWN')
    stbt.press('KEY_ENTER')
    assert stbt.wait_until(lambda: stbt.match("images/vod/my_library_header.png")), \
    "My Library not launched"
Esempio n. 30
0
def video_store_launch():
    menu_launch()
    stbt.press('KEY_CHANNELUP')
    for _ in " " * 5:
        stbt.press('KEY_DOWN')
    stbt.press('KEY_ENTER')
    assert stbt.wait_until(lambda: stbt.match("images/vod/video_store_logo.png")), \
    "Video Store not launched"
def wait_until_channel_banner_dismissed():
    """This function will wait until the channel banneris dismissed.
         Assert if the channel banner is still visible after the <CHANNEL_BANNER_TIMEOUT> timeout value.
    """

    assert stbt.wait_until(lambda: not ChannelBanner().is_visible,
                           timeout=profile["CHANNEL_BANNER_TIMEOUT"]), stbt.draw_text(
        'Channel banner                  : Visible - NOK')
Esempio n. 32
0
def health_check(validate=True, scope=""):
    stbt.press("KEY_TV")
    dismissPopupIfPresent()
    stbt.press("KEY_INFO")
    if stbt.wait_until(lambda: infobanner.Infobanner()):
        print "Box is Up and responds to key presses"
        try:
            stbt.wait_for_motion()
            print "Video playback is present in Live TV"
            return {"status": True}
        except stbt.MotionTimeout:
            print "up key pressed"
            stbt.press("KEY_CHANNELUP")
            try:
                stbt.wait_for_motion()
                print "Video playback is present in Live TV"
                return {"status": True}
            except stbt.MotionTimeout:
                assert False, "Could not detect Video playback in Live TV"
    else:
        # TO DO else: <do one more IR event check>
        # if stbt.is_screen_black():
        stbt.press("KEY_MENU")
        if stbt.wait_until(lambda: not stbt.is_screen_black()):
            if stbt.wait_until(lambda: mainhub_page.MainHubPage()):
                sleep(1)
                print "Box is Up and responds to key presses"
                stbt.press("KEY_OK")
                if stbt.wait_until(lambda: not mainhub_page.MainHubPage()):
                    print "Dismissed Main Hub and tuned to live TV"
                else:
                    assert False, "Failed to tune to Live TV by OK press on Televisie from Main Hub"
                try:
                    stbt.wait_for_motion()
                    print "Video playback is present in Live TV"
                    return {"status": True}
                except stbt.MotionTimeout:
                    assert False, "Could not detect Video playback in Live TV"
            else:
                assert False, "Main_hub did not load. Health check failed"
        else:
            stbt.press("KEY_POWER")
            if stbt.wait_until(lambda: not stbt.is_screen_black(),
                               timeout_secs=30):
                if stbt.wait_until(lambda: mainhub_page.MainHubPage()):
                    sleep(1)
                    print "Box is Up and responds to key presses"
                    stbt.press("KEY_OK")
                    if stbt.wait_until(lambda: not mainhub_page.MainHubPage()):
                        print "Dismissed Main Hub and tuned to live TV"
                    else:
                        assert False, "Failed to tune to Live TV by OK press on Televisie from Main Hub"
                    try:
                        stbt.wait_for_motion()
                        print "Video playback is present in Live TV"
                        return {"status": True}
                    except stbt.MotionTimeout:
                        assert False, "Could not detect Video playback in Live TV"
            else:
                assert False, "TV frozen with black screen"
Esempio n. 33
0
def test_entering_the_settings_menu():
    to_roku_home()

    for _ in range(5):
        press("KEY_DOWN")
        if wait_until(lambda: find_selection().text == "Settings",
                      timeout_secs=2):
            break
    else:
        assert False, "Failed to find 'Settings' menu item"

    press("KEY_OK")
    assert wait_until(lambda: find_selection().text == "Network"), \
        "Failed to find 'Network' settings sub-menu"

    press("KEY_BACK")
    assert wait_until(lambda: find_selection().text == "Settings"), \
        "Pressing BACK didn't take me back to 'Settings' menu item"
Esempio n. 34
0
def test_entering_the_settings_menu():
    to_roku_home()

    for _ in range(5):
        press("KEY_DOWN")
        if wait_until(lambda: find_selection().text == "Settings",
                      timeout_secs=2):
            break
    else:
        assert False, "Failed to find 'Settings' menu item"

    press("KEY_OK")
    assert wait_until(lambda: find_selection().text == "Network"), \
        "Failed to find 'Network' settings sub-menu"

    press("KEY_BACK")
    assert wait_until(lambda: find_selection().text == "Settings"), \
        "Pressing BACK didn't take me back to 'Settings' menu item"
Esempio n. 35
0
def test_mydvr_launch():
    f = open("testFile.txt", "w+")
    stbt.press('KEY_EXIT')
    f.write("Step 1: press exit: Passed\n")
    stbt.press('KEY_MYDVR')
    f.write("Step 2: press MyDVR: Passed\n")
    f.close()
    assert stbt.wait_until(lambda: stbt.match("images/dvr/my_dvr.png")), \
    "MyDVR not launched"
Esempio n. 36
0
def test_that_wait_until_doesnt_compare_return_values(mock_time):
    class MR(object):
        def __init__(self, eq_allowed=False):
            time.sleep(1)  # advance the mock time by 1 second
            self.eq_allowed = eq_allowed

        def __eq__(self, other):
            if self.eq_allowed:
                return isinstance(other, MR)
            else:
                assert False, "Got unexpected call to MR.__eq__"

        def __ne__(self, other):
            return not self.__eq__(other)

    result = wait_until(MR)
    assert isinstance(result, MR)

    # But it does compare values if you specify `stable_secs`
    with pytest.raises(AssertionError):
        result = wait_until(MR, stable_secs=2)
Esempio n. 37
0
def test_that_screensaver_appears_if_i_do_nothing():
    to_roku_home()
    assert wait_until(lambda: match("images/roku-screensaver.png"),
                      timeout_secs=2 * 60)
Esempio n. 38
0
def test_that_roku_home_shows_netflix_player():
    to_roku_home()
    assert wait_until(lambda: match("images/netflix-tile.png"))
def test_that_roku_home_says_streaming_channels():
    stbt.press('KEY_HOME')
    assert stbt.wait_until(lambda: stbt.match_text("Streaming Channels"))
Esempio n. 40
0
def test_wait_until(mock_time, f, kwargs, expected):
    assert wait_until(f, **kwargs) == expected
Esempio n. 41
0
def test_that_wait_until_times_out(mock_time):
    assert not wait_until(Zero, interval_secs=1)
    assert time.time() == 1497000010