def run(self):
        # Disable Sikuli action and info log
        com = common.General()
        com.infolog_enable(False)
        Settings.MoveMouseDelay = 0

        # Prepare
        app = common.WebApp()
        sample1_file_path = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH,
                                         self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME)
        sample1_file_path = sample1_file_path.replace(
            os.path.splitext(sample1_file_path)[1], '.png')
        capture_width = int(self.INPUT_RECORD_WIDTH)
        capture_height = int(self.INPUT_RECORD_HEIGHT)

        # Launch browser
        my_browser = browser.Firefox()

        # Access link and wait
        my_browser.clickBar()
        my_browser.enterLink(self.INPUT_TEST_TARGET)
        navigation_bar = [
            ['navigation_bar_ff.png', -38, 0],
            ['navigation_bar_ff_win10.png', -10, 0],
        ]
        pattern, obj = app._wait_for_loaded(navigation_bar)

        # Wait for stable
        sleep(2)

        # Customized Region
        customized_region_name = 'end'
        compare_area = self.tuning_region(obj,
                                          x_offset=320,
                                          y_offset=50,
                                          w_offset=150,
                                          h_offset=200)
        self.set_override_region_settings(customized_region_name, compare_area)

        # Record T1, and capture the snapshot image
        # Input Latency Action
        loc, screenshot, t1 = app._il_click("Click Playback Button",
                                            navigation_bar, capture_width,
                                            capture_height)

        # In normal condition, a should appear within 100ms,
        # but if lag happened, that could lead the show up after 100 ms,
        # and that will cause the calculation of AIL much smaller than expected.
        sleep(0.1)

        # Record T2
        t2 = time.time()

        # Write timestamp
        com.updateJson({'t1': t1, 't2': t2}, self.INPUT_TIMESTAMP_FILE_PATH)

        # Write the snapshot image
        shutil.move(screenshot, sample1_file_path)

        app.wait_pattern_for_vanished(pattern)
Beispiel #2
0
    def __init__(self, argv):
        # loading default argv
        self.argv = argv
        self.INPUT_LIB_PATH = argv[1]
        self.INPUT_STAT_FILE = argv[2]

        # Env.getOS() will return one of following object, OS.MAC, OS.LINUX, OS.WINDOWS, and OS.NOT_SUPPORTED.
        self.operating_system = Env.getOS()
        self.operating_system_version = Env.getOSVersion()

        # loading general common object
        self.common = common.General()
        self._web_page = common.WebApp()

        # loading other settings
        self._load_stat_json()
        self._load_addtional_args()