sc_discover_feed_preview_coordinator_egtest.mm 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #import "ios/chrome/browser/ui/context_menu/link_preview/link_preview_constants.h"
  5. #import "ios/showcase/test/showcase_eg_utils.h"
  6. #import "ios/showcase/test/showcase_test_case.h"
  7. #import "ios/testing/earl_grey/earl_grey_test.h"
  8. #if !defined(__has_feature) || !__has_feature(objc_arc)
  9. #error "This file requires ARC support."
  10. #endif
  11. namespace {
  12. using ::showcase_utils::Open;
  13. using ::showcase_utils::Close;
  14. }
  15. // Tests for the discover feed preview.
  16. @interface SCDiscoverFeedPreviewTestCase : ShowcaseTestCase
  17. @end
  18. @implementation SCDiscoverFeedPreviewTestCase
  19. - (void)setUp {
  20. [super setUp];
  21. Open(@"Link Preview");
  22. }
  23. - (void)tearDown {
  24. Close();
  25. [super tearDown];
  26. }
  27. // Tests that the Discover Feed Preview is correctly displaying.
  28. - (void)testDiscoverFeedPreview {
  29. // Check the URL bar is presented.
  30. [[EarlGrey
  31. selectElementWithMatcher:grey_allOf(grey_accessibilityID(
  32. kPreviewURLBarIdentifier),
  33. grey_sufficientlyVisible(), nil)]
  34. assertWithMatcher:grey_sufficientlyVisible()];
  35. // Check the origin is set correctly.
  36. [[EarlGrey
  37. selectElementWithMatcher:grey_allOf(grey_accessibilityID(
  38. kPreviewOriginIdentifier),
  39. grey_sufficientlyVisible(), nil)]
  40. assertWithMatcher:grey_text(@"test.url")];
  41. // Check the loading bar is presented.
  42. [[EarlGrey
  43. selectElementWithMatcher:grey_allOf(grey_accessibilityID(
  44. kPreviewProgressBarIdentifier),
  45. grey_sufficientlyVisible(), nil)]
  46. assertWithMatcher:grey_sufficientlyVisible()];
  47. // Check the page content view is presented.
  48. [[EarlGrey
  49. selectElementWithMatcher:grey_allOf(grey_accessibilityID(
  50. kPreviewWebStateViewIdentifier),
  51. grey_sufficientlyVisible(), nil)]
  52. assertWithMatcher:grey_sufficientlyVisible()];
  53. }
  54. @end