android / android/android-test
Espresso Intent recorder won't show email address when using Action_CHOOSER
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 342
- Avg merge
- 11h 29m
- Merged PRs (30d)
- 2
Description
Hello,
I am starting an activity using an intent as follows:
```
Intent emailSelectorIntent = new Intent(Intent.ACTION_SENDTO);
emailSelectorIntent.setData(Uri.parse("mailto:"));
final Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_EMAIL, "xyz@xyz.com");
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "");
emailIntent.putExtra(Intent.EXTRA_TEXT, "");
emailIntent.setSelector(emailSelectorIntent);
v.getContext().startActivity(Intent.createChooser(emailIntent, "Send Email"));
```
And when I tap on the send email link using espresso, I am seeing the recorded intent as below:
```
Recorded intents:
-Intent { act=android.intent.action.CHOOSER (has extras) } handling packages:[[android]], extras:[Bundle[{android.intent.extra.INTENT=Intent { act=android.intent.action.SEND (has extras) sel=act=android.intent.action.SENDTO dat=mailto:} }, android.intent.extra.TITLE=Send email}]])
```
And the following matcher works:
```
intended(allOf(hasAction(Intent.ACTION_CHOOSER),
hasExtra(is(Intent.EXTRA_INTENT), hasAction(Intent.ACTION_SEND)),
hasExtra(is(Intent.EXTRA_TITLE), is("Send email"))));
```
but...since my recorded intent doesn't have the email address, I couldn't test it while stubbing the intent using espresso-intents. Why is it not recording the email address? I am seeing it if I use **startActivity(intent)**, but not when using **Intent.createChooser** How can I fix this issue?
Thanks!
Contributor guide
Research direction
Reproduce the issue with the supplied ACTION_SEND, ACTION_SENDTO, and Intent.createChooser snippets, then inspect how Espresso Intents records the chooser's nested EXTRA_INTENT. Compare that result with direct startActivity(intent) recording. Done means the email address is preserved in the recorded or stubbed intent, or the issue clearly documents the limitation and its supported workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100