def run(self): # Disable Sikuli action and info log com = common.General() com.infolog_enable(0) ff = browser.Firefox() gd = gdoc.gDoc() ff.clickBar() ff.enterLink(self.INPUT_TEST_TARGET) gd.wait_for_loaded() setAutoWaitTimeout(10) sample1_fp = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH, self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME) sleep(2) capture_width = int(self.INPUT_RECORD_WIDTH) capture_height = int(self.INPUT_RECORD_HEIGHT) t1 = time.time() capimg2 = capture(0, 0, capture_width, capture_height) com.system_print('[log] TYPE "#PDOWN."') type(Key.PAGE_DOWN) sleep(1) t2 = time.time() com.updateJson({'t1': t1, 't2': t2}, self.INPUT_TIMESTAMP_FILE_PATH) shutil.move( capimg2, sample1_fp.replace(os.path.splitext(sample1_fp)[1], '.png'))
def run(self): com = common.General() chrome = browser.Chrome() gd = gdoc.gDoc() chrome.clickBar() chrome.enterLink(self.INPUT_TEST_TARGET) sleep(5) gd.wait_for_loaded() setAutoWaitTimeout(10) 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')) sleep(2) capture_width = int(self.INPUT_RECORD_WIDTH) capture_height = int(self.INPUT_RECORD_HEIGHT) t1 = time.time() capimg1 = capture(0, 0, capture_width, capture_height) gd.move_to_highlight_scroll(gd.input_wheel_down_direction, 1) sleep(1) t2 = time.time() capimg2 = capture(0, 0, capture_width, capture_height) com.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'))
def run(self): # Disable Sikuli action and info log com = common.General() com.infolog_enable(0) chrome = browser.Chrome() gd = gdoc.gDoc() chrome.clickBar() chrome.enterLink(self.INPUT_TEST_TARGET) gd.wait_for_loaded() setAutoWaitTimeout(10) sample1_fp = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH, self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME) sleep(2) capture_width = int(self.INPUT_RECORD_WIDTH) capture_height = int(self.INPUT_RECORD_HEIGHT) t1 = time.time() capimg2 = capture(0, 0, capture_width, capture_height) com.system_print('[log] TYPE "a"') type('a') # 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) t2 = time.time() com.updateJson({'t1': t1, 't2': t2}, self.INPUT_TIMESTAMP_FILE_PATH) shutil.move(capimg2, sample1_fp.replace(os.path.splitext(sample1_fp)[1], '.png'))
def run(self): # Disable Sikuli action and info log ff = browser.Firefox() gd = gdoc.gDoc() ff.clickBar() ff.enterLink(self.INPUT_TEST_TARGET) sleep(5) gd.wait_for_loaded() gd.deFoucsContentWindow()
def run(self): com = common.General() chrome = browser.Chrome() gd = gdoc.gDoc() chrome.clickBar() chrome.enterLink(self.INPUT_TEST_TARGET) sleep(5) gd.wait_for_loaded() setAutoWaitTimeout(10) 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')) os.remove(sample1_fp) sleep(2) capture_width = int(self.INPUT_RECORD_WIDTH) capture_height = int(self.INPUT_RECORD_HEIGHT) t1 = time.time() capimg1 = capture(0, 0, capture_width, capture_height) wheel( Pattern("pics/doc_content_left_top_page_region.png").similar(0.85), WHEEL_DOWN, 100) sleep(0.2) t2 = time.time() capimg2 = capture(0, 0, capture_width, capture_height) com.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'))
sys.path.append(sys.argv[2]) import browser import common import gdoc com = common.General() chrome = browser.Chrome() gd = gdoc.gDoc() chrome.clickBar() chrome.enterLink(sys.argv[3]) gd.wait_for_loaded() wait(Pattern("EditDropdown.png").similar(0.50)) wait(5) keyword = "OLD" gd.page_text_generate(keyword, 1) sleep(5) gd.wait_for_loaded() gd.insert_image_url("https://drive.google.com/file/d/0B9Zi9TqbRWsdM0owSVlmbkRpUFE/view?usp=sharing") sleep(5) type(Key.ENTER) type(Key.ENTER) sleep(5) type(Key.ENTER, Key.CTRL) gd.page_text_generate(keyword, 1)
def run(self): # Disable Sikuli action and info log com = common.General() com.infolog_enable(False) com.set_mouse_delay(0) # Prepare app = gdoc.gDoc() 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(2) # PRE ACTIONS app.focus_content() sleep(1) # Customized Region customized_region_name = 'end' type_area = self.find_match_region( app.GDOC_CONTENT_LEFT_TOP_PAGE_REGION, similarity=0.85) modified_area = self.tuning_region(type_area, x_offset=120, w_offset=120, h_offset=120) self.set_override_region_settings(customized_region_name, modified_area) click(modified_area) # Record T1, and capture the snapshot image # Input Latency Action screenshot, t1 = app.il_type('m', 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() # POST ACTIONS # Write timestamp com.updateJson({'t1': t1, 't2': t2}, self.INPUT_TIMESTAMP_FILE_PATH) # Write the snapshot image shutil.move(screenshot, sample1_file_path)