Hi ,
I have a question related to UI tests. I have added below rule in one of my tests.
@get:Rule
var composeTestRule = _createAndroidComposeRule_<MainActivity>()
I have a use case where the activity should be created on demand and not before the test starts. I tried updating the above rule to use ActivtyScenarioRule as below
@get:Rule
val composeTestRule = AndroidComposeTestRule(activityRule = ActivityTestRule(MainActivity::class.java, true, false), activityProvider = { it ->
* *return@AndroidComposeTestRule it.activity as MainActivity
})
And launching the activity using intent.
composeTestRule.activityRule.launchActivity(Intent(ApplicationProvider.getApplicationContext(), MainActivity::class.java))
However, I am not able to launch the activity successfully. Can someone let me know the right approach to handle this scenario?