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
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
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
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
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
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
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
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.")