For a view with rotation perform(click()) doesn't work in espresso ui test

I think setRotation may have confused click() and coordinates calculation. If that's the case, you could either remove android:rotation then rotate the image physically, or try to create a custom click action:

public static ViewAction forceClick() {
    return new ViewAction() {
        @Override public Matcher<View> getConstraints() {
            return allOf(isClickable(), isEnabled());
        }

        @Override public String getDescription() {
            return "force click";
        }

        @Override public void perform(UiController uiController, View view) {
            view.performClick();
            uiController.loopMainThreadUntilIdle();
        }
    };
}

This action performs click on the view by invoking performClick() without finding its coordinates. But make sure the view has the click listener attached in the app:

onView(withId(R.id.toolbar_navigation_btn)).perform(forceClick());