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

feat(iOS): support interactions with secured web-view elements. #4505

Merged
merged 33 commits into from
Jun 19, 2024

Conversation

asafkorem
Copy link
Contributor

No description provided.

@asafkorem asafkorem force-pushed the feat/secured-webview-testing branch from ba9145c to 5773022 Compare June 10, 2024 05:11
@asafkorem asafkorem force-pushed the feat/secured-webview-testing branch from c8589d8 to 539bc3d Compare June 17, 2024 07:13
@asafkorem asafkorem marked this pull request as ready for review June 17, 2024 07:14
@asafkorem asafkorem changed the title [wip] feat: support interactions with secured web-view elements. feat(iOS): support interactions with secured web-view elements. Jun 17, 2024
@@ -1112,6 +1112,31 @@ declare global {
* web.element(by.web.tag('mark'))
*/
tag(tagName: string): WebMatcher;

Copy link
Collaborator

Choose a reason for hiding this comment

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

I know this is an old discussion, but can't we actually afford to mix web elements and native matchers? This would be more reasonable than to say web.label (which would obviously refer to aria-label rather than XCUITest's own understanding of what label is).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Totally a reasonable idea. We already use the same names in most places, and semantically it's already under the web.element context, so it shouldn't add any confusion. Let's follow up on that. We might want to break it in Detox 21 or deprecate it sooner..

* @example
* web.element(by.web.value('hello'))
*/
value(value: string): WebMatcher;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds like <input value="..."> right? Why is it iOS-only, then? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should have it for Android as well. As soon as we rewrite the infra to use same JS code builder for Android + iOS, we'll have this API there as well. Right now, we just wrap Espresso on Android, and it doesn't have it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually, we don't have to wait and we can simply wrap runscript from the javascript side for Android and support it there as well, however there are many other things that can be done like this, and I prefer to keep it and do it properly for all

* @example
* web(by.web.type('textField')).asSecured()
*/
type(type: string): SecuredWebMatcher;
Copy link
Collaborator

Choose a reason for hiding this comment

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

How do you plan to solve issue that iOS and Android types are likely to be very different?

device.getPlatform() === 'ios' ? ... or ... how?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This uses the accessibility types from the iOS system level (see XCUITest, Accessibility Inspector). I believe the best approach will be to understand what heuristics we can use for Android accessibility types to classify different elements and come up with new shared types. At the moment, I prefer to simply expose the iOS types to avoid premature optimization. This is an experimental API, so once we have a good candidate to replace it, we'll do it.

@asafkorem asafkorem force-pushed the feat/secured-webview-testing branch from 5e5b66b to 4159f2a Compare June 18, 2024 05:15
@asafkorem asafkorem force-pushed the feat/secured-webview-testing branch 2 times, most recently from f9b5830 to ebc6400 Compare June 18, 2024 20:59
@asafkorem asafkorem force-pushed the feat/secured-webview-testing branch from ebc6400 to 6df8eeb Compare June 19, 2024 04:30
@asafkorem asafkorem merged commit f4c9955 into master Jun 19, 2024
7 checks passed
@asafkorem asafkorem deleted the feat/secured-webview-testing branch June 19, 2024 05:08
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.

[System] iOS: Support system-level interactions with in-app webviews.
2 participants