def _start_scan(self, timeout=180):
        """ Start and execute scan
        1. Go throught initial scan wizard without verification till screen
        where "Start scan" is possible.
        2. Start scan
        3. Verifay that scan is started.
        4. Wait during timeout that scan is finnished.

        Args:
            timeout -- timeout of scan result waiting in sec
            
        Returns: True scan is executed, False is scan is not executed as expectd by
        any reason
        """
        result, status = wait_for(INTERACTIVE_DCM_SCAN_WIZARD.SCAN, 5, 1)
        if result:
            println("VERIFICATION PASSED: Scan is in progress.")

        else:
            println("VERIFICATION FAILED: Scan is not started in 5 seconds.")
            return False

        println("Wait for scan result screen.")

        result, status = wait_for(INTERACTIVE_DCM_SCAN_WIZARD.SCAN_RESULT,
                                  timeout, 5)
        if result:
            println("VERIFICATION PASSED: Scan is executed.")
            return result and True
        else:
            println(("VERIFICATION FAILED: Scan is not finished during {} "
                     "sec.\n \t - UI sate is {}").format(timeout, status))
            return result and False
示例#2
0
    def _scan_interpritator(self, settings):
        """ Scan interpritator

        [
            {INITIAL_SCAN_WIZARD.LOCATION : [
                { 'check': "Germany"}, 
            ]},
            {INITIAL_SCAN_WIZARD.DVBC_NETWORKS : [
                { 'select': (NETWORKS_GERMANY_DVBC, 'Unitymedia')},
                { 'press': ["OK"]},
                { 'check': INITIAL_SCAN_WIZARD.START_SCAN},
                { 'press': ["OK"]},
                { 'check': INITIAL_SCAN_WIZARD.START_SCAN},
            ]}
        ]

        Raises: ValueError if unable to get response.
        """

        key_function = {
            'select': self.__select,
            'press': self.__navigate,
            'check': self.__check
        }
        println("DEBUG: Start SCAN Interpretator")
        for item in settings:
            for screen, actions in item.items():
                if not self._go_through_wizard(screen):
                    raise ValueError("Expected wizard screen is not found")
                for act in actions:
                    for finction, settings in act.items():
                        result = key_function[finction](settings)
        println("DEBUG: Return result {}".format(result))
        return result
示例#3
0
 def _reset_to_initial_state(self):
     result = open_main_menu()
     if not result:
         println(
             "#ERROR: Initial state is not reached. Test will be terminated.\n"
         )
         finish_test()
     return result
示例#4
0
 def _print_test_decription(self):
     println(
         "Test description:\n"
         "1. Set TV into stand-by mode.\n"
         "2. Wait for automatic channel update in stand-by mode.\n"
         "3. Wait for TV waking up"
         "4. Verify new found TV and Radio services according to test scenario.\n"
         "6. Close of wizard.\n")
示例#5
0
    def _set_settings(self, settings):
        try:
            self._scan_interpritator(settings)
        except ValueError as e:
            println('#ERROR: {}.\nTest will be terminated.'.format(e))
            self._finish_scan()
            return False

        return True
示例#6
0
    def _close_scan_wizard(self):
        while not check_all_wizard_closed():
            if not (send_key_with_verification("EXIT")
                    or send_key_with_verification("FWD")):
                println("TV does not react on key pressing")
                return False

        println("All wizards are closed")
        return True
示例#7
0
    def _scan_preparation(self):
        result = self._open_scan_wizard()

        if not result:
            println('#ERROR: Expected wizard is NOT opened.')
            self._reset_to_initial_state()
            finish_test()

        return result
 def _open_scan_wizard(self):
     println("\nWait for Interactive DCM request.")
     result, status = wait_for("Immediately", 2, 2)
     if result:
         selected, status = select_on_screen(DCM_OPTIONS, "Immediately")
         if selected:
             send_key("OK")
             return True
     else:
         print("DEBUG: Open Scan Wizard Failed")
         return False
示例#9
0
 def _print_test_decription(self):
     println((
         "Test description:\n"
         "1. Go to intial state (Dashboard is opend, focuse is on main menu).\n"
         "Test will be terminated if one of wizards is open.\n"
         "2. Open auto scan wizard.\n"
         "3. Go thought auto scan wizard according to test scenario.\n"
         "Test will be terminated if one of required verification is failed.\n"
         "4. Start scan and wait end of scan (10 min timout is set).\n"
         "5. Go thought auto scan wizard according to test scenario.\n"
         "Test will be terminated if one of required verification is failed.\n"
         "6. Close of wizard.\n"))
