Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConfigurableProductVideoTest.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
9 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductNew;
10 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit;
14 use Magento\Mtf\TestCase\Injectable;
15 use Magento\Mtf\TestStep\TestStepFactory;
17 
31 class ConfigurableProductVideoTest extends Injectable
32 {
33  /* tags */
34  const TEST_TYPE = 'acceptance_test, extended_acceptance_test';
35  const MVP = 'yes';
36  /* end tags */
37 
43  private $productIndex;
44 
50  private $productNew;
51 
57  private $productEdit;
58 
64  private $testStepFactory;
65 
71  private $configData = null;
72 
79  public function __inject(
80  CatalogProductIndex $productIndex,
81  CatalogProductNew $productNew,
82  CatalogProductEdit $productEdit,
83  TestStepFactory $testStepFactory
84  ) {
85  $this->productIndex = $productIndex;
86  $this->productNew = $productNew;
87  $this->productEdit = $productEdit;
88  $this->testStepFactory = $testStepFactory;
89  }
90 
98  public function test(
99  CatalogProductSimple $simpleProductVideo,
101  AssertProductSaveMessage $assertCreateProducts,
102  $variation,
103  $configData = null
104  ) {
105  //Preconditions
106  $this->configData = $configData;
107  $this->testStepFactory->create(
108  SetupConfigurationStep::class,
109  ['configData' => $this->configData, 'flushCache' => true]
110  )->run();
111 
112  // Steps
113  $this->productIndex->open();
114  $this->productIndex->getGridPageActionBlock()->addProduct('configurable');
115  $this->productNew->getProductForm()->fill($product);
116  $this->productNew->getFormPageActions()->save($product);
117  $assertCreateProducts->processAssert($this->productEdit);
118 
119  $sku = $product->getConfigurableAttributesData()['matrix'][$variation]['sku'];
120  $this->productIndex->open();
121  $this->productIndex->getProductGrid()->searchAndOpen(['sku' => $sku]);
122  $this->productEdit->getProductForm()->fill($simpleProductVideo);
123  $this->productEdit->getFormPageActions()->save();
124  }
125 }
test(CatalogProductSimple $simpleProductVideo, ConfigurableProduct $product, AssertProductSaveMessage $assertCreateProducts, $variation, $configData=null)
__inject(CatalogProductIndex $productIndex, CatalogProductNew $productNew, CatalogProductEdit $productEdit, TestStepFactory $testStepFactory)