Detox icon indicating copy to clipboard operation
Detox copied to clipboard

Support for testing system web browser and Android Custom Tabs

Open crazyvan opened this issue 11 months ago • 4 comments

Description

Hi, I have an app which uses expo's AuthSession to authenticate users. Under the hood, on Android this uses Custom Tabs to open the browser and direct the user to the auth flow. Will Detox support testing this use case or is it outside the scope of the project? Thanks!

Your environment

Detox version: 20.18.5 React Native version: 0.71.12 Node version: 21.6.2 Device model: Pixel_8_Pro_API_34 OS: macOS 14.2.1 Test-runner (select one): jest

crazyvan avatar Mar 13 '24 16:03 crazyvan

@crazyvan, hi, could you elaborate more, please? It seems that we have now some feature parity between iOS/Android regarding web views, but I have a gut feeling that your problem is slightly more intricate than that.

noomorph avatar Mar 13 '24 19:03 noomorph

After opening the app, you're presented with a Log in button. On tap, Expo's AuthSession library is used to perform a browser based OAuth flow:

  • an instance of AuthRequest is created and configured.
  • eventually, a call to AuthRequest.promptAsync opens up a Custom Tab on Android which takes you to an auth provider log in page where you enter an email address and a one time password. I'm not able to fill in the inputs for these using Detox because they're not within a web view.
  • if the authentication is successful, the auth provider redirects back to the app which handles the redirect.

A more brief description of the flow can also be found here.

crazyvan avatar Mar 14 '24 09:03 crazyvan

Very similarly I have an App using Okta react native browser based authentication but cannot find if Detox supports testing screens behind such login.

konstantindt avatar Apr 02 '24 14:04 konstantindt

+1 I have exactly the same scenario as crazyvan. web.element doesn't see the webview.

bbialas avatar Apr 09 '24 20:04 bbialas