示例#10
0
 def _open_scan_wizard(self):
     println("\nWait for CAM scan request.")
     result, status = wait_for("Immediately", 2, 2)
     print(FRONTEND.SEARCH_CAM_SCREEN)
     if result:
         selected, status = select_on_screen(DCM_OPTIONS, "Immediately")
         if selected:
             send_key("OK")
             return True
     else:
         print("DEBUG: Open Scan Wizard Failed")
         return False
示例#11
0
 def _print_test_decription(self):
     println(
         "Test description:\n"
         "1. Go to intial state (Dashboard is opened, focus is on main menu).\n"
         "Test will be terminated if one of wizards is open.\n"
         "2. Start Cam emulator and initialize connect by TV\n"
         "3. Scan request should be displayed.\n"
         "4. Select immediately to execute operator profile scan.\n"
         "3. Go through scan wizard according to test scenario.\n"
         "Test will be terminated if one of required verification is failed.\n"
         "4. Start scan and wait end of scan (10 min timout is set).\n"
         "6. Close of wizard.\n")
示例#12
0
 def _print_test_decription(self):
     println(
         "Test description:\n"
         "1. Go to intial state (Dashboard is opened, focus is on main menu).\n"
         "Test will be terminated if one of wizards is open.\n"
         "2. Wait for Interactive DCM request\n"
         "3. DCM request should be displayed.\n"
         "4. Select immediately to execute scan.\n"
         "3. Go through scan wizard according to test scenario.\n"
         "Test will be terminated if one of required verification is failed.\n"
         "4. Start scan and wait end of scan (5 min timout is set).\n"
         "6. Close of wizard.\n")
示例#13
0
 def _set_presettings(self, settings):
     println("\nSet scan settings.")
     self._go_through_wizard(AUTO_SCAN_WIZARD.FIRST_SCREEN)
     result, status = select_on_screen(START_AUTO_SCAN,
                                       'Change search settings')
     send_key("OK")
     result, status = wait_for(AUTO_SCAN_WIZARD.SIGNAL_SOURCE, 5, 1)
     if result:
         return self._set_settings(settings)
     else:
         println("VERIFICATION FAILED: Scan settings cannot be set.")
         self._close_scan_wizard()
         return False
示例#14
0
    def _start_scan(self, timeout=180):
        """ Start and execute scan
        1. Go throught initial scan wizard without verification till screen
        where "Start scan" is possible.
        2. Start scan
        3. Verifay that scan is started.
        4. Wait during timeout that scan is finnished.

        Args:
            timeout -- timeout of scan result waiting in sec
            
        Returns: True scan is executed, False is scan is not executed as expectd by
        any reason
        """
        self._go_through_wizard(AUTO_SCAN_WIZARD.FIRST_SCREEN)
        result, status = select_on_screen(START_AUTO_SCAN,
                                          'Start search/update')
        if not result:
            println("VERIFICATION FAILED: Auto scan cannot be started.")
            return False
        send_key("OK")

        result, status = wait_for(AUTO_SCAN_WIZARD.SCAN, 10, 2)
        if result:
            result = True
            println("VERIFICATION PASSED: Auto scan is started.")
        else:
            result = False
            println(("VERIFICATION FAILED: Auto scan is not started during "
                     "10sec.\n \t - UI sate is {}").format(status))
        result, status = wait_for(AUTO_SCAN_WIZARD.SCAN_RESULT, timeout, 2)
        if result:
            println("VERIFICATION PASSED: Scan is executed.")
            return result and True
        else:
            println(("VERIFICATION FAILED: Scan is not finished during {} "
                     "sec.\n \t - UI sate is {}").format(timeout, status))
            return result and False
示例#15
0
    def __select(self, item):
        """ Privat function for scan_interpritator
        Select item on screen and print pretty log

        Raises: ValueError if unable to get response. 
        """
        result, status = select_on_screen(item[0], item[1])
        if result:
            println("VERIFICATION PASSED: Requested element '{}' is selected".
                    format(item[1]))
        else:
            println(
                "#VERIFICATION FAILED: Requested element '{}' is NOT selected".
                format(item[1]))
            println("INFO: UI status - {}".format(status))
            println("Test will be terminated.")
            raise ValueError("Expected element cannot be selected.")
示例#16
0
    def __check(self, element):
        """ Privat function for scan_interpritator
        Check if mentioned element is present is UI status

        Raises: ValueError if unable to get response.
        """

        println("START CHEKING")
        result, status = wait_for(element, 1, 1)
        if result:
            println(
                "VERIFICATION PASSED: Requested element '{}' is present in UI".
                format(element))
        else:
            println(
                "#VERIFICATION FAILED: Requested element '{}' is NOT present in UI"
                .format(element))
            print("INFO: UI status - {}".format(status))
            println("Test will be terminated.")
            raise ValueError("Expected element is not found.")
