def run(self): # Disable Sikuli action and info log com = common.General() com.infolog_enable(False) com.set_mouse_delay(0) # Prepare app = outlook.outlook() 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.mouse_move_to_compose_new_mail_button() app._click(action_name='Click compose new mail icon', component=app.OUTLOOK_COMPOSE_NEW_MAIL_ICON) app.click_compose_new_mail_content() sleep(2) # Customized Region customized_region_name = 'end' type_area = self.find_match_region(app.OUTLOOK_MIDDLE_UPPER_MENU_ICON, similarity=0.75) modified_area = self.tuning_region(type_area, y_offset=260, x_offset=-58, w_offset=160, h_offset=20) self.set_override_region_settings(customized_region_name, modified_area) # Record T1, and capture the snapshot image # Input Latency Action screenshot, t1 = app.il_type('a', 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 app.click_discard_mail() app.click_discard_mail_confirmation() # Write timestamp com.updateJson({'t1': t1, 't2': t2}, self.INPUT_TIMESTAMP_FILE_PATH) # Write the snapshot image shutil.move(screenshot, sample1_file_path)
# if you are putting your test script folders under {git project folder}/tests/, it will work fine. # otherwise, you either add it to system path before you run or hard coded it in here. sys.path.append(sys.argv[2]) import browser import common import gslide com = common.General() ff = browser.Firefox() gs = gslide.gSlide('ff') ff.clickBar() ff.enterLink(sys.argv[3]) setAutoWaitTimeout(10) sleep(2) gs.wait_for_loaded() wait(gs.utf8_txt_list)
def run(self): # Disable Sikuli action and info log self.common.infolog_enable(False) delay = self.common.find_key_type_delay() ff = browser.Firefox() fb = facebook.facebook() ff.clickBar() ff.enterLink(self.INPUT_TEST_TARGET) fb.wait_for_loaded() fb.wait_for_messenger_loaded() sleep(2) self.common.select_all() self.common.delete() sleep(2) _, _, obj = fb.focus_message_type_area() 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) # Customized Region customized_region_name_start = 'start' customized_region_name_end = 'end' # part region of search suggestion list compare_area = self.tuning_region(obj, x_offset=-135, y_offset=-50, w_offset=525, h_offset=30) 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) # Reference from https://en.wikipedia.org/wiki/Lorem_ipsum # extract 100 chars from Lorem ipsum text and filter characters which will affect result, e.g., i, j, and l char_str = "orempsumdorstametconsecteturadpscngetsedoeusmodtemporncduntutaboretdoremagnaquatenmadmnvenamqusnoexe" 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'))
def run(self): # Disable Sikuli action and info log self.common.infolog_enable(False) self.common.set_mouse_delay(0) # Prepare gs = gsearch.Gsearch() sample1_fp = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH, self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME) sample1_fp = sample1_fp.replace( os.path.splitext(sample1_fp)[1], '.png') capture_width = int(self.INPUT_RECORD_WIDTH) capture_height = int(self.INPUT_RECORD_HEIGHT) # Launch browser ff = browser.Firefox() # Access link and wait ff.clickBar() ff.enterLink(self.INPUT_TEST_TARGET) pattern, obj = gs.wait_gsearch_loaded() # Wait for stable sleep(2) # PRE ACTIONS gs.focus_search_inputbox() type("mozilla") sleep(1) gs.wait_search_suggestion() # Customized Region customized_region_name = 'end' # part region of search suggestion list compare_area = self.tuning_region(obj, x_offset=-140, y_offset=-70, w_offset=200) self.set_override_region_settings(customized_region_name, compare_area) # Record T1, and capture the snapshot image # Input Latency Action screenshot, t1 = gs.il_type_key_down_search_suggestion( 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 sleep(2) # Write timestamp self.common.updateJson({ 't1': t1, 't2': t2 }, self.INPUT_TIMESTAMP_FILE_PATH) # Write the snapshot image shutil.move(screenshot, sample1_fp)
def run(self): # Disable Sikuli action and info log com = common.General() com.infolog_enable(False) com.set_mouse_delay(0) # Prepare app = amazon.Amazon() 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_logo_loaded() # Wait for stable sleep(2) # PRE ACTIONS type(Key.PAGE_DOWN) type(Key.UP) sleep(2) # Customized Region customized_region_name = 'end' _, obj = app.wait_for_product_details_text_loaded() obj.x, obj.y = obj.x - 20, obj.y - 305 # product thumbnail list region compare_area = self.tuning_region(obj, w_offset=850, h_offset=250) self.set_override_region_settings(customized_region_name, compare_area) sleep(2) # Record T1, and capture the snapshot image # Input Latency Action screenshot, t1 = app.il_hover_fifth_customer_watched_product( 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 sleep(1) # Write timestamp com.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 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.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.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)
def run(self): # Disable Sikuli action and info log self.common.infolog_enable(False) self.common.set_mouse_delay(0) # Prepare app = facebook.facebook() sample1_fp = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH, self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME) sample1_fp = sample1_fp.replace( os.path.splitext(sample1_fp)[1], '.png') capture_width = int(self.INPUT_RECORD_WIDTH) capture_height = int(self.INPUT_RECORD_HEIGHT) # Launch browser ff = browser.Firefox() # Access link and wait ff.clickBar() ff.enterLink(self.INPUT_TEST_TARGET) app.wait_for_loaded() # Wait for stable sleep(2) # PRE ACTIONS _, obj = app.wait_for_message_search_bar() # Customized Region customized_region_name = 'end' # part region of search suggestion list compare_area = self.tuning_region(obj, x_offset=-275, y_offset=-300, w_offset=55, h_offset=300) pattern = capture(compare_area) 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_open_chat_tab( 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 app.wait_pattern_for_vanished(pattern=pattern) # Write timestamp self.common.updateJson({ 't1': t1, 't2': t2 }, self.INPUT_TIMESTAMP_FILE_PATH) # Write the snapshot image shutil.move(screenshot, sample1_fp)
def run(self): # Disable Sikuli action and info log com = common.General() com.infolog_enable(False) com.set_mouse_delay(0) # Prepare app = youtube.Youtube() 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.close_ad() app.click_search_field() sleep(1) # Customized Region customized_region_name = 'end' type_area_component = [ ['search_bar_win.png', 0, 0], ] type_area = self.find_match_region(type_area_component) self.set_override_region_settings(customized_region_name, type_area) type('mozilla') app.wait_for_search_suggestion_loaded() com.loop_type_key(Key.DOWN, 2, 0.5) # Record T1, and capture the snapshot image # Input Latency Action screenshot, t1 = app.il_type_key_down_search_suggestion( 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 sleep(1) # Write timestamp com.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 com = common.General() com.infolog_enable(False) com.set_mouse_delay(0) # Prepare app = amazon.Amazon() 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) _, obj = app.wait_for_logo_loaded() # Wait for stable sleep(2) # PRE ACTIONS app.click_search_field() # user function's related position from logo pattern = capture(obj.x + 160, obj.y + 50, obj.w + 100, obj.h) sleep(1) type('m') com.system_print('Wait temp pattern {} vanished.'.format(pattern)) app.wait_pattern_for_vanished(pattern=pattern) com.loop_type_key(Key.DOWN, 2, 0.5) # Customized Region customized_region_name = 'end' # part region of search suggestion list compare_area = self.tuning_region(obj, x_offset=160, w_offset=200, h_offset=50) self.set_override_region_settings(customized_region_name, compare_area) sleep(2) # Record T1, and capture the snapshot image # Input Latency Action screenshot, t1 = app.il_type_key_down_search_suggestion(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 sleep(1) # Write timestamp com.updateJson({'t1': t1, 't2': t2}, self.INPUT_TIMESTAMP_FILE_PATH) # Write the snapshot image shutil.move(screenshot, sample1_file_path)