/**
  * Assert prices on the shopping Cart
  *
  * @param CatalogProductConfigurable $configurable
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 protected function assertOnShoppingCart(CatalogProductConfigurable $configurable, CheckoutCart $checkoutCart)
 {
     /** @var \Magento\ConfigurableProduct\Test\Fixture\CatalogProductConfigurable\Price $priceFixture */
     $priceFixture = $configurable->getDataFieldConfig('price')['source'];
     $pricePresetData = $priceFixture->getPreset();
     $price = $checkoutCart->getCartBlock()->getProductPriceByName($configurable->getName());
     \PHPUnit_Framework_Assert::assertEquals($pricePresetData['cart_price'], $price, 'Product price in shopping cart is not correct.');
 }
Пример #2
0
 /**
  * Choose affected attribute set
  *
  * @param CatalogProductConfigurable $fixture
  */
 public function chooseAttributeSet(CatalogProductConfigurable $fixture)
 {
     $attributeSetName = $fixture->getAttributeSetName();
     if ($attributeSetName) {
         $this->_rootElement->find($this->affectedAttributeSet)->click();
         $this->_rootElement->find($this->attributeSetName)->setValue($attributeSetName);
     }
     $this->_rootElement->find($this->confirmButton)->click();
 }
 /**
  * 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];
 }
 /**
  * Assert prices on the product view Page
  *
  * @param CatalogProductConfigurable $configurable
  * @param CatalogProductView $catalogProductView
  * @return void
  */
 protected function assertOnProductView(CatalogProductConfigurable $configurable, CatalogProductView $catalogProductView)
 {
     /** @var \Magento\ConfigurableProduct\Test\Fixture\CatalogProductConfigurable\Price $priceFixture */
     $priceFixture = $configurable->getDataFieldConfig('price')['source'];
     $pricePresetData = $priceFixture->getPreset();
     if (isset($pricePresetData['product_special_price'])) {
         $regularPrice = $catalogProductView->getViewBlock()->getProductPriceBlock()->getRegularPrice();
         \PHPUnit_Framework_Assert::assertEquals($pricePresetData['product_price'], $regularPrice, 'Product regular price on product view page is not correct.');
         $specialPrice = $catalogProductView->getViewBlock()->getProductPriceBlock()->getSpecialPrice();
         \PHPUnit_Framework_Assert::assertEquals($pricePresetData['product_special_price'], $specialPrice, 'Product special price on product view page is not correct.');
     } else {
         //Price verification
         $price = $catalogProductView->getViewBlock()->getProductPriceBlock($configurable->getName())->getPrice();
         \PHPUnit_Framework_Assert::assertEquals($price['price_regular_price'], $pricePresetData['product_price'], 'Product price on category page is not correct.');
     }
 }
Пример #5
0
 /**
  * Assert product availability in products grid
  *
  * @param CatalogProductConfigurable $configurable
  * @param CatalogProductIndex $productPageGrid
  * @return void
  */
 public function processAssert(CatalogProductConfigurable $configurable, CatalogProductIndex $productPageGrid)
 {
     $filter = ['sku' => $configurable->getSku()];
     $productPageGrid->open();
     \PHPUnit_Framework_Assert::assertTrue($productPageGrid->getProductGrid()->isRowVisible($filter), 'Product with sku \'' . $configurable->getSku() . '\' is absent in Products grid.');
 }