示例#17
0
    def _close_scan_wizard(self):
        """ Close auto scan wizard in fastest way.


        Returns: True if wizard is closed/ False otherwise
        """
        forward = True
        println("\nClose auto scan wizard")
        initial_status = get_status()
        while forward:
            current_status = get_status()
            if AUTO_SCAN_WIZARD.FIRST_SCREEN in current_status:
                forward = False
                #one 'exit' is workaround to close additional messages
                send_key("EXIT")
                time.sleep(2)
                send_key("EXIT")
                time.sleep(2)
            elif AUTO_SCAN_WIZARD.SCAN in current_status:
                forward = False
                #one 'exit' is workaround to close additional messages
                send_key("EXIT")
                time.sleep(2)
                send_key("EXIT")
                time.sleep(2)
                send_key("EXIT")
                time.sleep(2)
            else:
                if not send_key_with_verification('FWD'):
                    println("#ERROR: TV doesn't react on key >>.")
                    forward = False
                elif get_status() == initial_status:
                    println("#ERROR: UI is cycled.")
                    forward = False

        if not check_all_wizard_closed():
            println("#VERIFICATION FAILED: wizard is not closed")
            return False
        else:
            return True
示例#18
0
 def _print_test_decription(self):
     println("NO DESCRIPTION IS AVAILABLE.")
     return True
示例#19
0
    def _close_scan_wizard(self):
        """ Close initial scan wizard in fastest way.
        Intial scan wizard can be closed in different way:
        1. Cancel scan
        2. Close wizard from scan result screen
        3. Close wizard from network configuration screen
        4. Close wizard from software update screen
        If current screen is not a screen where wizard can be closed, then >>
        will be pressed.
        Reset_to_initial_state() will be called if wizard is not closed from firts attempt,
        if wizard id cycled, if tV doesn't react on key pressing.

            
        Returns: True if wizard is closed/ False otherwise
        """
        forward = True
        println("\nClose initial scan wizard")
        initial_status = get_status()
        println("DEBUG: PRINTING GET STATUS %s" % initial_status)
        while forward:
            current_status = get_status()
            if INITIAL_SCAN_WIZARD.LICENCE in current_status:
                println("INFO: Licence agreement is displayed.")
                send_key_with_verification('OK')
            elif INITIAL_SCAN_WIZARD.NETWORK_CONFIGURATION in current_status:
                forward = False
                selected, status = select_on_screen(
                    NETWORK_CONFIGURATION,
                    'Do not configure or configure later')
                if selected:
                    send_key("OK")
                    time.sleep(2)
                    send_key("EXIT")
                    time.sleep(2)
                    send_key("EXIT")
                    time.sleep(2)
                else:
                    println(("#ERROR: Initial scan wizard cannot be closed "
                             "from '{}' screen.").format(
                                 INITIAL_SCAN_WIZARD.NETWORK_CONFIGURATION))
                    println("INFO: UI status - {}".format(status))
            elif INITIAL_SCAN_WIZARD.START_SCAN in current_status:
                forward = False
                selected, status = select_on_screen(START_SCAN, 'Cancel')
                if selected:
                    send_key("OK")
                    time.sleep(2)
                    send_key("EXIT")
                    time.sleep(2)
                    send_key("EXIT")
                    time.sleep(2)
                else:
                    println(("#ERROR: Initial scan wizard cannot be closed "
                             "from '{}' screen.").format(
                                 INITIAL_SCAN_WIZARD.START_SCAN))
                    print("INFO: UI status - {}".format(status))
                    open_main_menu()
            elif INITIAL_SCAN_WIZARD.SCAN_RESULT in current_status:
                forward = False
                println("DEBUG: BEFORE GET STATUS")
                send_key("EXIT")
                time.sleep(2)
                send_key("EXIT")
                time.sleep(2)
            elif INITIAL_SCAN_WIZARD.INFORM_ABOUT_NEW_SOFTWARE in current_status:
                forward = False
                send_key("EXIT")
                time.sleep(2)
                #workaround: additional pressing 'back' to close any message if displayed
                send_key("EXIT")
                time.sleep(2)
            else:
                if not send_key_with_verification('FWD'):
                    println("#ERROR: TV doesn't react on key >>.")
                    forward = False
                elif get_status() == initial_status:
                    println("#ERROR: UI is cycled.")
                    forward = False

        println("DEBUG: AFTER GET_STATUS")
        result = check_all_wizard_closed()
        println("DEBUG: RESULT IS {}".format(result))
        if not result:
            println("#VERIFICATION FAILED: wizard is not closed")
            return False
        else:
            return True
示例#20
0
 def __navigate(self, sequence=[]):
     """ Privat function for scan_interpritator
     Press any sequancy of keys. 
     """
     println("Start Navigate")
     navigate_and_status(sequence)
