Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pressBack() is ignored in a Espresso Test

The Espresso's method pressBack() is totally ignored. I'm running the test on the emulator.

What I'm testing? Just calling an Activity, launching a second one, performing two backs, and checking that I'm out of the app.

like image 682
Roc Boronat Avatar asked Dec 14 '16 12:12

Roc Boronat


People also ask

What is espresso testing used for?

Espresso is a testing framework that helps developers write automation test cases for user interface (UI) testing. It has been developed by Google and aims to provide a simple yet powerful framework. It allows both black-box testing as well as testing of individual components during development cycles.

How do you check espresso visibility?

One simple way to check for a View or its subclass like a Button is to use method getVisibility from View class.


1 Answers

Use

import static android.support.test.espresso.Espresso.pressBack;

or

import static androidx.test.espresso.Espresso.pressBack;

instead of

import static android.support.test.espresso.action.ViewActions.pressBack;

like image 146
Roc Boronat Avatar answered Oct 17 '22 18:10

Roc Boronat