def tearDown(self): # capture 2nd snapshot time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_2_fp, self.env.img_sample_dp, self.env.img_output_sample_2_fn) # Stop profiler and save profile data self.profilers.stop_profiling(self.profile_dir_path) # Stop browser if int(os.getenv("CLOSE_BROWSER")) == 1: desktopHelper.stop_browser(self.browser_type, self.env) # Delete Url if self.test_url_id: self.target_helper.delete_target(self.test_url_id) # output sikuli status to static file with open(self.env.DEFAULT_SIKULI_STATUS_RESULT, "w") as fh: fh.write(str(self.sikuli_status)) # output result if self.sikuli_status == 0: resultHelper.result_calculation(self.env) else: print "[WARNING] This running result of sikuli execution is not successful, return code: " + str(self.sikuli_status)
def setUp(self): # Get profiler list self.profiler_list = self.get_profiler_list() # Init environment variables self.env = Environment(self._testMethodName) # Init output dirs self.env.init_output_dir() # Init sikuli status self.sikuli_status = 0 # get browser type self.browser_type = self.env.get_browser_type() # init target helper self.target_helper = targetHelper.TagetHelper(self.env) # init sikuli self.sikuli = sikuli.Sikuli() # Start video recordings self.profilers = Profilers(self.env, self.browser_type, self.sikuli) self.profilers.start_profiling(self.profiler_list) self.profile_zip_path = self.profilers.get_profile_path() # minimize all windows desktopHelper.minimize_window() # launch browser self.profile_dir_path = desktopHelper.launch_browser(self.browser_type, self.profile_zip_path) # switch to content window, prevent cursor twinkling time.sleep(3) if self.browser_type == desktopHelper.DEFAULT_BROWSER_TYPE_FIREFOX: self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) else: self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_chrome_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) # execute pre-run-script. # You have to specify the pre_run_script and test_url before calling parent setup in your test class if hasattr(self, "pre_run_script"): # clone pre run script test url id if hasattr(self, "pre_run_script_test_url_id"): test_url_id = getattr(self.env, self.pre_run_script_test_url_id) self.test_url, self.test_url_id = self.target_helper.clone_target(test_url_id, self.pre_run_script + "_" + self.env.time_stamp) # execute pre run script self.sikuli_status = self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, self.pre_run_script, self.pre_run_script + "_" + self.env.time_stamp, test_url=self.test_url) # capture 1st snapshot time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def tearDown(self): # capture 2nd snapshot time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_2_fp, self.env.img_sample_dp, self.env.img_output_sample_2_fn) # Stop profiler and save profile data self.profilers.stop_profiling(self.profile_dir_path) # Stop browser if int(os.getenv("CLOSE_BROWSER")) == 1: desktopHelper.stop_browser(self.browser_type, self.env) # Delete Url if self.test_url_id: self.target_helper.delete_target(self.test_url_id) # output sikuli status to static file with open(self.env.DEFAULT_SIKULI_STATUS_RESULT, "w") as fh: fh.write(str(self.sikuli_status)) # output result if self.sikuli_status == 0: resultHelper.result_calculation(self.env) else: print "[WARNING] This running result of sikuli execution is not successful, return code: " + str( self.sikuli_status)
def setUp(self): super(TestSikuli, self).setUp() time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn) self.sikuli = sikuli.Sikuli()
def tearDown(self): time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_2_fp, self.env.img_sample_dp, self.env.img_output_sample_2_fn) super(TestSikuli, self).tearDown()
def tearDown(self): time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_defocuscontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(3) captureHelper.capture_screen(self.env, self.env.video_output_sample_2_fp, self.env.img_sample_dp, self.env.img_output_sample_2_fn) super(TestSikuli, self).tearDown()
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target("1EUws7kljkRWPHR0-e7SFAGzQxa8Z6UjlwD437y6U3Cs", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target("1eY2X556Ce3_MiIzqlGeAhzbWjn2_1Z44Krv94cXhlxU", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_chrome_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target("10bLI9mQ3v5oq441FlZW93w0Or1fvXTasWl4m3nFLzFo", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_chrome_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def tearDown(self): time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_2_fp, self.env.img_sample_dp, self.env.img_output_sample_2_fn) if self.env.test_method_name.startswith("test_firefox"): self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_timing", self.env.test_method_name + "_" + self.env.time_stamp) elif self.env.test_method_name.startswith("test_chrome"): self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_chrome_timing", self.env.test_method_name + "_" + self.env.time_stamp) super(TestSikuli, self).tearDown()
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target("1ORZOuLyxehup7IhBQk02t0qycDr0VcCa3ciXfwTdEmk", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target("1CK2vtauGXlGuBnvXBFq_Am2DWFnMHkA6KFSiT8eFdnU", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target("1V17WzeUGbUTc4oqqS3IvnRLCC9Xs79p6CeDyKo0LBq0", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target("1o7zKj0oUYj0hyC_jKxVJOcCuy4xcf0cUiA4Jac-zqZk", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target("1d49NaEpY9G9laZY_OPYfYdjngeAvcGNEPMTEVsW76js", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_chrome_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target("1ORZOuLyxehup7IhBQk02t0qycDr0VcCa3ciXfwTdEmk", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_chrome_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target("1fWyMZI7kVti259T6LbmJv78nSxe2m3RHSbwjTQCYKTE", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_chrome_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target("11MUA4O5kQQP8zbeQxLWOwb5t174Fa5djBDCGfN9Rn0M", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target("1cSx12G6p-0dCilrevzZUjdl_8QEMiOao33u8BTuzszs", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(3) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target("1V17WzeUGbUTc4oqqS3IvnRLCC9Xs79p6CeDyKo0LBq0", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_chrome_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target("14nNjuIL1OyRog5z7S57_wMhdbKyOmdPXcFmfNlvyQwI", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target("1ptpg3mlsWbWJRN-W6TFSLJxaWI9XY7N6axeVxmaZTCI", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target("1ktU9DnreProcMXa0L5PBCateh-xJYbKqsf-3TgwAJhI", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_chrome_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(3) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target("1zSZRnZA8LsXcj29nuyd7xya9M5VcClKdFEOOx2cSVyU", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(3) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target(self.env.TEST_TARGET_ID_BLANK_PAGE, self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target( "1eR7Tvo_H6Rnz68mXp_FBw555uyGb76NbB_1sPDrQzBs", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_chrome_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target( "(Google Drive String)", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_browser_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target( "1CK2vtauGXlGuBnvXBFq_Am2DWFnMHkA6KFSiT8eFdnU", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target( "1o7zKj0oUYj0hyC_jKxVJOcCuy4xcf0cUiA4Jac-zqZk", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target( "1JFLaWO-X2upQcYvPQBT59VQJmHngai9u7K3WPG1ll6Y", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_chrome_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target( self.env.TEST_TARGET_ID_3_PAGE_CONTENT_WITH_TXT_TABLE_IMAGE, self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target( "1ktU9DnreProcMXa0L5PBCateh-xJYbKqsf-3TgwAJhI", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_chrome_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(3) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target( "1Wn729dS_2XFV1-L_ON6x31stVQrl0FRfStrNVb6iHNU", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_chrome_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target( "14nNjuIL1OyRog5z7S57_wMhdbKyOmdPXcFmfNlvyQwI", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target( "1ptpg3mlsWbWJRN-W6TFSLJxaWI9XY7N6axeVxmaZTCI", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target( "1zSZRnZA8LsXcj29nuyd7xya9M5VcClKdFEOOx2cSVyU", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_chrome_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(3) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): super(TestSikuli, self).setUp() self.test_url, self.test_url_id = self.target_helper.clone_target( "1YpQyum1kME8lMPiaQuxa8O9-beuife0WTmpIlspZn2w", self.env.output_name) time.sleep(3) self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, "test_chrome_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def tearDown(self): # Record timestamp t3 self.exec_timestamp_list.append(time.time()) # capture 2nd snapshot time.sleep(5) if self.env.PROFILER_FLAG_AVCONV in self.enabled_profiler_list or self.env.PROFILER_FLAG_FXALL in self.enabled_profiler_list: captureHelper.capture_screen(self.env, self.env.video_output_sample_2_fp, self.env.img_sample_dp, self.env.img_output_sample_2_fn) # Stop profiler and save profile data self.profilers.stop_profiling(self.profile_dir_path) # Post run sikuli script if os.getenv("POST_SCRIPT_PATH"): self.sikuli.run_sikulix_cmd(os.getenv("POST_SCRIPT_PATH")) # Stop browser if int(os.getenv("KEEP_BROWSER")) == 0: self.sikuli.close_browser(self.browser_type) # Delete Url if hasattr(self,"test_url_id"): self.target_helper.delete_target(self.test_url_id) # output sikuli status to static file with open(self.env.DEFAULT_STAT_RESULT, "w") as fh: stat_data = {'sikuli_stat' : str(self.sikuli_status)} json.dump(stat_data,fh) # output result if self.sikuli_status == 0: if hasattr(self, "crop_data"): resultHelper.result_calculation(self.env, self.exec_timestamp_list, self.crop_data) else: resultHelper.result_calculation(self.env, self.exec_timestamp_list) else: print "[WARNING] This running result of sikuli execution is not successful, return code: " + str(self.sikuli_status)
def setUp(self): # Get profiler list self.profiler_list = self.get_profiler_list() # Init output dirs self.env.init_output_dir() # Init sikuli status self.sikuli_status = 0 # Init timestamp list self.exec_timestamp_list = [] # get browser type self.browser_type = self.env.get_browser_type() # init target helper self.target_helper = targetHelper.TagetHelper(self.env) # init sikuli self.sikuli = sikuli.Sikuli(self.env.run_sikulix_cmd_path, self.env.hasal_dir) # Start video recordings self.profilers = Profilers(self.env, self.browser_type, self.sikuli) self.profilers.start_profiling(self.profiler_list) self.profile_zip_path = self.profilers.get_profile_path() # Record timestamp t1 self.exec_timestamp_list.append(time.time()) # minimize all windows desktopHelper.minimize_window() # launch browser if self.env.PROFILER_FLAG_CHROMETRACING in self.enabled_profiler_list: self.profile_dir_path = desktopHelper.launch_browser(self.browser_type, profile_path=self.profile_zip_path, tracing_path=self.env.chrome_tracing_file_fp) else: self.profile_dir_path = desktopHelper.launch_browser(self.browser_type, profile_path=self.profile_zip_path) # switch to content window, prevent cursor twinkling time.sleep(3) if self.browser_type == desktopHelper.DEFAULT_BROWSER_TYPE_FIREFOX: self.sikuli.run_test("test_firefox_switchcontentwindow", self.env.output_name) else: self.sikuli.run_test("test_chrome_switchcontentwindow", self.env.output_name) # lock browser start pos at (0,0) desktopHelper.lock_window_pos(self.browser_type) # execute pre-run-script. # You have to specify the pre_run_script and test_url before calling parent setup in your test class if hasattr(self, "pre_run_script"): # clone pre run script test url id if hasattr(self, "pre_run_script_test_url_id"): test_url_id = getattr(self.env, self.pre_run_script_test_url_id) self.test_url, self.test_url_id = self.target_helper.clone_target(test_url_id, self.pre_run_script + "_" + self.env.time_stamp) # execute pre run script self.sikuli_status = self.sikuli.run_test( self.pre_run_script, self.pre_run_script + "_" + self.env.time_stamp, test_url=self.test_url) # clone test target if hasattr(self, "test_target"): self.test_url, self.test_url_id = self.target_helper.clone_target(self.test_target, self.env.output_name) # capture 1st snapshot time.sleep(5) if self.env.PROFILER_FLAG_AVCONV in self.enabled_profiler_list or self.env.PROFILER_FLAG_FXALL in self.enabled_profiler_list: captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn) time.sleep(2) # Record timestamp t2 self.exec_timestamp_list.append(time.time())
def setUp(self): super(TestGoogleDocSample, self).setUp() time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)
def setUp(self): # Get profiler list self.profiler_list = self.get_profiler_list() # Init environment variables self.env = Environment(self._testMethodName) # Init output dirs self.env.init_output_dir() # Init sikuli status self.sikuli_status = 0 # get browser type self.browser_type = self.env.get_browser_type() # init target helper self.target_helper = targetHelper.TagetHelper(self.env) # init sikuli self.sikuli = sikuli.Sikuli() # Start video recordings self.profilers = Profilers(self.env, self.browser_type, self.sikuli) self.profilers.start_profiling(self.profiler_list) self.profile_zip_path = self.profilers.get_profile_path() # minimize all windows desktopHelper.minimize_window() # launch browser self.profile_dir_path = desktopHelper.launch_browser( self.browser_type, self.profile_zip_path) # switch to content window, prevent cursor twinkling time.sleep(3) if self.browser_type == desktopHelper.DEFAULT_BROWSER_TYPE_FIREFOX: self.sikuli.run( self.env.sikuli_path, self.env.hasal_dir, "test_firefox_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) else: self.sikuli.run( self.env.sikuli_path, self.env.hasal_dir, "test_chrome_switchcontentwindow", self.env.test_method_name + "_" + self.env.time_stamp) # execute pre-run-script. # You have to specify the pre_run_script and test_url before calling parent setup in your test class if hasattr(self, "pre_run_script"): # clone pre run script test url id if hasattr(self, "pre_run_script_test_url_id"): test_url_id = getattr(self.env, self.pre_run_script_test_url_id) self.test_url, self.test_url_id = self.target_helper.clone_target( test_url_id, self.pre_run_script + "_" + self.env.time_stamp) # execute pre run script self.sikuli_status = self.sikuli.run(self.env.sikuli_path, self.env.hasal_dir, self.pre_run_script, self.pre_run_script + "_" + self.env.time_stamp, test_url=self.test_url) # capture 1st snapshot time.sleep(5) captureHelper.capture_screen(self.env, self.env.video_output_sample_1_fp, self.env.img_sample_dp, self.env.img_output_sample_1_fn)