Giter Site home page Giter Site logo

Comments (7)

GoogleCodeExporter avatar GoogleCodeExporter commented on May 21, 2024
I see this intermittently as well. It takes away some of the reliability of the 
tests, unfortunately. The best I've come up with was to create a custom 
ViewAction as the rollback that what does is basically wait for 
android.R.integer.config_longAnimTime. Although this makes the problem go away 
I don't really want to do this kind of hacking.

Original comment by [email protected] on 7 Mar 2014 at 4:33

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 21, 2024
Please, fix the issue. My tests fail randomly 

Original comment by [email protected] on 23 Jul 2014 at 3:00

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 21, 2024
Yup I am experiencing this problem as well. I have a case that I can reproduce 
100% of the time using the Nexus 4 or Samsung Nexus

Create a share intent and then try and perform a click on the dialog that is 
shown. The long click is performed and so this opens up the settings page for 
that particular app. This line has the problem

        onView(withText("Gmail")).perform(click());


Original comment by [email protected] on 19 Sep 2014 at 2:22

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 21, 2024
[deleted comment]

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 21, 2024
Can you try using the click method which accepts a RollBack action incase it 
turns into a longClick? 

onView(withText("Gmail")).perform(click(Espresso.pressBack())); 


-----From ViewActions.java -----
 /**
   * Returns an action that performs a single click on the view.
   *
   * If the click takes longer than the 'long press' duration (which is possible) the provided
   * rollback action is invoked on the view and a click is attempted again.
   *
   * This is only necessary if the view being clicked on has some different behaviour for long press
   * versus a normal tap.
   *
   * For example - if a long press on a particular view element opens a popup menu -
   * ViewActions.pressBack() may be an acceptable rollback action.
   *
   * <br>
   * View constraints:
   * <ul>
   * <li>must be displayed on screen</li>
   * <li>any constraints of the rollbackAction</li>
   * <ul>
   */
  public static ViewAction click(ViewAction rollbackAction) {
    checkNotNull(rollbackAction);
    return new GeneralClickAction(Tap.SINGLE, GeneralLocation.CENTER, Press.FINGER,
        rollbackAction);
  }

Original comment by [email protected] on 19 Sep 2014 at 2:29

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 21, 2024
We've been using doubleClick instead of click when Espresso decides to 
longPress. It's a good way to get a faster click to avoid triggering a 
longPress. However, if your app is already using double click actions, this may 
not be a good solution.

Original comment by [email protected] on 5 May 2015 at 4:29

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 21, 2024
I think the click action that takes a rollback action is probably the best 
solution most of the time, but it might not be enough for all scenarios.  I 
wrote a custom view action for scenarios where a rollback action didn't resolve 
my problems.  It's definitely not the "Espresso" way, but flaky tests need to 
be resolved and this has worked for me: 
https://gist.github.com/jabKnowsNothing/fe34673419500dcc6fc9.

Original comment by [email protected] on 19 May 2015 at 9:11

from android-test-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.