Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertProductAttributeIsConfigurable.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
10 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
11 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductNew;
14 use Magento\Mtf\Constraint\AbstractConstraint;
15 
19 class AssertProductAttributeIsConfigurable extends AbstractConstraint
20 {
29  public function processAssert(
30  CatalogProductAttribute $attribute,
31  ConfigurableProduct $assertProduct,
32  CatalogProductIndex $productGrid,
33  CatalogProductNew $newProductPage
34  ) {
35  $productGrid->open();
36  $productGrid->getGridPageActionBlock()->addProduct('configurable');
37  $productBlockForm = $newProductPage->getProductForm();
38  $productBlockForm->fill($assertProduct);
39  $productBlockForm->openSection('variations');
41  $variationsSection = $productBlockForm->getSection('variations');
42  $variationsSection->createConfigurations();
43  $attributesGrid = $variationsSection->getAttributeBlock()->getAttributesGrid();
44  \PHPUnit\Framework\Assert::assertTrue(
45  $attributesGrid->isRowVisible(['frontend_label' => $attribute->getFrontendLabel()]),
46  "Product attribute is absent on the product page."
47  );
48  }
49 
55  public function toString()
56  {
57  return 'Attribute label present on the product page in variations section.';
58  }
59 }