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

        chrome = browser.Chrome()
        fb = facebook.facebook()

        chrome.clickBar()
        chrome.enterLink(self.INPUT_TEST_TARGET)
        fb.wait_for_loaded()

        sleep(2)
        _, _, obj = fb.click_post_area_home()
        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=50,
                                          y_offset=45,
                                          w_offset=-65,
                                          h_offset=-60)
        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"
        com.system_print('Type char')
        com.delayed_type(char_str, 0.1, delay)

        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(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.Chrome()

        # 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)
        sleep(2)

        # Customized Region
        customized_region_name = 'end'

        _, obj = app.wait_for_customer_text_loaded()
        # product thumbnail list region
        compare_area = Region(obj.x, obj.y, obj.w + 850, obj.h + 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
        setAutoWaitTimeout(10)
        com = common.General()
        com.infolog_enable(0)

        ff = browser.Firefox()
        fb = facebook.facebook()

        ff.clickBar()
        ff.enterLink(self.INPUT_TEST_TARGET)
        _, obj = fb.wait_for_loaded()
        sleep(2)

        # Customized Region
        customized_region_name = 'end'

        # part region of search suggestion list
        compare_area = self.tuning_region(obj, x_offset=175, y_offset=35, w_offset=500, h_offset=150)
        self.set_override_region_settings(customized_region_name, compare_area)
        hover(compare_area)

        sample1_fp = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH, self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME)
        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]  Scroll 1 Step')
        ff.scroll_down(1)
        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):
        # Disable Sikuli action and info log
        com = common.General()
        com.infolog_enable(False)
        com.set_mouse_delay(0)

        # Prepare
        app = gsheet.gSheet()
        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_1st_cell()
        sleep(1)

        # Customized Region
        customized_region_name = 'end'
        type_area = self.find_match_region(app.GSHEET_COLUMN_HEADER,
                                           similarity=0.75)
        modified_area = self.tuning_region(type_area,
                                           x_offset=-10,
                                           w_offset=60,
                                           h_offset=90)
        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('9', 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
        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)
Exemplo n.º 6
0
    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):
        # Disable Sikuli action and info log
        com = common.General()
        com.infolog_enable(0)

        chrome = browser.Chrome()
        gs = gsheet.gSheet()
        chrome.clickBar()
        chrome.enterLink(self.INPUT_TEST_TARGET)
        gs.wait_for_loaded()

        setAutoWaitTimeout(10)
        sample1_fp = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH, self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME)

        sleep(5)
        click(gs.gsheet_1st_cell)
        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 "9"')
        type('9')
        # 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):
        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'))
Exemplo n.º 9
0
    def __init__(self):
        self.com = common.General()
        self.os = str(Env.getOS())

        if self.os.lower() == 'mac':
            self.control = Key.CMD
        else:
            self.control = Key.CTRL
            self.alt = Key.ALT
    def run(self):
        # Disable Sikuli action and info log
        com = common.General()
        com.infolog_enable(False)
        Settings.MoveMouseDelay = 0

        # Prepare
        app = ymail.yMail()
        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)

        # Customized Region
        customized_region_name = 'end'
        _, obj = app.wait_for_compose_btn_loaded()
        compare_area = self.tuning_region(obj,
                                          x_offset=190,
                                          y_offset=130,
                                          w_offset=600,
                                          h_offset=490)
        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_compose_btn(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_for_mail_composer_loaded()
Exemplo n.º 11
0
    def __init__(self):
        self.os = str(Settings.getOS())
        self.os_version = str(Settings.getOSVersion())
        self.com = common.General()

        if self.os.startswith("M"):
            self.control = Key.CMD
        else:
            self.control = Key.CTRL
            self.alt = Key.ALT
    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)
Exemplo n.º 13
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()
    def run(self):
        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'))

        # Disable Sikuli action and info log
        com = common.General()
        com.infolog_enable(0)
        com.set_mouse_delay(0)

        ff = browser.Firefox()
        gs = gsearch.Gsearch()

        ff.clickBar()
        ff.enterLink(self.INPUT_TEST_TARGET)
        gs.wait_gimage_loaded()

        sleep(2)
        gs.hover_result_image(1, 1)

        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)

        mouseDown(Button.LEFT)
        com.system_print('[log]  Mouse up on first image')
        mouseUp(Button.LEFT)
        # gs.click_result_image(1, 1)
        sleep(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(sample2_fp)[1], '.png'))
        com.set_mouse_delay()
