123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- // Copyright 2021 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.
- #import "ios/chrome/browser/ui/context_menu/link_preview/link_preview_constants.h"
- #import "ios/showcase/test/showcase_eg_utils.h"
- #import "ios/showcase/test/showcase_test_case.h"
- #import "ios/testing/earl_grey/earl_grey_test.h"
- #if !defined(__has_feature) || !__has_feature(objc_arc)
- #error "This file requires ARC support."
- #endif
- namespace {
- using ::showcase_utils::Open;
- using ::showcase_utils::Close;
- }
- // Tests for the discover feed preview.
- @interface SCDiscoverFeedPreviewTestCase : ShowcaseTestCase
- @end
- @implementation SCDiscoverFeedPreviewTestCase
- - (void)setUp {
- [super setUp];
- Open(@"Link Preview");
- }
- - (void)tearDown {
- Close();
- [super tearDown];
- }
- // Tests that the Discover Feed Preview is correctly displaying.
- - (void)testDiscoverFeedPreview {
- // Check the URL bar is presented.
- [[EarlGrey
- selectElementWithMatcher:grey_allOf(grey_accessibilityID(
- kPreviewURLBarIdentifier),
- grey_sufficientlyVisible(), nil)]
- assertWithMatcher:grey_sufficientlyVisible()];
- // Check the origin is set correctly.
- [[EarlGrey
- selectElementWithMatcher:grey_allOf(grey_accessibilityID(
- kPreviewOriginIdentifier),
- grey_sufficientlyVisible(), nil)]
- assertWithMatcher:grey_text(@"test.url")];
- // Check the loading bar is presented.
- [[EarlGrey
- selectElementWithMatcher:grey_allOf(grey_accessibilityID(
- kPreviewProgressBarIdentifier),
- grey_sufficientlyVisible(), nil)]
- assertWithMatcher:grey_sufficientlyVisible()];
- // Check the page content view is presented.
- [[EarlGrey
- selectElementWithMatcher:grey_allOf(grey_accessibilityID(
- kPreviewWebStateViewIdentifier),
- grey_sufficientlyVisible(), nil)]
- assertWithMatcher:grey_sufficientlyVisible()];
- }
- @end
|