-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Sync implementation #87
Conversation
percy/lib/cli_wrapper.py
Outdated
@@ -42,13 +42,13 @@ def is_percy_enabled(): | |||
log(e, on_debug=True) | |||
return False | |||
|
|||
def post_screenshots(self, name, tag, tiles, external_debug_url=None, ignored_elements_data=None, considered_elements_data=None): | |||
body = self._request_body(name, tag, tiles, external_debug_url, ignored_elements_data, considered_elements_data) | |||
def post_screenshots(self, name, tag, tiles, external_debug_url=None, ignored_elements_data=None, considered_elements_data=None, sync=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't pass default value for sync
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
passed None
percy/lib/cli_wrapper.py
Outdated
@@ -65,7 +65,7 @@ def post_failed_event(self, error): | |||
"errorKind": 'sdk' | |||
} | |||
|
|||
response = requests.post(f'{PERCY_CLI_API}/percy/events', json=body, timeout=30) | |||
response = requests.post(f'{PERCY_CLI_API}/percy/events', json=body, timeout=600) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why increase timeout here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
percy/lib/cli_wrapper.py
Outdated
@@ -77,36 +77,38 @@ 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, desired_capabilities, options=None, sync=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove default value for sync
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default to None
percy/lib/percy_automate.py
Outdated
@@ -39,16 +40,18 @@ def screenshot(self, name: str, **kwargs): | |||
|
|||
ignore_region_elements = [element.id for element in options.get(IGNORE_ELEMENT_KEY, [])] | |||
consider_region_elements = [element.id for element in options.get(CONSIDER_ELEMENT_KEY, [])] | |||
sync = options.get(SYNC, False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove default value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None
percy/providers/app_automate.py
Outdated
@@ -15,6 +15,7 @@ def supports(remote_url) -> bool: | |||
|
|||
def screenshot(self, name: str, **kwargs): | |||
session_details = self.execute_percy_screenshot_begin(name) | |||
sync = kwargs.get('sync', False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None
driver.command_executor._url = 'https://hub-cloud.browserstack.com/wd/hub' | ||
self.mock_webdriver.capabilities = { 'key': 'value' } | ||
|
||
self.assertEqual(percy_screenshot(driver, 'Snapshot 3', options = {'sync': True}), 'sync-data') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use variable for assertion matching not hardcoded value
def mock_poa_screenshot(fail=False): | ||
def mock_poa_screenshot(fail=False, sync=False): | ||
body = '{ "success": ' + ("true" if not fail else 'false, "error": "test"') + "}" | ||
if sync: body = '{ "success": "true", "data": "sync-data" }' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally this should be closer to actual data object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blind approve as app percy owner
Adding Sync implementation