Exemplo n.º 15
0
    def __init__(self):
        self.common = common.General()
        self.os = str(
            Env.getOS())  # Using Env because of sikuli issue from https://bugs.launchpad.net/sikuli/+bug/1514007

        if self.os.lower() == 'mac':
            self.control = Key.CMD
        else:
            self.control = Key.CTRL
            self.alt = Key.ALT

        self.gsheet_tab_icon = Pattern("pics/gsheet.png").similar(0.70)
        self.gsheet_modify_highlight_cell = Pattern("pics/column_header.png").similar(0.70).targetOffset(450, 180)
        self.gsheet_delete_highlight_cell = Pattern("pics/column_header.png").similar(0.70).targetOffset(450, 180)
        self.gsheet_highlight_tab = Pattern("pics/highlight_tab.png").similar(0.70).targetOffset(160, 0)
        self.gsheet_column_header = Pattern("pics/column_header.png").similar(0.70).targetOffset(0, 60)
        self.gsheet_1st_cell = Pattern("pics/column_header.png").similar(0.70).targetOffset(0, 80)
    def run(self):
        # Disable Sikuli action and info log
        com = common.General()
        com.infolog_enable(False)

        ff = browser.Firefox()
        fb = facebook.facebook()

        ff.clickBar()
        ff.enterLink(self.INPUT_TEST_TARGET)
        fb.wait_for_loaded()

        sleep(2)
        fb.click_post_area_home()
        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)

        com.set_type_delay(0.06)

        t1 = time.time()
        capimg1 = capture(0, 0, capture_width, capture_height)

        char_len = 100
        char_str = (string.ascii_lowercase * (char_len / 26 + 1))[:char_len]
        com.system_print('Type char')
        type(char_str)

        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):
        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'))
