Java Code Examples for android.support.test.filters.FlakyTest

The following are top voted examples for showing how to use android.support.test.filters.FlakyTest. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Leku   File: LocationPickerActivityShould.java   View source code 7 votes vote down vote up
@Test
@Ignore("seems to be VERY flacky")
@FlakyTest
public void notCrashWhenLaunchingActivityAndRotatingTheScreenSeveralTimes() throws Exception {
  launchActivityWithPermissionsGranted();
  wait300millis();

  activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  assertLocationInfoIsShown();
  activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
  assertLocationInfoIsShown();
  activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  assertLocationInfoIsShown();
  activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
  assertLocationInfoIsShown();
}
 
Example 2
Project: PXLSRT   File: CameraViewTest.java   View source code 5 votes vote down vote up
@Test
@FlakyTest
public void preview_isShowing() throws Exception {
    onView(withId(R.id.camera))
            .perform(waitFor(1000))
            .check(showingPreview());
}
 
Example 3
Project: Leku   File: LocationPickerActivityShould.java   View source code 5 votes vote down vote up
@Test
@FlakyTest
public void showMapWhenTheActivityStarts() throws Exception {
  launchActivityWithPermissionsGranted();

  onView(withId(R.id.map)).check(matches(isDisplayed()));
}
 
Example 4
Project: Leku   File: LocationPickerActivityShould.java   View source code 5 votes vote down vote up
@Test
@FlakyTest
public void showLocationInfoWhenTheActivityStartsAndHasALocationProvided() throws Exception {
  launchActivityWithPermissionsGranted();
  wait300millis();
  wait300millis();

  assertLocationInfoIsShown();
}
 
Example 5
Project: Leku   File: LocationPickerActivityShould.java   View source code 5 votes vote down vote up
@Test
@Ignore("it needs the map to be shown, it probably means the maps api key")
@FlakyTest
public void showLocationInfoWhenClickingTheMapAndNewLocationIsSelected() throws Exception {
  launchActivityWithPermissionsGranted();
  onView(withId(R.id.map)).perform(click());
  wait300millis();

  assertLocationInfoIsShown();
}
 
Example 6
Project: Leku   File: LocationPickerActivityShould.java   View source code 5 votes vote down vote up
@Test
@FlakyTest
public void showSuggestedLocationListWhenATextSearchIsPerformed() throws Exception {
  launchActivityWithPermissionsGranted();
  wait300millis();
  onView(withId(R.id.leku_search)).perform(typeText("calle mallorca"));
  onView(withId(R.id.leku_search))
      .check(matches(hasImeAction(EditorInfo.IME_ACTION_SEARCH)))
      .perform(pressImeActionButton());
  wait300millis();
  wait300millis();
  wait300millis();

  onView(withId(R.id.resultlist)).check(matches(isDisplayed()));
}
 
Example 7
Project: Leku   File: LocationPickerActivityShould.java   View source code 5 votes vote down vote up
@Test
@FlakyTest
public void notCrashWhenLaunchingActivityAndPermissionsAreNotGranted() throws Exception {
  launchActivityWithoutLocationAndPermissions();
  wait300millis();

  onView(withId(R.id.map)).check(matches(isDisplayed()));
}
 
Example 8
Project: Leku   File: LocationPickerActivityShould.java   View source code 5 votes vote down vote up
@Test
@FlakyTest
public void notCrashWhenPermissionsAreNotGrantedAndClickToFloatingAction() throws Exception {
  launchActivityWithoutLocationAndPermissions();
  wait300millis();

  onView(withId(R.id.btnFloatingAction)).perform(click());
}
 
Example 9
Project: Leku   File: LocationPickerActivityShould.java   View source code 5 votes vote down vote up
@Test
@Ignore("seems to be VERY flacky")
@FlakyTest
public void hideStreetTextWhenALocationIsSelectedAndStreetTextViewIsHiddenByBundle() throws Exception {
  launchActivityWithPermissionsGranted();
  wait300millis();

  onView(withId(R.id.street)).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.INVISIBLE)));
}
 
