How to use configure_visual_baseline method in toolium

Best Python code snippet using toolium_python

driver_wrapper.py

Source:driver_wrapper.py Github

copy

Full Screen

...60 self.config_properties_filenames = prop_filenames61 self.config.update_properties(os.environ)62 if behave_properties:63 self.config.update_properties(behave_properties)64 def configure_visual_baseline(self):65 baseline_name = self.config.get_optional('VisualTests', 'baseline_name', '{Driver_type}')66 for section in self.config.sections():67 for option in self.config.options(section):68 option_value = self.config.get(section, option)69 baseline_name = baseline_name.replace('{{{0}_{1}}}'.format(section, option), option_value)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'):...

Full Screen

Full Screen

test_driver_wrapper_baseline.py

Source:test_driver_wrapper_baseline.py Github

copy

Full Screen

...35 new_driver_wrapper.configure_properties()36 return new_driver_wrapper37def test_configure_visual_baseline_not_configured(driver_wrapper):38 driver_wrapper.config.remove_option('VisualTests', 'baseline_name')39 driver_wrapper.configure_visual_baseline()40 expected_baseline_directory = os.path.join(root_path, 'output', 'visualtests', 'baseline', 'firefox')41 assert driver_wrapper.baseline_name == 'firefox'42 assert driver_wrapper.visual_baseline_directory == expected_baseline_directory43def test_configure_visual_baseline_driver_type(driver_wrapper):44 driver_wrapper.config.set('VisualTests', 'baseline_name', '{Driver_type}')45 driver_wrapper.configure_visual_baseline()46 expected_baseline_directory = os.path.join(root_path, 'output', 'visualtests', 'baseline', 'firefox')47 assert driver_wrapper.baseline_name == 'firefox'48 assert driver_wrapper.visual_baseline_directory == expected_baseline_directory49def test_update_visual_baseline_platform_version(driver_wrapper):50 # Configure baseline and driver mock51 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