@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(); }
@Test @FlakyTest public void preview_isShowing() throws Exception { onView(withId(R.id.camera)) .perform(waitFor(1000)) .check(showingPreview()); }
@Test @FlakyTest public void showMapWhenTheActivityStarts() throws Exception { launchActivityWithPermissionsGranted(); onView(withId(R.id.map)).check(matches(isDisplayed())); }
@Test @FlakyTest public void showLocationInfoWhenTheActivityStartsAndHasALocationProvided() throws Exception { launchActivityWithPermissionsGranted(); wait300millis(); wait300millis(); assertLocationInfoIsShown(); }
@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(); }
@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())); }
@Test @FlakyTest public void notCrashWhenLaunchingActivityAndPermissionsAreNotGranted() throws Exception { launchActivityWithoutLocationAndPermissions(); wait300millis(); onView(withId(R.id.map)).check(matches(isDisplayed())); }
@Test @FlakyTest public void notCrashWhenPermissionsAreNotGrantedAndClickToFloatingAction() throws Exception { launchActivityWithoutLocationAndPermissions(); wait300millis(); onView(withId(R.id.btnFloatingAction)).perform(click()); }
@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))); }
@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())); }
@Test @FlakyTest public void preview_isShowing() throws Exception { onView(withId(com.google.android.cameraview.test.R.id.camera)) .perform(waitFor(1000)) .check(showingPreview()); }
@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))); }
@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; } } }
@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."); }
@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."); }