[android-components](../../index.md) / [mozilla.components.support.android.test.espresso](../index.md) / [androidx.test.espresso.ViewInteraction](index.md) / [assertHasFocus](./assert-has-focus.md)

# assertHasFocus

`fun ViewInteraction.assertHasFocus(hasFocus: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`): ViewInteraction` [(source)](https://github.com/mozilla-mobile/android-components/blob/master/components/support/android-test/src/main/java/mozilla/components/support/android/test/espresso/ViewInteraction.kt#L24)

Asserts the View has focus or does not have focus based on the Boolean argument.

