Ejemplo n.º 1
0
 /**
  * Assert configurable product, corresponds to the product in the cart
  *
  * @param CatalogProductView $catalogProductView
  * @param CatalogProductConfigurable $configurable
  * @param Browser $browser
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, CatalogProductConfigurable $configurable, Browser $browser, CheckoutCart $checkoutCart)
 {
     //Add product to cart
     $browser->open($_ENV['app_frontend_url'] . $configurable->getUrlKey() . '.html');
     $configurableData = $configurable->getConfigurableAttributesData();
     if (!empty($configurableData)) {
         $configurableOption = $catalogProductView->getCustomOptionsBlock();
         foreach ($configurableData['attributes_data'] as $attribute) {
             $configurableOption->selectProductCustomOption($attribute['title']);
         }
     }
     $catalogProductView->getViewBlock()->clickAddToCart();
     $this->assertOnShoppingCart($configurable, $checkoutCart);
 }
 /**
  * Run Delete used in configurable product attribute test
  *
  * @param CatalogProductConfigurable $product
  * @return array
  */
 public function test(CatalogProductConfigurable $product)
 {
     // Precondition
     $product->persist();
     /** @var CatalogProductAttribute $attribute */
     $attribute = $product->getConfigurableAttributesData()['attributes'][0];
     // Steps
     $this->attributeIndex->open();
     $this->attributeIndex->getGrid()->searchAndOpen(['attribute_code' => $attribute->getAttributeCode()]);
     $this->attributeNew->getPageActions()->delete();
     return ['attribute' => $attribute];
 }