Example 10
Project: Leku   File: LocationPickerActivityShould.java   View source code 5 votes vote down vote up
@Test
@FlakyTest
public void showStreetAndZipCodeTextWhenALocationIsSelected() throws Exception {
  launchActivityWithPermissionsGranted();
  wait300millis();

  onView(withId(R.id.city)).check(matches(isDisplayed()));
  onView(withId(R.id.zipCode)).check(matches(isDisplayed()));
}
 
Example 11
Project: SimpleCamera   File: CameraViewTest.java   View source code 5 votes vote down vote up
@Test
@FlakyTest
public void preview_isShowing() throws Exception {
    onView(withId(com.google.android.cameraview.test.R.id.camera))
            .perform(waitFor(1000))
            .check(showingPreview());
}
 
Example 12
Project: cameraview   File: CameraViewTest.java   View source code 5 votes vote down vote up
@Test
@FlakyTest
public void preview_isShowing() throws Exception {
    onView(withId(R.id.camera))
            .perform(waitFor(1000))
            .check(showingPreview());
}
 
Example 13
Project: iosched   File: SessionDetailActivity_InScheduleStarredSessionTest.java   View source code 5 votes vote down vote up
@Test
@FlakyTest // due to intent checking
public void submitFeedback_WhenClicked_IntentFired_Flaky() {
    // When clicking on the submit feedback button
    onView(withId(R.id.give_feedback_button)).perform(click());

    // Then the intent to open the feedback activity for that session is fired
    intended(CoreMatchers.allOf(
            hasComponent(SessionFeedbackActivity.class.getName()),
            hasAction(equalTo(Intent.ACTION_VIEW)),
            hasData(mSessionUri)));
}
 
Example 14
Project: akvo-caddisfly   File: CbtInstructions.java   View source code 5 votes vote down vote up
@Test
@FlakyTest
public void cbtInstructionsAll() {

    goToMainScreen();

    onView(withText("E.coli - Aquagenx CBT")).perform(click());

    takeScreenshot("ed4db0fd3386", -1);

    ViewInteraction appCompatButton2 = onView(
            allOf(withId(R.id.button_instructions), withText("Instructions"),
                    childAtPosition(
                            childAtPosition(
                                    withClassName(is("android.widget.LinearLayout")),
                                    1),
                            1),
                    isDisplayed()));
    appCompatButton2.perform(click());

    for (int i = 0; i < 17; i++) {

        try {
            takeScreenshot("ed4db0fd3386", i);

            onView(withId(R.id.image_pageRight)).perform(click());

        } catch (Exception e) {
            TestUtil.sleep(600);
            Espresso.pressBack();
            TestUtil.sleep(600);
            Espresso.pressBack();
            break;
        }
    }

}
 
