def run(self): # Disable Sikuli action and info log self.common.infolog_enable(False) Settings.MoveMouseDelay = 0 # Prepare app = gmail.gMail() 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) app.wait_for_loaded() # Wait for stable sleep(2) # PRE ACTIONS app.click_first_mail() sleep(2) app.click_reply_btn() sleep(2) # Customized Region customized_region_name = 'end' _, reply_btn_region = app.wait_for_component_display(app.GMAIL_TYPE_FOR_REPLY, similarity=0.8) type_area = self.tuning_region(reply_btn_region, x_offset=13, h_offset=50) self.set_override_region_settings(customized_region_name, type_area) sleep(2) # Record T1, and capture the snapshot image # Input Latency Action screenshot, t1 = app.il_type('a', capture_width, capture_height, wait_component=(app.GMAIL_TYPE_FOR_REPLY + app.GMAIL_SEND)) # 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() # POST ACTIONS sleep(2) app.click_reply_del_btn() # Write timestamp self.common.updateJson({'t1': t1, 't2': t2}, self.INPUT_TIMESTAMP_FILE_PATH) # Write the snapshot image shutil.move(screenshot, sample1_file_path)
def run(self): # Disable Sikuli action and info log self.common.infolog_enable(False) Settings.MoveMouseDelay = 0 delay = self.common.find_key_type_delay() # Prepare app = gmail.gMail() sample1_fp = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH, self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME) sample2_fp = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH, self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME.replace('sample_1', 'sample_2')) 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) app.wait_for_loaded() # Wait for stable sleep(2) # PRE ACTIONS app.click_first_mail() sleep(2) app.click_reply_btn() sleep(2) # Customized Region customized_region_name_start = 'start' customized_region_name_end = 'end' # part region of search suggestion list _, reply_btn_region = app.wait_for_component_display(app.GMAIL_TYPE_FOR_REPLY, similarity=0.8) compare_area = self.tuning_region(reply_btn_region, x_offset=-10, y_offset=30, w_offset=650, h_offset=15) self.set_override_region_settings(customized_region_name_start, compare_area) self.set_override_region_settings(customized_region_name_end, compare_area) t1 = time.time() capimg1 = capture(0, 0, capture_width, capture_height) char_str = "orempsumdorstametconsecteturadpscngetsedoeusmodtem\nporncduntutaboretdoremagnaquatenmadmnvenamqusnoex" self.common.system_print('Type char') self.common.delayed_type(char_str, 0.1, delay) sleep(1) t2 = time.time() capimg2 = capture(0, 0, capture_width, capture_height) self.common.updateJson({'t1': t1, 't2': t2}, self.INPUT_TIMESTAMP_FILE_PATH) shutil.move(capimg1, sample1_fp.replace(os.path.splitext(sample1_fp)[1], '.png')) shutil.move(capimg2, sample2_fp.replace(os.path.splitext(sample1_fp)[1], '.png')) # POST ACTIONS sleep(2) app.click_reply_del_btn()
def run(self): # Disable Sikuli action and info log com = common.General() com.infolog_enable(False) Settings.MoveMouseDelay = 0 # Prepare app = gmail.gMail() 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.Chrome() # Access link and wait my_browser.clickBar() my_browser.enterLink(self.INPUT_TEST_TARGET) app.wait_for_loaded() # Wait for stable sleep(5) # PRE ACTIONS # Record T1, and capture the snapshot image # Input Latency Action t1 = time.time() screenshot = capture(0, 0, capture_width, capture_height) com.system_print('[log] TYPE "c"') type('c') # 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)