How to test Intent based on Espresso in Android?

oh man, finally after two days I found the solution. I Used hasComponent instead of toPackage and my test passed. I'm not sure my conclusion is right but seems for checking our application's activities (Components) we should use hasComponent method.

So my change is:

intended(allOf(
                hasExtra(PoiActivity.EXTRA_SEARCH_TYPE, PlacesAPIRequest.PARAM_SEARCH_TYPE_DESTINATION),
                hasComponent("com.XXX.passenger.poi.PoiActivity")));