Example 15
Project: AndroidRTC   File: PeerConnectionClientTest.java   View source code 4 votes vote down vote up
@Test
@FlakyTest
//@SmallTest
public void testVideoSourceRestart() throws InterruptedException {
  Log.d(TAG, "testVideoSourceRestart");
  loopback = true;

  MockRenderer localRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, LOCAL_RENDERER_NAME);
  MockRenderer remoteRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, REMOTE_RENDERER_NAME);

  pcClient = createPeerConnectionClient(localRenderer, remoteRenderer,
      createParametersForVideoCall(VIDEO_CODEC_VP8),
      createCameraCapturer(false /* captureToTexture */), null);

  // Wait for local SDP, rename it to answer and set as remote SDP.
  assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT));
  SessionDescription remoteSdp = new SessionDescription(
      SessionDescription.Type.fromCanonicalForm("answer"), localSdp.description);
  pcClient.setRemoteDescription(remoteSdp);

  // Wait for ICE connection.
  assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAIT_TIMEOUT));

  // Check that local and remote video frames were rendered.
  assertTrue("Local video frames were not rendered before video restart.",
      localRenderer.waitForFramesRendered(WAIT_TIMEOUT));
  assertTrue("Remote video frames were not rendered before video restart.",
      remoteRenderer.waitForFramesRendered(WAIT_TIMEOUT));

  // Stop and then start video source a few times.
  for (int i = 0; i < VIDEO_RESTART_ATTEMPTS; i++) {
    pcClient.stopVideoSource();
    Thread.sleep(VIDEO_RESTART_TIMEOUT);
    pcClient.startVideoSource();

    // Reset video renders and check that local and remote video frames
    // were rendered after video restart.
    localRenderer.reset(EXPECTED_VIDEO_FRAMES);
    remoteRenderer.reset(EXPECTED_VIDEO_FRAMES);
    assertTrue("Local video frames were not rendered after video restart.",
        localRenderer.waitForFramesRendered(WAIT_TIMEOUT));
    assertTrue("Remote video frames were not rendered after video restart.",
        remoteRenderer.waitForFramesRendered(WAIT_TIMEOUT));
  }
  pcClient.close();
  assertTrue(waitForPeerConnectionClosed(WAIT_TIMEOUT));
  Log.d(TAG, "testVideoSourceRestart done.");
}
 
Example 16
Project: AndroidRTC   File: PeerConnectionClientTest.java   View source code 4 votes vote down vote up
@Test
@FlakyTest
//@SmallTest
public void testCaptureFormatChange() throws InterruptedException {
  Log.d(TAG, "testCaptureFormatChange");
  loopback = true;

  MockRenderer localRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, LOCAL_RENDERER_NAME);
  MockRenderer remoteRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, REMOTE_RENDERER_NAME);

  pcClient = createPeerConnectionClient(localRenderer, remoteRenderer,
      createParametersForVideoCall(VIDEO_CODEC_VP8),
      createCameraCapturer(false /* captureToTexture */), null);

  // Wait for local SDP, rename it to answer and set as remote SDP.
  assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT));
  SessionDescription remoteSdp = new SessionDescription(
      SessionDescription.Type.fromCanonicalForm("answer"), localSdp.description);
  pcClient.setRemoteDescription(remoteSdp);

  // Wait for ICE connection.
  assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAIT_TIMEOUT));

  // Check that local and remote video frames were rendered.
  assertTrue("Local video frames were not rendered before camera resolution change.",
      localRenderer.waitForFramesRendered(WAIT_TIMEOUT));
  assertTrue("Remote video frames were not rendered before camera resolution change.",
      remoteRenderer.waitForFramesRendered(WAIT_TIMEOUT));

  // Change capture output format a few times.
  for (int i = 0; i < 2 * CAPTURE_FORMAT_CHANGE_ATTEMPTS; i++) {
    if (i % 2 == 0) {
      pcClient.changeCaptureFormat(WIDTH_VGA, HEIGHT_VGA, MAX_VIDEO_FPS);
    } else {
      pcClient.changeCaptureFormat(WIDTH_QVGA, HEIGHT_QVGA, MAX_VIDEO_FPS);
    }

    // Reset video renders and check that local and remote video frames
    // were rendered after capture format change.
    localRenderer.reset(EXPECTED_VIDEO_FRAMES);
    remoteRenderer.reset(EXPECTED_VIDEO_FRAMES);
    assertTrue("Local video frames were not rendered after capture format change.",
        localRenderer.waitForFramesRendered(WAIT_TIMEOUT));
    assertTrue("Remote video frames were not rendered after capture format change.",
        remoteRenderer.waitForFramesRendered(WAIT_TIMEOUT));
  }

  pcClient.close();
  assertTrue(waitForPeerConnectionClosed(WAIT_TIMEOUT));
  Log.d(TAG, "testCaptureFormatChange done.");
}