Skip to content

add datamatcher - #335

Merged
KazuCocoa merged 13 commits into
appium:masterfrom
KazuCocoa:add_datamatcher
Feb 18, 2019
Merged

add datamatcher#335
KazuCocoa merged 13 commits into
appium:masterfrom
KazuCocoa:add_datamatcher

Conversation

@KazuCocoa

Copy link
Copy Markdown
Member

No description provided.

Comment thread appium/webdriver/webdriver.py Outdated
Comment thread appium/webdriver/webdriver.py Outdated
Comment thread appium/webdriver/extensions/search_context.py
Comment thread appium/webdriver/extensions/search_context.py Outdated
Comment thread test/unit/webdriver/webelement_test.py Outdated
Comment thread appium/webdriver/extensions/search_context.py Outdated
Comment thread appium/webdriver/webelement.py Outdated
Comment thread test/unit/webdriver/webelement_test.py Outdated
Comment thread test/unit/webdriver/webdriver_test.py Outdated
def _build_data_matcher(self, name=None, args=None, className=None):
result = {}

for key, value in {'name': name, 'args': args, 'class': className}.items():

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Python 3 has only items()


return json.dumps(result)

def find_element(self, by=None, value=None):

@mykola-mokhnach mykola-mokhnach Feb 17, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

are these dummy methods needed?

raise NotImplementedError


class WebDriverSearchContext(webdriver.Remote,

@mykola-mokhnach mykola-mokhnach Feb 17, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is still data matcher search context. How we are going to represent this if more search contexts are moved to extensions?

@mykola-mokhnach mykola-mokhnach Feb 17, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

how about these would be named as AndroidDriverDataMatcherSearchContext and AndroidElementDataMatcherSearchContext?

@KazuCocoa KazuCocoa Feb 17, 2019

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I came up with like below. AndroidSearchContext will have data matcher, view tag and uiautomator, for example 👀

class WebDriverSearchContext(webdriver.Remote,
                             GeneralSearchContext,
                             AndroidSearchContext,
                             IOSSearchContext,
                             WindowsSearchContext,
                             TizenSearchContext):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd rather say this is AppiumSearchContext

raise NotImplementedError


class CommonSearchContext(RootSearchContext):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this class is not needed for now

from appium.webdriver.common.mobileby import MobileBy


class RootSearchContext(object):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

BaseSearchContext

return json.dumps(result)


class IOSSearchContext(RootSearchContext):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

these empty classes are also not needed for now. We'll create them when there will be a need

@mykola-mokhnach

Copy link
Copy Markdown
Contributor

We could also create a task to refactor the other search context and move them to extensions. Just not to forget and to make it visible to other maintainers

@KazuCocoa
KazuCocoa merged commit 1c179d2 into appium:master Feb 18, 2019
@KazuCocoa
KazuCocoa deleted the add_datamatcher branch February 18, 2019 08:03
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.

2 participants