calabash / calabash-ios

Calabash for iOS
Other
1.81k stars 369 forks source link

Unable to test OAuthlogin with SFSafariViewController #1387

Open joshuac94 opened 6 years ago

joshuac94 commented 6 years ago

Hi,

I am currently using Calabash-0.21.5 & Xcode-9.2 for Smoke testing my app. I have an OAuth login flow that presents an SFSafariViewController to enter the user's credentials and login.

Is it possible to access the elements within the SFSafariView to enter the credentials. I have access to the login page's DOM tree when using Web Dev tools in Chrome.

The actual SafariView has no children, so I cannot access the content within the initial page. I cannot use the "enter_text" method as the email field has no id.

jmoody commented 6 years ago

Use device_agent methods.

https://github.com/calabash/ios-webview-test-app/blob/master/CalWebViewApp/features/steps/safari_steps.rb#L11

https://github.com/calabash/calabash-ios/blob/develop/calabash-cucumber/lib/calabash-cucumber/device_agent.rb