예제 #1
0
    def run(self):
        # Disable Sikuli action and info log
        com = common.General()
        com.infolog_enable(False)
        com.set_mouse_delay(0)

        # Prepare
        app = gslide.gSlide()
        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

        # Customized Region
        customized_region_name = 'end'
        type_area = self.find_match_region(app.GSLIDE_TXT_IMG_SHAPE_ICON, similarity=0.75)
        modified_area = self.tuning_region(type_area, x_offset=-200, w_offset=200, h_offset=250)
        self.set_override_region_settings(customized_region_name, modified_area)

        # Record T1, and capture the snapshot image
        # Input Latency Action

        screenshot, t1 = app.il_key_type(Key.PAGE_DOWN, "[log]  Click Page Down", 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)
# 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.clickBar()
ff.enterLink(sys.argv[3])
setAutoWaitTimeout(10)

sleep(2)
gs.wait_for_loaded()

type(Key.END)
sleep(1)
wait(gs.page_end)
click(gs.page_end)
sleep(0.5)
gs.select_all()
paste("TXT")
type(Key.ESC)
waitVanish(gs.page_end)
# 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()
chrome = browser.Chrome()
gs = gslide.gSlide('chrome')

chrome.clickBar()
chrome.enterLink(sys.argv[3])
setAutoWaitTimeout(10)

sleep(2)
gs.wait_for_loaded()
wait(gs.blank_list_original)
# 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.slides_10_list_original)

type(Key.END)
sleep(1)
wait(gs.slides_10_list_final)
type(Key.DELETE)
if not waitVanish(gs.slides_10_list_final):
    exit(1)
# 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_original)

type(Key.PAGE_DOWN)
sleep(1)
wait(gs.list_page_2)
type(Key.PAGE_DOWN)
sleep(1)
wait(gs.list_page_3)
type(Key.PAGE_DOWN)
sleep(1)
wait(gs.list_page_4)
type(Key.PAGE_DOWN)
sleep(1)
wait(gs.list_page_5)