Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertBundleOptionTitleOnStorefront.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Catalog\Test\Page\Product\CatalogProductView;
10 use Magento\Mtf\Client\BrowserInterface;
11 use Magento\Mtf\Constraint\AbstractConstraint;
12 use Magento\Mtf\Fixture\FixtureInterface;
13 use Magento\Cms\Test\Page\CmsIndex;
14 
18 class AssertBundleOptionTitleOnStorefront extends AbstractConstraint
19 {
31  public function processAssert(
32  CatalogProductView $catalogProductView,
33  CmsIndex $cmsIndex,
34  BrowserInterface $browser,
35  FixtureInterface $originalProduct,
36  array $stores,
37  array $optionTitles
38  ) {
39  $cmsIndex->open();
40  $cmsIndex->getLinksBlock()->waitWelcomeMessage();
41  foreach ($stores as $store) {
42  $cmsIndex->getStoreSwitcherBlock()->selectStoreView($store->getName());
43  $cmsIndex->getLinksBlock()->waitWelcomeMessage();
44  $browser->open($_ENV['app_frontend_url'] . $originalProduct->getUrlKey() . '.html');
45  $catalogProductView->getBundleViewBlock()->clickCustomize();
46  \PHPUnit\Framework\Assert::assertTrue(
47  $catalogProductView->getBundleViewBlock()->getBundleBlock()->isOptionVisible(
48  $optionTitles[$store->getStoreId()]
49  ),
50  sprintf(
51  'Option with title \'%s\' is missing in \'%s\' store view.',
52  $optionTitles[$store->getStoreId()],
53  $store->getName()
54  )
55  );
56  }
57  }
58 
64  public function toString()
65  {
66  return 'Option title is correct on product view page.';
67  }
68 }
processAssert(CatalogProductView $catalogProductView, CmsIndex $cmsIndex, BrowserInterface $browser, FixtureInterface $originalProduct, array $stores, array $optionTitles)