示例#21
0
 def _open_scan_wizard(self):
     println("No actions are required to open scan wizard.")
     return True
示例#22
0
 def _open_scan_wizard(self):
     println("\nOpen intial scan wizard.")
     return open_wizard([
         MAIN_MENU.SYSTEM_SETTINGS, SYSTEM_SETTINGS_MENU.EXTRAS,
         EXTRAS_MENU.INITIAL_SCAN
     ], INITIAL_SCAN_WIZARD.FIRST_SCREEN)
示例#23
0
    def _close_scan_wizard(self):
        """ Close initial scan wizard in fastest way.
        Intial scan wizard can be closed in different way:
        1. Cancel scan
        2. Close wizard from scan result screen
        3. Close wizard from network configuration screen
        4. Close wizard from software update screen
        If current screen is not a screen where wizard can be closed, then >>
        will be pressed.
        Reset_to_initial_state() will be called if wizard is not closed from firts attempt,
        if wizard id cycled, if tV doesn't react on key pressing.

            
        Returns: True if wizard is closed/ False otherwise
        """
        forward = True
        println("\nClose cam scan wizard")
        initial_status = get_status()
        while forward:
            current_status = get_status()
            if CAM_SCAN_WIZARD.SCAN_RESULT in current_status:
                time.sleep(2)
                send_key("EXIT")
                time.sleep(2)
                send_key("EXIT")
                time.sleep(2)
                forward = False
            elif CAM_SCAN_WIZARD.STATIONS_SORTING in current_status:
                result, status = wait_for(CAM_SCAN_WIZARD.SCAN_RESULT, 30, 5)
                if result:
                    time.sleep(2)
                    send_key("EXIT")
                    time.sleep(2)
                    send_key("EXIT")
                    time.sleep(2)
                    forward = False
                else:
                    println(
                        "VERIFICATION FAILED: Scan is not finished during 30sec."
                    )
                    return False
            else:
                if not send_key_with_verification('FWD'):
                    println("#ERROR: TV doesn't react on key >>.")
                    forward = False
                elif get_status() == initial_status:
                    println("#ERROR: UI is cycled.")
                    forward = False

        result = check_all_wizard_closed()
        println("DEBUG: RESULT IS {}".format(result))
        if not result:
            println("#VERIFICATION FAILED: wizard is not closed")
            return False
        else:
            return True
示例#24
0
 def _reset_to_initial_state(self):
     println("Start interactive_dcm initial state")
     return True
示例#25
0
 def _open_scan_wizard(self):
     println("\nOpen auto scan wizard.")
     return open_wizard([
         MAIN_MENU.SYSTEM_SETTINGS, SYSTEM_SETTINGS_MENU.STATIONS_MENU,
         STATIONS_MENU.AUTO_SCAN
     ], AUTO_SCAN_WIZARD.FIRST_SCREEN)
示例#26
0
 def _reset_to_initial_state(self):
     println("Start cam_dcm initial state")
     return True
示例#27
0
 def _start_scan(self):
     println("No acctions are required to start scan.")
     return True
示例#28
0
 def _go_through_wizard(self, screen):
     println("Start _go_through_wizard functions")
     return go_to(screen, ['FWD'], 20)
示例#29
0
 def _set_postsettings(self, settings):
     println("\nSet post scan settings.")
     return self._set_settings(settings)
示例#30
0
    def _go_through_wizard(self, item):
        """ Go throught initial scan wizard without verification.
        On License screen "OK" will be send, for all other screens
        FWD will be used to go to next screen

        Args:
            item -- UI there passing should be stopped
            
        Returns: True if requested screen id opened, False if screen is not opened
        """
        start_result, status = wait_for(item, 1, 1)
        if not start_result:
            println("Go to screen, that contais '{}' text.".format(item))
            while not item in status:
                if INITIAL_SCAN_WIZARD.LICENCE in status:
                    println("INFO: Licence aggrement is displayed.")
                    send_key_with_verification('OK')
                    result, status = wait_for(item, 1, 1)
                elif INITIAL_SCAN_WIZARD.PARENTAL_LOCK in status:
                    println("INFO: Parental Lock is displayed.")
                    println("Set PIN 1234.")
                    navigate_and_status(["KEY-1", "KEY-2", "KEY-3", "KEY-4"])
                else:
                    if send_key_with_verification('FWD'):
                        result, status = wait_for(item, 1, 1)
                        if status == start_result:
                            println(
                                "#ERROR: No item {} in initial scan wizard.".
                                format(item))
                            return False
                    else:
                        println("#ERROR: TV doesn't react on key >>.")
                        return False
        println(
            "VERIFICATION PASSED: Requested scren {} is opened.".format(item))
        return True