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 tags_include/tags_exact to be able to find elements of arbitrary classes such as XCUIElementTypeTextView #488

Closed
ncarroll-mdsol opened this issue Feb 10, 2017 · 5 comments
Milestone

Comments

@ncarroll-mdsol
Copy link

iOS offers a UITextView element that can be used to display multiline text with special formatting. From their docs:

You typically use a text view to display multiple lines of text, such as when displaying the body of a large text document.

This element comes across in the source with the class XCUIElementTypeTextView.
I think it's a reasonable expectation that the text() method would match these elements. However, currently only elements with class XCUIElementTypeStaticText are matched: https://github.com/appium/ruby_lib/blob/master/lib/appium_lib/ios/element/text.rb#L5

Thoughts? I looked around the code and it doesn't seem too difficult. I may give it a shot! I think to do it properly, some of the generic methods / helpers should be modified to take an array of class names, rather than a single class.

@KazuCocoa
Copy link
Member

Yes, currently text() only support XCUIElementTypeStaticText class since this methods had been only implemented against UIAStaticText before.

Do generic methods means like the following code?
(This example is only for XCUITest.)

# @param [String] value
# @param [Array[String]] *args
def tags_include(value, *args)
    visible_elements = args.flat_map(&:tags)
    elements_include visible_elements, value
end

# @param [String] value
# @param [Array[String]] *args
def tags_exact(value, *args)
    visible_elements = args.flat_map(&:tags)
    elements_exact visible_elements, value
end

tags() comes from https://github.com/appium/ruby_lib/blob/master/lib/appium_lib/ios/helper.rb#L332 .

@KazuCocoa KazuCocoa added this to the v9.3.3 milestone Feb 11, 2017
@KazuCocoa
Copy link
Member

I'll implement like the above helper as v9.3.3

@KazuCocoa KazuCocoa changed the title UITextView not found in ios text() method add tags_include/tags_exact to be able to find elements of arbitrary classes such as XCUIElementTypeTextView Feb 17, 2017
@KazuCocoa
Copy link
Member

KazuCocoa commented Feb 17, 2017

I added tags_include/tags_exact and change this issue's description

@ncarroll-mdsol
Copy link
Author

Awesome, looks fantastic! Thank you :)

@KazuCocoa
Copy link
Member

published ruby_lib 9.3.3

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

No branches or pull requests

2 participants