android / android/android-test
IntentsTestRule does not capture immediate intents
- Lingua principale
- Java
- Stelle
- 1.2k
- Fork
- 342
- Merge medio
- 11h 29m
- PR unite (30g)
- 2
Descrizione
### Description
When using IntentTestRule, Intents that get started immediately (for example from `onCreate` method of the tested activity) do not get matched.
### Steps to Reproduce
1. Create an activity that starts another activity in its `onCreate` method
2. Create test for that activity using `IntentsTestRule` that attempts to match start intent
3. Test will fail -
### Expected Results
Start of another activity should be recorded
### Actual Results
Intents will not detect any intents (error message will print out `Recorded intents:[]`)
### AndroidX Test and Android OS Versions
`espresso-intents` 3.1.1
`Android` 9
### Workaround
Workaround to the issue is simple: Create a copy of `IntentsTestRule` and initialize intents in `beforeActivityLaunched` instead of in `afterActivityLaunched`
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia leggendo IntentsTestRule e confrontando quando gli intent vengono inizializzati in beforeActivityLaunched rispetto a afterActivityLaunched. Riproduci un'Activity che avvia un'altra Activity da onCreate usando espresso-intents 3.1.1, quindi verifica che l'avvio venga registrato invece di produrre Recorded intents:[].
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- android, java
- Ambito
- mobile, testing
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100