# DrawerActions

# DrawerActions

Artifact:[androidx.test.espresso:espresso-contrib](https://developer.android.com/jetpack/androidx/releases/test-espresso)  
[View Source](https://cs.android.com/search?q=file:androidx/test/espresso/contrib/DrawerActions.java+class:androidx.test.espresso.contrib.DrawerActions)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/test/espresso/contrib/DrawerActions "View this page in Java")

<br />

```
class DrawerActions
```

<br />

*** ** * ** ***

Espresso actions for using a[DrawerLayout](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout).

See[Navigation drawer design guide](http://developer.android.com/design/patterns/navigation-drawer.html)

## Summary

|                                              ### Public functions                                               |
|-----------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[ViewAction](https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewAction)`!` | [close](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#close())`()` Creates an action which closes the[DrawerLayout](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout)with gravity START.                                                                                                                                                                                                                                           |
| `java-static `[ViewAction](https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewAction)`!` | [close](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#close(int))`(gravity: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Creates an action which closes the[DrawerLayout](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout)with the gravity.                                                                                                                                                    |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                     | ~~[closeDrawer](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#closeDrawer(int))~~`(drawerLayoutId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` **This function is deprecated.** Use[close](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#close())with`perform`after matching a view. <br />                                                                                              |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                     | ~~[closeDrawer](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#closeDrawer(int,int))~~`(drawerLayoutId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, gravity: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` **This function is deprecated.** Use[open](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#open(int))with`perform`after matching a view. <br /> |
| `java-static `[ViewAction](https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewAction)`!` | [open](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#open())`()` Creates an action which opens the[DrawerLayout](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout)drawer with gravity START.                                                                                                                                                                                                                                       |
| `java-static `[ViewAction](https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewAction)`!` | [open](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#open(int))`(gravity: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Creates an action which opens the[DrawerLayout](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout)drawer with the gravity.                                                                                                                                                |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                     | ~~[openDrawer](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#openDrawer(int))~~`(drawerLayoutId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` **This function is deprecated.** Use[open](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#open())with`perform`after matching a view. <br />                                                                                                  |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                     | ~~[openDrawer](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#openDrawer(int,int))~~`(drawerLayoutId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, gravity: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` **This function is deprecated.** Use[open](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#open(int))with`perform`after matching a view. <br />   |
| `java-static `[ViewAction](https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewAction)`!` | [waitForClose](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#waitForClose())`()` Creates an action that will wait for the drawer to close.                                                                                                                                                                                                                                                                                                                                 |

## Public functions

### close

```
java-static fun close(): ViewAction!
```

Creates an action which closes the[DrawerLayout](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout)with gravity START. This method blocks until the drawer is fully closed. No operation if the drawer is already closed.  

### close

```
java-static fun close(gravity: Int): ViewAction!
```

Creates an action which closes the[DrawerLayout](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout)with the gravity. This method blocks until the drawer is fully closed. No operation if the drawer is already closed.  

### closeDrawer

```
java-static fun [closeDrawer](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#closeDrawer(int))(drawerLayoutId: Int): Unit
```
| **This function is deprecated.**   
|
Use[close](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#close())with`perform`after matching a view. This method will be removed in the next release.  

### closeDrawer

```
java-static fun [closeDrawer](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#closeDrawer(int,int))(drawerLayoutId: Int, gravity: Int): Unit
```
| **This function is deprecated.**   
|
Use[open](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#open(int))with`perform`after matching a view. This method will be removed in the next release.  

### open

```
java-static fun open(): ViewAction!
```

Creates an action which opens the[DrawerLayout](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout)drawer with gravity START. This method blocks until the drawer is fully open. No operation if the drawer is already open.  

### open

```
java-static fun open(gravity: Int): ViewAction!
```

Creates an action which opens the[DrawerLayout](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout)drawer with the gravity. This method blocks until the drawer is fully open. No operation if the drawer is already open.  

### openDrawer

```
java-static fun [openDrawer](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#openDrawer(int))(drawerLayoutId: Int): Unit
```
| **This function is deprecated.**   
|
Use[open](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#open())with`perform`after matching a view. This method will be removed in the next release.  

### openDrawer

```
java-static fun [openDrawer](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#openDrawer(int,int))(drawerLayoutId: Int, gravity: Int): Unit
```
| **This function is deprecated.**   
|
Use[open](https://developer.android.com/reference/kotlin/androidx/test/espresso/contrib/DrawerActions#open(int))with`perform`after matching a view. This method will be removed in the next release.  

### waitForClose

```
java-static fun waitForClose(): ViewAction!
```

Creates an action that will wait for the drawer to close. Use this in cases where the closing of the drawer is implicit, such as selecting an item in the drawer. No operation if the drawer is closed. This uses an idling resource to wait for close, so it will fail if it does not close within the idling resource timeout.