blob: 22989e9e1b57290ebe8d65fcbae49bba061e5d39 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.suggestions;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.longClick;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.chromium.chrome.test.BottomSheetTestRule.waitForWindowUpdates;
import android.support.test.filters.MediumTest;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.Restriction;
import org.chromium.chrome.browser.ntp.NtpUiCaptureTestData;
import org.chromium.chrome.browser.preferences.ChromePreferenceManager;
import org.chromium.chrome.browser.test.ScreenShooter;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
import org.chromium.chrome.test.BottomSheetTestRule;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.util.browser.suggestions.SuggestionsDependenciesRule;
import org.chromium.ui.test.util.UiRestriction;
/**
* Tests for the appearance of the tile suggestions in the home sheet.
*/
@DisabledTest(message = "https://crbug.com/805160")
@RunWith(ChromeJUnit4ClassRunner.class)
@Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) // ChromeHome is only enabled on phones
public class HomeSheetTilesUiCaptureTest {
@Rule
public BottomSheetTestRule mActivityRule = new BottomSheetTestRule();
@Rule
public SuggestionsDependenciesRule setupSuggestions() {
return new SuggestionsDependenciesRule(NtpUiCaptureTestData.createFactory());
}
@Rule
public ScreenShooter mScreenShooter = new ScreenShooter();
@Before
public void setup() throws InterruptedException {
ChromePreferenceManager.getInstance().writeBoolean(
ChromePreferenceManager.NTP_SIGNIN_PROMO_DISMISSED, true);
mActivityRule.startMainActivityOnBlankPage();
}
@Test
@MediumTest
@Feature({"UiCatalogue"})
public void testAppearance() {
mActivityRule.setSheetState(BottomSheet.SheetState.FULL, false);
waitForWindowUpdates();
mScreenShooter.shoot("Appearance");
}
@Test
@MediumTest
@Feature({"UiCatalogue"})
public void testContextMenu() {
mActivityRule.setSheetState(BottomSheet.SheetState.FULL, false);
waitForWindowUpdates();
onView(withText(NtpUiCaptureTestData.getSiteSuggestions().get(0).title))
.perform(longClick());
mScreenShooter.shoot("ContextMenu");
}
}