How to use update_visual_baseline method in toolium

Best Python code snippet using toolium_python

driver_wrapper.py

Source:driver_wrapper.py Github

copy

Full Screen

...70 if self.baseline_name != baseline_name:71 self.baseline_name = baseline_name72 self.visual_baseline_directory = os.path.join(DriverManager.visual_baseline_directory,73 get_valid_filename(baseline_name))74 def update_visual_baseline(self):75 if '{PlatformVersion}' in self.baseline_name:76 try:77 platform_version = self.driver.desired_capabilities['platformVersion']78 except KeyError:79 platform_version = None80 self.baseline_name = self.baseline_name.replace('{PlatformVersion}', str(platform_version))81 self.visual_baseline_directory = os.path.join(DriverManager.visual_baseline_directory,82 self.baseline_name)83 if '{Version}' in self.baseline_name:84 try:85 splitted_version = self.driver.desired_capabilities['version'].split('.')86 version = '.'.join(splitted_version[:2])87 except KeyError:88 version = None89 self.baseline_name = self.baseline_name.replace('{Version}', str(version))90 self.visual_baseline_directory = os.path.join(DriverManager.visual_baseline_directory,91 self.baseline_name)92 if '{RemoteNode}' in self.baseline_name:93 self.baseline_name = self.baseline_name.replace('{RemoteNode}', str(self.remote_node))94 self.visual_baseline_directory = os.path.join(DriverManager.visual_baseline_directory,95 self.baseline_name)96 def configure(self, tc_config_files, is_selenium_test=True, behave_properties=None):97 DriverManager.configure_common_directories(tc_config_files)98 self.configure_logger(tc_config_files.config_log_filename, tc_config_files.output_log_filename)99 self.configure_properties(tc_config_files.config_properties_filenames, behave_properties)100 if is_selenium_test:101 driver_info = self.config.get('Driver', 'type')102 DriverManager.configure_visual_directories(driver_info)103 self.configure_visual_baseline()104 def connect(self, maximize=True):105 if not self.config.get('Driver', 'type') or self.config.get('Driver', 'type') in [106 'backend', 'no_driver', 'host', 'service', 'api'107 ]:108 return None109 self.driver = SetupDriver(self.config, self.utils).create_driver()110 self.session_id = self.driver.session_id111 self.server_type, self.remote_node = self.utils.get_remote_node()112 if self.server_type == 'grid':113 self.remote_node_video_enabled = self.utils.is_remote_video_enabled(self.remote_node)114 else:115 self.remote_node_video_enabled = True if self.server_type in ['ggr', 'selenoid'] else False116 if self.is_mobile_test() and not self.is_web_test() and self.config.getboolean_optional('Driver',117 'appium_app_strings'):118 self.app_strings = self.driver.app_strings()119 if self.is_maximizable():120 bounds_x, bounds_y = self.get_config_window_bounds()121 self.driver.set_window_position(bounds_x, bounds_y)122 self.logger.debug('Window bounds: %s x %s', bounds_x, bounds_y)123 if maximize:124 window_width = self.config.get_optional('Driver', 'window_width')125 window_height = self.config.get_optional('Driver', 'window_height')126 if window_width and window_height:127 self.driver.set_window_size(window_width, window_height)128 else:129 self.driver.maximize_window()130 window_size = self.utils.get_window_size()131 self.logger.debug('Window size: %s x %s', window_size['width'], window_size['height'])132 self.update_visual_baseline()133 self.utils.discard_logcat_logs()134 if self.config.get('Driver', 'type') != 'ios':135 self.utils.set_implicitly_wait()136 return self.driver137 def get_config_window_bounds(self):138 bounds_x = int(self.config.get_optional('Driver', 'bounds_x') or 0)139 bounds_y = int(self.config.get_optional('Driver', 'bounds_y') or 0)140 monitor_index = int(self.config.get_optional('Driver', 'monitor') or -1)141 if monitor_index > -1:142 try:143 monitor = screeninfo.get_monitors()[monitor_index]144 bounds_x += monitor.x145 bounds_y += monitor.y146 except NotImplementedError:...

Full Screen

Full Screen

test_driver_wrapper_baseline.py

Source:test_driver_wrapper_baseline.py Github

copy

Full Screen

...51 driver_wrapper.config.set('VisualTests', 'baseline_name', 'ios_{PlatformVersion}')52 driver_wrapper.driver = mock.MagicMock()53 driver_wrapper.driver.desired_capabilities.__getitem__.return_value = '9.3'54 driver_wrapper.configure_visual_baseline()55 driver_wrapper.update_visual_baseline()56 expected_baseline_directory = os.path.join(root_path, 'output', 'visualtests', 'baseline', 'ios_9.3')57 assert driver_wrapper.baseline_name == 'ios_9.3'58 assert driver_wrapper.visual_baseline_directory == expected_baseline_directory59def test_update_visual_baseline_version(driver_wrapper):60 # Configure baseline and driver mock61 driver_wrapper.config.set('VisualTests', 'baseline_name', 'chrome_{Version}')62 driver_wrapper.driver = mock.MagicMock()63 driver_wrapper.driver.desired_capabilities.__getitem__.return_value = '51.0.2704.103'64 driver_wrapper.configure_visual_baseline()65 driver_wrapper.update_visual_baseline()66 expected_baseline_directory = os.path.join(root_path, 'output', 'visualtests', 'baseline', 'chrome_51.0')67 assert driver_wrapper.baseline_name == 'chrome_51.0'68 assert driver_wrapper.visual_baseline_directory == expected_baseline_directory69def test_update_visual_baseline_remote_node(driver_wrapper):70 # Configure baseline and remote node71 driver_wrapper.config.set('VisualTests', 'baseline_name', 'firefox_{RemoteNode}')72 driver_wrapper.remote_node = '255.255.255.255'73 driver_wrapper.configure_visual_baseline()74 driver_wrapper.update_visual_baseline()75 expected_baseline_directory = os.path.join(root_path, 'output', 'visualtests', 'baseline',76 'firefox_255.255.255.255')77 assert driver_wrapper.baseline_name == 'firefox_255.255.255.255'78 assert driver_wrapper.visual_baseline_directory == expected_baseline_directory79def test_update_visual_baseline_remote_node_empty(driver_wrapper):80 # Configure baseline81 driver_wrapper.config.set('VisualTests', 'baseline_name', 'firefox_{RemoteNode}')82 driver_wrapper.configure_visual_baseline()83 driver_wrapper.update_visual_baseline()84 expected_baseline_directory = os.path.join(root_path, 'output', 'visualtests', 'baseline', 'firefox_None')85 assert driver_wrapper.baseline_name == 'firefox_None'...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run toolium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful