Commit 8fadc3e8 authored by Christian Dullweber's avatar Christian Dullweber Committed by Chromium LUCI CQ

Prevent flaky PageInfo subpage test

Sometimes the render test takes a screenshot before the subpage is
displayed. Prevent this failure by waiting for an element on the
subpage to be loaded. Since the subpages are Preference fragments,
we can't wait for a specific id. Instead a text fragment on the page
is used as selector.

Bug: 1156285
Change-Id: I4b1243307bfd648e56bf618c03a6622a824f5336
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2578956
Commit-Queue: Christian Dullweber <dullweber@chromium.org>
Commit-Queue: Balazs Engedy <engedy@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834686}
parent 8b9e72e6
......@@ -358,6 +358,9 @@ public class PageInfoViewTest {
mActivityTestRule.startMainActivityOnBlankPage();
loadUrlAndOpenPageInfo(mTestServerRule.getServer().getURL(sSimpleHtml));
onView(withId(R.id.page_info_connection_row)).perform(click());
onViewWaiting(
allOf(withText(containsString("Test Root CA issued this website's certificate.")),
isDisplayed()));
mRenderTestRule.render(getPageInfoView(), "PageInfo_ConnectionInfoSubpage");
}
......@@ -373,6 +376,7 @@ public class PageInfoViewTest {
addSomePermissions(mTestServerRule.getServer().getURL("/"));
loadUrlAndOpenPageInfo(mTestServerRule.getServer().getURL(sSimpleHtml));
onView(withId(R.id.page_info_permissions_row)).perform(click());
onViewWaiting(allOf(withText("Control this site's access to your device"), isDisplayed()));
mRenderTestRule.render(getPageInfoView(), "PageInfo_PermissionsSubpage");
}
......@@ -383,12 +387,13 @@ public class PageInfoViewTest {
@MediumTest
@Feature({"RenderTest"})
@Features.EnableFeatures(PageInfoFeatureList.PAGE_INFO_V2)
@FlakyTest(message = "https://crbug.com/1156285")
public void testShowCookiesSubpage() throws IOException {
mActivityTestRule.startMainActivityOnBlankPage();
setThirdPartyCookieBlocking(CookieControlsMode.BLOCK_THIRD_PARTY);
loadUrlAndOpenPageInfo(mTestServerRule.getServer().getURL(sSimpleHtml));
onView(withId(R.id.page_info_cookies_row)).perform(click());
onViewWaiting(allOf(
withText(containsString("Cookies and other site data are used")), isDisplayed()));
mRenderTestRule.render(getPageInfoView(), "PageInfo_CookiesSubpage");
}
......@@ -402,7 +407,6 @@ public class PageInfoViewTest {
public void testNoPermissionsSubpage() throws IOException {
mActivityTestRule.startMainActivityOnBlankPage();
loadUrlAndOpenPageInfo(mTestServerRule.getServer().getURL(sSimpleHtml));
View dialog = (View) getPageInfoView().getParent();
onView(withId(R.id.page_info_permissions_row))
.check(matches(withEffectiveVisibility(GONE)));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment