Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertVideoConfigurableProductView.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Mtf\Client\BrowserInterface;
9 use Magento\Mtf\Fixture\InjectableFixture;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 use Magento\Catalog\Test\Page\Product\CatalogProductView;
12 
16 class AssertVideoConfigurableProductView extends AbstractConstraint
17 {
28  public function processAssert(
29  BrowserInterface $browser,
30  CatalogProductView $catalogProductView,
31  InjectableFixture $product,
32  $youtubeDataCode,
33  $vimeoDataCode,
34  $variation
35  ) {
36  //open product page
37  $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
38  // assert video and video data of configurable product is presented on page
39  \PHPUnit\Framework\Assert::assertTrue(
40  $catalogProductView->getViewBlock()->isVideoVisible(),
41  'Product video is not displayed on product view when it should.'
42  );
43  \PHPUnit\Framework\Assert::assertTrue(
44  $catalogProductView->getViewBlock()->checkVideoDataPresence($youtubeDataCode),
45  'Configurable product video data is not displayed on product view when it should.'
46  );
47  // select configurable product variation
48  $catalogProductView->getConfigurableAttributesBlock()->selectConfigurableOption($product, $variation);
49  // assert video and video data of simple product option is presented on page
50  \PHPUnit\Framework\Assert::assertTrue(
51  $catalogProductView->getViewBlock()->isVideoVisible(),
52  'Configurable product variation video is not displayed on product view when it should.'
53  );
54  \PHPUnit\Framework\Assert::assertTrue(
55  $catalogProductView->getViewBlock()->checkVideoDataPresence($vimeoDataCode),
56  'Configurable product variation video data is not displayed on product view when it should.'
57  );
58  }
59 
65  public function toString()
66  {
67  return 'Configurable product video and it variation video are displayed on product view.';
68  }
69 }
processAssert(BrowserInterface $browser, CatalogProductView $catalogProductView, InjectableFixture $product, $youtubeDataCode, $vimeoDataCode, $variation)