Exemplo n.º 18
0
    def __init__(self, type=None):
        self.common = common.General()
        self.os = str(Env.getOS())
        self.type = type

        if self.os.lower() == 'mac':
            self.control = Key.CMD
        else:
            self.control = Key.CTRL
            self.alt = Key.ALT

        self.default_timeout = getAutoWaitTimeout()
        self.wait_time = 30
        setAutoWaitTimeout(self.wait_time)

        self.folder = os.path.join("pics", self.os.lower(), self.type)
        self.gslide_logo = Pattern(os.path.join(self.folder,
                                                "gslide.png")).similar(0.70)
        self.gslide_icon = Pattern(os.path.join(
            self.folder, "gslide_icon.png")).similar(0.70)
        self.page_end = Pattern(os.path.join(self.folder,
                                             "page_end.png")).similar(0.85)
        self.presentation_mode = Pattern(
            os.path.join(self.folder, "presentation_mode.png")).similar(0.70)
        self.presentation_blank_end = Pattern(
            os.path.join(self.folder,
                         "presentation_blank_end.png")).similar(0.70)
        self.presentation_page_2 = Pattern(
            os.path.join(self.folder, "presentation_page_2.png")).similar(0.60)
        self.presentation_page_3 = Pattern(
            os.path.join(self.folder, "presentation_page_3.png")).similar(0.60)
        self.presentation_page_4 = Pattern(
            os.path.join(self.folder, "presentation_page_4.png")).similar(0.60)
        self.presentation_page_5 = Pattern(
            os.path.join(self.folder, "presentation_page_5.png")).similar(0.60)
        self.presentation_page_6 = Pattern(
            os.path.join(self.folder, "presentation_page_6.png")).similar(0.60)
        self.presentation_page_7 = Pattern(
            os.path.join(self.folder, "presentation_page_7.png")).similar(0.60)
        self.presentation_page_8 = Pattern(
            os.path.join(self.folder, "presentation_page_8.png")).similar(0.60)
        self.presentation_page_9 = Pattern(
            os.path.join(self.folder, "presentation_page_9.png")).similar(0.60)
        self.presentation_page_end = Pattern(
            os.path.join(self.folder,
                         "presentation_page_end.png")).similar(0.60)
        self.blank_list_original = Pattern(
            os.path.join(self.folder, "blank_list_original.png")).similar(0.85)
        self.blank_list_final = Pattern(
            os.path.join(self.folder, "blank_list_final.png")).similar(0.85)
        self.image_chart_list = Pattern(
            os.path.join(self.folder, "image_chart_list.png")).similar(0.85)
        self.image_chart_list_page_2 = Pattern(
            os.path.join(self.folder,
                         "image_chart_list_page_2.png")).similar(0.95)
        self.image_chart_list_page_3 = Pattern(
            os.path.join(self.folder,
                         "image_chart_list_page_3.png")).similar(0.95)
        self.image_chart_list_page_4 = Pattern(
            os.path.join(self.folder,
                         "image_chart_list_page_4.png")).similar(0.95)
        self.image_chart_list_page_end = Pattern(
            os.path.join(self.folder,
                         "image_chart_list_page_end.png")).similar(0.95)
        self.animation_list = Pattern(
            os.path.join(self.folder, "animation_list.png")).similar(0.85)
        self.shape_list = Pattern(os.path.join(self.folder,
                                               "shape_list.png")).similar(0.85)
        self.table_list = Pattern(os.path.join(self.folder,
                                               "table_list.png")).similar(0.85)
        self.text_list = Pattern(os.path.join(self.folder,
                                              "text_list.png")).similar(0.85)
        self.utf8_txt_list = Pattern(
            os.path.join(self.folder, "utf8_txt_list.png")).similar(0.85)
        self.utf8_txt_list_original = Pattern(
            os.path.join(self.folder,
                         "utf8_txt_list_original.png")).similar(0.85)
        self.mix_content_30_list_original = Pattern(
            os.path.join(self.folder,
                         "mix_content_30_list_original.png")).similar(0.85)
        self.mix_content_30_list_final = Pattern(
            os.path.join(self.folder,
                         "mix_content_30_list_final.png")).similar(0.85)
        self.mix_content_30_list_final_end = Pattern(
            os.path.join(self.folder,
                         "mix_content_30_list_final_end.png")).similar(0.85)
        self.mix_content_50_list_original = Pattern(
            os.path.join(self.folder,
                         "mix_content_50_list_original.png")).similar(0.85)
        self.mix_content_50_list_final = Pattern(
            os.path.join(self.folder,
                         "mix_content_50_list_final.png")).similar(0.85)
        self.slides_5_list_original = Pattern(
            os.path.join(self.folder,
                         "slides_5_list_original.png")).similar(0.85)
        self.slides_5_list_final = Pattern(
            os.path.join(self.folder, "slides_5_list_final.png")).similar(0.85)
        self.slides_5_list_final_end = Pattern(
            os.path.join(self.folder,
                         "slides_5_list_final_end.png")).similar(0.85)
        self.slides_10_list_original = Pattern(
            os.path.join(self.folder,
                         "slides_10_list_original.png")).similar(0.85)
        self.slides_10_list_final = Pattern(
            os.path.join(self.folder,
                         "slides_10_list_final.png")).similar(0.85)
        self.list_page_2 = Pattern(os.path.join(
            self.folder, "list_page_2.png")).similar(0.95)
        self.list_page_3 = Pattern(os.path.join(
            self.folder, "list_page_3.png")).similar(0.95)
        self.list_page_4 = Pattern(os.path.join(
            self.folder, "list_page_4.png")).similar(0.95)
        self.list_page_5 = Pattern(os.path.join(
            self.folder, "list_page_5.png")).similar(0.95)
        self.list_page_6 = Pattern(os.path.join(
            self.folder, "list_page_6.png")).similar(0.95)
        self.list_page_7 = Pattern(os.path.join(
            self.folder, "list_page_7.png")).similar(0.95)
        self.list_page_8 = Pattern(os.path.join(
            self.folder, "list_page_8.png")).similar(0.95)
        self.list_page_9 = Pattern(os.path.join(
            self.folder, "list_page_9.png")).similar(0.95)
        self.list_page_10 = Pattern(
            os.path.join(self.folder, "list_page_10.png")).similar(0.95)
        self.blank_theme = Pattern(os.path.join(
            self.folder, "blank_theme.png")).similar(0.70)
        self.theme_mozilla_tag = Pattern(
            os.path.join(self.folder, "theme_mozilla_tag.png")).similar(0.85)
        self.theme_mozilla_tag_red = Pattern(
            os.path.join(self.folder,
                         "theme_mozilla_tag_red.png")).similar(0.85)
    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, similarity=0.9)
        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)
