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

fix: Properly fetch view interaction if it was found under a root #824

Merged
merged 6 commits into from
Oct 14, 2022

Conversation

mykola-mokhnach
Copy link
Contributor

Addresses #821 (comment)

} catch (e: PerformException) {
// Perform Exception means nothing was found. Return empty list
emptyList()
}
}
Strategy.VIEWMATCHER -> {
val matcherJson = selector.toJsonMatcher()
views = try {
return try {
@Suppress("UNCHECKED_CAST")
getViews(root, matcherJson.query.matcher as Matcher<View>, findOne, matcherJson.query.scope as Matcher<Root>)

Choose a reason for hiding this comment

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

Shouldn't this scope be nullable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is nullable. Does something looks suspicious here?

Copy link

@Scrubles Scrubles Oct 13, 2022

Choose a reason for hiding this comment

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

If I not mistaken the cast should be Matcher<Root>?, when the scope is null it will throw an Exception

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should work just fine, as? is needed to do cast from types other than null: https://stackoverflow.com/questions/50836017/safe-cast-vs-cast-to-nullable

Copy link
Member

@KazuCocoa KazuCocoa left a comment

Choose a reason for hiding this comment

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

Maybe we can revert the test code change right now (until figured out this change was expected or not)

@mykola-mokhnach
Copy link
Contributor Author

ok, I'll revert the change. This is anyway an unrelated issue

@mykola-mokhnach mykola-mokhnach merged commit deeb296 into appium:master Oct 14, 2022
@mykola-mokhnach mykola-mokhnach deleted the in_root branch October 14, 2022 09:45
github-actions bot pushed a commit that referenced this pull request Oct 15, 2022
# [2.12.0](v2.11.0...v2.12.0) (2022-10-15)

### Bug Fixes

* Properly fetch view interaction if it was found under a root ([#824](#824)) ([deeb296](deeb296))

### Features

* Add scope support to data matchers ([#825](#825)) ([fd2c747](fd2c747))
@github-actions
Copy link

🎉 This PR is included in version 2.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants