def preview_generate_waveforms(self): current_def = sys._getframe().f_code.co_name time.sleep(3) screenshot1 = vm.get_screenshot(current_def) self.find( By.XPATH, "//Custom[contains(@AutomationId, 'PreviewPlayer')]" "//Button[contains(@AutomationId, 'MoreButton')]").click() self.driver.find_element_by_name('Generate waveforms').click() time.sleep(5) screenshot2 = vm.get_screenshot(current_def) result_thumbnail = cs.compare_image(screenshot1, screenshot2) if result_thumbnail < 0.95: return True else: return False
def preview_fullscreen(self): current_def = sys._getframe().f_code.co_name time.sleep(3) screenshot1 = vm.get_screenshot(current_def) ActionChains(self.driver).send_keys(Keys.F11).perform() time.sleep(3) screenshot2 = vm.get_screenshot(current_def) ActionChains(self.driver).send_keys(Keys.F11).perform() time.sleep(3) screenshot3 = vm.get_screenshot(current_def) result_f = cs.compare_image(screenshot1, screenshot2) result_r = cs.compare_image(screenshot1, screenshot3) if result_f < 0.9 and result_r > 0.9: return True else: return False
def preview_rotate(self): current_def = sys._getframe().f_code.co_name time.sleep(3) screenshot1 = vm.get_screenshot(current_def) ActionChains(self.driver).send_keys('l').perform() time.sleep(3) screenshot2 = vm.get_screenshot(current_def) ActionChains(self.driver).send_keys('r').perform() time.sleep(3) screenshot3 = vm.get_screenshot(current_def) result_l = cs.compare_image(screenshot1, screenshot2) result_r = cs.compare_image(screenshot1, screenshot3) if result_r > result_l: return True else: return False
def preview_zoom(self): current_def = sys._getframe().f_code.co_name time.sleep(3) screenshot1 = vm.get_screenshot(current_def) ActionChains(self.driver).key_down(Keys.ADD).perform() time.sleep(3) screenshot2 = vm.get_screenshot(current_def) ActionChains(self.driver).key_down(Keys.SUBTRACT).perform() time.sleep(3) screenshot3 = vm.get_screenshot(current_def) result_in = cs.compare_image(screenshot1, screenshot2) result_out = cs.compare_image(screenshot1, screenshot3) if result_out > result_in: return True else: return False
def preview_mute(self): current_def = sys._getframe().f_code.co_name time.sleep(1) screenshot1 = vm.get_screenshot(current_def) # mute ActionChains(self.driver).send_keys('m').perform() time.sleep(1) screenshot2 = vm.get_screenshot(current_def) # unmute ActionChains(self.driver).send_keys('m').perform() time.sleep(1) screenshot3 = vm.get_screenshot(current_def) result_mute = cs.compare_image(screenshot1, screenshot2) result_unmute = cs.compare_image(screenshot1, screenshot3) if result_mute < result_unmute: return True else: return False
def preview_play_enter(self): current_def = sys._getframe().f_code.co_name time.sleep(1) ActionChains(self.driver).send_keys(Keys.SPACE).send_keys( Keys.SPACE).perform() time.sleep(1) screenshot1 = vm.get_screenshot(current_def) ActionChains(self.driver).send_keys(Keys.ENTER).perform() time.sleep(1) screenshot2 = vm.get_screenshot(current_def) ActionChains(self.driver).send_keys(Keys.ENTER).perform() time.sleep(1) screenshot3 = vm.get_screenshot(current_def) # should be different result_play = cs.compare_image(screenshot1, screenshot2) # should be different result_pause = cs.compare_image(screenshot1, screenshot3) if result_play < 0.99 and result_pause < 0.99: return True else: return False
def preview_clip(self): current_def = sys._getframe().f_code.co_name time.sleep(1) screenshot1 = vm.get_screenshot(current_def) ActionChains(self.driver).send_keys('o').perform() time.sleep(1) screenshot2 = vm.get_screenshot(current_def) ActionChains(self.driver).send_keys('u').perform() time.sleep(1) screenshot3 = vm.get_screenshot(current_def) ActionChains(self.driver).send_keys(Keys.END).perform() time.sleep(1) screenshot4 = vm.get_screenshot(current_def) ActionChains(self.driver).send_keys('i').perform() time.sleep(1) screenshot5 = vm.get_screenshot(current_def) ActionChains(self.driver).send_keys('u').perform() time.sleep(1) screenshot6 = vm.get_screenshot(current_def) result_out = cs.compare_image(screenshot1, screenshot2) result_reset1 = cs.compare_image(screenshot1, screenshot3) result_in = cs.compare_image(screenshot4, screenshot5) result_reset2 = cs.compare_image(screenshot3, screenshot6) # pre of different images is less than similar images if result_out < result_reset1 and result_in < result_reset2: return True else: return False
def preview_switch_file(self): current_def = sys._getframe().f_code.co_name time.sleep(3) i = 0 j = 0 result_previous = '' result_next = '' screenshot1 = vm.get_screenshot(current_def) while i < random.randint(1, 10): # print('i') ActionChains(self.driver).send_keys(Keys.PAGE_UP).perform() time.sleep(1) screenshot2 = vm.get_screenshot(current_def) result_previous = cs.compare_image(screenshot1, screenshot2) if result_previous > 0.9: print(screenshot1) print(screenshot2) break screenshot1 = screenshot2 i += 1 while j < random.randint(1, 10): # print('j'+ str(j)) ActionChains(self.driver).send_keys(Keys.PAGE_DOWN).perform() time.sleep(1) screenshot2 = vm.get_screenshot(current_def) # if images are same, return True result_next = cs.compare_image(screenshot1, screenshot2) if result_next > 0.9: print(screenshot1) print(screenshot2) break screenshot1 = screenshot2 j += 1 if result_previous < 0.9 and result_next < 0.9: return True else: return False