Skip to content

Commit

Permalink
Fix test cases to compatible with CAF receiver and different Android …
Browse files Browse the repository at this point in the history
…phones

Change-Id: I76fa8da4c00220dd87d3cb16f7ec50c46161b3fe
  • Loading branch information
meihua committed Apr 9, 2019
1 parent 502383f commit b5a87a1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public void testMiniController() throws InterruptedException, UiObjectNotFoundEx

mTestUtils.verifyMiniController();

mDevice.pressEnter();
onView(withId(R.id.cast_mini_controller))
.perform(click());

Expand Down Expand Up @@ -172,6 +173,7 @@ public void testNotification() throws UiObjectNotFoundException, InterruptedExce
mTestUtils.verifyExpandedController();

mDevice.pressBack();
mDevice.pressEnter();
mTestUtils.disconnectFromCastDevice();
}
}
19 changes: 9 additions & 10 deletions androidTest/com/google/sample/cast/refplayer/QueueingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,7 @@ public void testQueuePlayback() throws UiObjectNotFoundException, InterruptedExc
.check(matches(isDisplayed()))
.check(matches(isEnabled()));

// Verify queue items (media status) in correct order
mDevice.pressBack();
onView(withId(R.id.action_show_queue))
.check(matches(isDisplayed())).perform(click());
mTestUtils.assertQueueOrder(VIDEO_ITEM_3, VIDEO_ITEM_1, VIDEO_ITEM_2);

// Open expanded controller and click to play next item
mDevice.pressBack();
onView(withId(R.id.cast_mini_controller)).perform(click());
// Click to play next item
mDevice.findObject(new UiSelector().description("Skip to next item")).click();
mTestUtils.assertPlayerState(MediaStatus.PLAYER_STATE_PLAYING, MAX_TIMEOUT_MS);

Expand All @@ -109,6 +101,13 @@ public void testQueuePlayback() throws UiObjectNotFoundException, InterruptedExc
.check(matches(isDisplayed()))
.check(matches(isEnabled()));

// Verify queue items (media status) in correct order
mDevice.pressBack();
onView(withId(R.id.action_show_queue))
.check(matches(isDisplayed())).perform(click());
mTestUtils.assertQueueOrder(VIDEO_ITEM_3, VIDEO_ITEM_1, VIDEO_ITEM_2);

mDevice.pressEnter();
mTestUtils.disconnectFromCastDevice();
}

Expand All @@ -127,7 +126,7 @@ private void createQueue() throws UiObjectNotFoundException, InterruptedExceptio
mDevice.findObject(new UiSelector().text(VIDEO_ITEM_2)).click();
mDevice.findObject(
new UiSelector().resourceId(resources.getResourceName(R.id.play_circle))).click();
mDevice.findObject(new UiSelector().text("Add to Queue")).click();
mDevice.findObject(new UiSelector().text("Play Next")).click();

mDevice.findObject(new UiSelector().description("Navigate up")).click();

Expand Down
3 changes: 2 additions & 1 deletion androidTest/com/google/sample/cast/refplayer/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ void assertCaption(boolean enabled) {
if (enabled) {
assertNotNull(mMediaStatus.getActiveTrackIds());
} else {
assertNull(mMediaStatus.getActiveTrackIds());
assertTrue(mMediaStatus.getActiveTrackIds() == null
|| mMediaStatus.getActiveTrackIds().length == 0);
}
}

Expand Down

0 comments on commit b5a87a1

Please sign in to comment.