Exemplo n.º 20
0
    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)
    def run(self):
        # Disable Sikuli action and info log
        com = common.General()
        com.infolog_enable(False)
        com.set_mouse_delay(0)
        delay = com.find_key_type_delay()

        # Prepare
        app = amazon.Amazon()
        sample1_file_path = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH,
                                         self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME)
        sample2_file_path = os.path.join(
            self.INPUT_IMG_SAMPLE_DIR_PATH,
            self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME.replace(
                'sample_1', 'sample_2'))
        sample1_file_path = sample1_file_path.replace(
            os.path.splitext(sample1_file_path)[1], '.png')
        sample2_file_path = sample2_file_path.replace(
            os.path.splitext(sample2_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_search_button_loaded()

        # Wait for stable
        sleep(2)

        # PRE ACTIONS
        app.click_search_field()
        sleep(1)

        # Customized Region
        customized_region_name_start = 'start'
        customized_region_name_end = 'end'
        _, type_area = app.wait_for_component_display(app.AMAZON_SEARCH_BAR,
                                                      similarity=0.9)
        self.set_override_region_settings(customized_region_name_start,
                                          type_area)
        self.set_override_region_settings(customized_region_name_end,
                                          type_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"
        com.system_print('Type char')
        com.delayed_type(char_str, 0.1, delay)
        sleep(1)

        # Record T2
        t2 = time.time()

        # POST ACTIONS
        capimg2 = capture(0, 0, capture_width, capture_height)

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

        # Write the snapshot image
        shutil.move(capimg1, sample1_file_path)
        shutil.move(capimg2, sample2_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 = 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.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.close_ad()
        app.click_search_field()
        sleep(1)
        type('mozilla')
        app.wait_for_search_suggestion_loaded()
        com.loop_type_key(Key.DOWN, 2, 0.5)

        # 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)

        # 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)
Exemplo n.º 23
0
sys.path.append(sys.argv[2])
import browser
import common

com = common.General()
ff = browser.Firefox()

wait(2)
ff.focus()
ff.getConsoleInfo("window.performance.timing")

wait(1)
com.dumpToJson(Env.getClipboard(), sys.argv[1])

ff.closeConsole()
Exemplo n.º 24
0
    def __init__(self):
        self.common = common.General()

        if sys.platform == 'darwin':
            self.control = Key.CMD
        else:
            self.control = Key.CTRL
            self.alt = Key.ALT

        self.fb_logo = Pattern("pics/facebook_logo.png").similar(0.70)
        self.blue_bar = Pattern("pics/facebook_blue_bar.png").similar(0.70)
        self.search_bar = Pattern("pics/facebook_search_bar.png").similar(0.70)
        self.search_icon = Pattern("pics/facebook_search_icon.png").similar(
            0.70)
        self.folding_icon = Pattern("pics/facebook_folding_icon.png").similar(
            0.70)
        self.notification_icon = Pattern(
            "pics/facebook_notification_icon.png").similar(0.70)
        self.post_button = Pattern("pics/facebook_post_button.png").similar(
            0.70)
        self.post_action = Pattern("pics/facebook_post_action.png").similar(
            0.70)
        self.home_post_area = Pattern(
            "pics/facebook_home_post_area.png").similar(0.70)
        self.club_post_area = Pattern(
            "pics/facebook_club_post_area.png").similar(0.70)
        self.personal_post_area = Pattern(
            "pics/facebook_personal_post_area.png").similar(0.70)
        self.post_area_focused = Pattern(
            "pics/facebook_post_area_focused.png").similar(0.70)
        self.home_post_area_focused = Pattern(
            "pics/facebook_home_post_area_focused.png").similar(0.70)
        self.club_delete_post_button = Pattern(
            "pics/facebook_club_delete_post_button.png").similar(0.85)
        self.club_post_area_upload = Pattern(
            "pics/facebook_club_post_area_upload.png").similar(0.70)
        self.club_post_marker = Pattern(
            "pics/facebook_club_post_marker.png").similar(0.70)
        self.club_delete_post_menu = Pattern(
            "pics/facebook_club_delete_post_menu.png").similar(0.70)
        self.non_club_delete_post_button = Pattern(
            "pics/facebook_non_club_delete_post_button.png").similar(0.70)
        self.non_club_post_marker = Pattern(
            "pics/facebook_non_club_post_marker.png").similar(0.70)
        self.non_club_post_menu_edit = Pattern(
            "pics/facebook_non_club_post_menu_edit.png").similar(0.70)
        self.non_club_delete_post_menu = Pattern(
            "pics/facebook_non_club_delete_post_menu.png").similar(0.70)
        self.club_post_header = Pattern(
            "pics/facebook_club_post_header.png").similar(0.70)
        self.video_stop_icon = Pattern(
            "pics/facebook_video_stop_icon.png").similar(0.70)
        self.feed_end_reminder = Pattern(
            "pics/facebook_feed_end_reminder.png").similar(0.70)
        self.activity_end_reminder = Pattern(
            "pics/facebook_activity_end_reminder.png").similar(0.70)
        self.share_button = Pattern("pics/facebook_share_button.png").similar(
            0.70)
        self.share_menu = Pattern("pics/facebook_share_menu.png").similar(0.70)
        self.save_button = Pattern("pics/facebook_save_button.png").similar(
            0.70)
        self.club_post_menu_delete = Pattern(
            "pics/facebook_club_post_menu_delete.png").similar(0.70)

        self.sampleImg1 = os.path.join(
            os.path.dirname(os.path.realpath(__file__)), "content",
            "sample_1.jpg")