Skip to content

Commit

Permalink
PoA support for selenium 4 without desired capibilites (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmay-browserstack authored Oct 15, 2024
1 parent 90cae0b commit f422e73
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 25 deletions.
1 change: 0 additions & 1 deletion percy/lib/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class Cache:
system_bars = 'system_bars'
window_size = 'window_size'
viewport = 'viewport'
session_capabilities = 'session_capabilities'
capabilities = 'capabilities'
command_executor_url = 'command_executor_url'

Expand Down
3 changes: 1 addition & 2 deletions percy/lib/cli_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,11 @@ def post_failed_event(self, error):
log(e, on_debug=True)
return None

def post_poa_screenshots(self, name, session_id, command_executor_url, capabilities, desired_capabilities, options=None):
def post_poa_screenshots(self, name, session_id, command_executor_url, capabilities, options=None):
body = {
'sessionId': session_id,
'commandExecutorUrl': command_executor_url,
'capabilities': dict(capabilities),
'sessionCapabilites':dict(desired_capabilities),
'snapshotName': name,
'options': options
}
Expand Down
1 change: 0 additions & 1 deletion percy/lib/percy_automate.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def screenshot(self, name: str, **kwargs):
metadata.session_id,
metadata.command_executor_url,
metadata.capabilities,
metadata.session_capabilities,
{ **options, "ignore_region_elements": ignore_region_elements, "consider_region_elements" : consider_region_elements }
)
except Exception as e:
Expand Down
9 changes: 0 additions & 9 deletions percy/metadata/driver_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,3 @@ def capabilities(self):
Cache.set_cache(self.session_id, Cache.capabilities, caps)
return caps
return caps

@property
def session_capabilities(self):
session_caps = Cache.get_cache(self.session_id, Cache.session_capabilities)
if session_caps is None:
session_caps = dict(self.driver.desired_capabilities)
Cache.set_cache(self.session_id, Cache.session_capabilities, session_caps)
return session_caps
return session_caps
11 changes: 0 additions & 11 deletions tests/test_driver_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,3 @@ def test_capabilities(self):

self.mock_webdriver.capabilities = capabilities
self.assertDictEqual(self.metadata.capabilities, capabilities)

@patch('percy.lib.cache.Cache.CACHE', {})
def test_session_capabilities(self):
session_capabilities = {
'platform': 'chrome_android',
'browserVersion': '115.0.1',
'session_name': 'abc'
}

self.mock_webdriver.session_capabilities = session_capabilities
self.assertDictEqual(self.metadata.session_capabilities, session_capabilities)
1 change: 0 additions & 1 deletion tests/test_screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ def test_posts_screenshot_poa(self):
self.assertEqual(s1['sessionId'], driver.session_id)
self.assertEqual(s1['commandExecutorUrl'], driver.command_executor._url) # pylint: disable=W0212
self.assertEqual(s1['capabilities'], dict(driver.capabilities))
self.assertEqual(s1['sessionCapabilites'], dict(driver.desired_capabilities))
self.assertRegex(s1['client_info'], r'percy-appium-app/\d+')
self.assertRegex(s1['environment_info'][0], r'appium/\d+')
self.assertRegex(s1['environment_info'][1], r'python/\d+')
Expand Down

0 comments on commit f422e73

Please sign in to comment.