Skip to content
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

Add execute driver #406

Merged
merged 7 commits into from
Jun 26, 2019
Merged

Add execute driver #406

merged 7 commits into from
Jun 26, 2019

Conversation

KazuCocoa
Copy link
Member

Waiting for appium/appium-base-driver#328

Added execute_driver as the new feature.

You can try the feature as $ pytest test/functional/ios/execute_driver_tests.py after applying the base driver PR on your local. I'll update this PR if something changes in the base driver PR.

@KazuCocoa KazuCocoa requested a review from ki4070ma June 21, 2019 16:45

class ExecuteDriver(webdriver.Remote):

def execute_driver(self, script, script_type='webdriverio', timeout=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timeout_ms might be a better arg name

self.driver.quit()

def test_batch(self):
script = """
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.driver.execute_driver(script='return [];', script_type='webdriverio', timeout=10000)

Return:
Dir[str, any]: The result of the script. It has 'result' and 'logs' keys.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dir -> Dict?

self.driver.execute_driver(script='return [];', script_type='webdriverio')
self.driver.execute_driver(script='return [];', script_type='webdriverio', timeout=10000)

Return:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

d = get_httpretty_request_body(httpretty.last_request())
assert d['script'] == script
assert d['type'] == 'webdriverio'
assert 'timeout' not in d
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'timeout' not in d.keys() ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current way is fine

>>> d = {'timeout': 1}
>>> 'timeout' in d
True
>>> 'timeout' in d.keys()
True

"""

result = self.driver.execute_driver(script=textwrap.dedent(script))
r = result.result[0].rect
Copy link
Contributor

@mykola-mokhnach mykola-mokhnach Jun 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I's say it is a bit confusing to have result.result mapping. What if we rename the retuned variable to response ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same below

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah. Nice. Yeah, I forgot re-naming it

@KazuCocoa KazuCocoa merged commit 0368b5a into appium:master Jun 26, 2019
@KazuCocoa KazuCocoa deleted the add-execute-driver branch June 26, 2019 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants