/**
  * Check whether the attribute filter is displayed on the frontend in Layered navigation.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param InjectableFixture $product
  * @param CatalogProductAttribute $attribute
  * @param CmsIndex $cmsIndex
  * @param FixtureFactory $fixtureFactory
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, InjectableFixture $product, CatalogProductAttribute $attribute, CmsIndex $cmsIndex, FixtureFactory $fixtureFactory)
 {
     $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'product_with_category_with_anchor', 'data' => ['category_ids' => ['presets' => null, 'category' => $product->getDataFieldConfig('category_ids')['source']->getCategories()[0]]]])->persist();
     $cmsIndex->open()->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]);
     $label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel();
     \PHPUnit_Framework_Assert::assertTrue(in_array($label, $catalogCategoryView->getLayeredNavigationBlock()->getFilters()), 'Attribute is absent in layered navigation on category page.');
 }
 /**
  * Prepare product price from fixture.
  *
  * @param InjectableFixture $product
  * @return float
  */
 protected function prepareFixturePrice(InjectableFixture $product)
 {
     /** @var CatalogProductSimple $product */
     $customOptions = $product->getCustomOptions();
     $checkoutData = $product->getCheckoutData();
     $checkoutCustomOptions = isset($checkoutData['options']['custom_options']) ? $checkoutData['options']['custom_options'] : [];
     if (isset($checkoutData['cartItem'])) {
         $fixturePrice = $checkoutData['cartItem']['price'];
     } else {
         $fixturePrice = $product->getPrice();
         $groupPrice = $product->getGroupPrice();
         $specialPrice = $product->getSpecialPrice();
         if ($groupPrice) {
             $groupPrice = reset($groupPrice);
             $fixturePrice = $groupPrice['price'];
         }
         if ($specialPrice) {
             $fixturePrice = $specialPrice;
         }
         foreach ($checkoutCustomOptions as $checkoutOption) {
             $attributeKey = str_replace('attribute_key_', '', $checkoutOption['title']);
             $optionKey = str_replace('option_key_', '', $checkoutOption['value']);
             $option = $customOptions[$attributeKey]['options'][$optionKey];
             if ('Fixed' == $option['price_type']) {
                 $fixturePrice += $option['price'];
             } else {
                 $fixturePrice += $fixturePrice / 100 * $option['price'];
             }
         }
     }
     return $fixturePrice;
 }
Ejemplo n.º 3
0
 /**
  * Get data of the tabs.
  *
  * @param InjectableFixture|null $fixture
  * @param Element|null $element
  * @return array
  *
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function getData(InjectableFixture $fixture = null, Element $element = null)
 {
     $data = [];
     if (null === $fixture) {
         foreach ($this->tabs as $tabName => $tab) {
             $this->openTab($tabName);
             $tabData = $this->getTabElement($tabName)->getDataFormTab();
             $data = array_merge($data, $tabData);
         }
     } else {
         $tabsFields = $fixture->hasData() ? $this->getFieldsByTabs($fixture) : [];
         $tabsFields['frontend_properties'] = array_merge_recursive($tabsFields['frontend_properties'], $tabsFields['settings']);
         unset($tabsFields['settings']);
         foreach ($tabsFields as $tabName => $fields) {
             $this->openTab($tabName);
             if (isset($fields['widgetOptions'])) {
                 unset($fields['widgetOptions']['value']['type_id']);
                 $fields['widgetOptions'] = $fields['widgetOptions']['value'];
             } elseif (isset($fields['layout'])) {
                 $fields['layout'] = $fields['layout']['value'];
             }
             $tabData = $this->getTabElement($tabName)->getDataFormTab($fields, $this->_rootElement);
             $data = array_merge($data, $tabData);
         }
     }
     $data['type'] = $this->type[$data['type']];
     return $data;
 }
 /**
  * Assert that redirect from newCategory/oldProduct is correct to new product.
  *
  * @param InjectableFixture $product
  * @param InjectableFixture $initialProduct
  * @param Browser $browser
  * @param CatalogProductView $catalogProductView
  * @return void
  */
 public function processAssert(InjectableFixture $product, InjectableFixture $initialProduct, Browser $browser, CatalogProductView $catalogProductView)
 {
     $category = $product->getDataFieldConfig('category_ids')['source']->getProductCategory();
     $productUrl = $_ENV['app_frontend_url'] . $category->getUrlKey() . '/' . $initialProduct->getUrlKey() . '.html';
     $browser->open($productUrl);
     \PHPUnit_Framework_Assert::assertEquals($catalogProductView->getViewBlock()->getProductName(), strtoupper($product->getName()));
 }
 /**
  * Assert that duplicated product can be found in grid by type, template, status and stock status.
  *
  * @param InjectableFixture $product
  * @param CatalogProduct $productGrid
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProduct $productGrid)
 {
     $config = $product->getDataConfig();
     $filter = ['name' => $product->getName(), 'visibility' => $product->getVisibility(), 'status' => 'Disabled', 'type' => ucfirst($config['create_url_params']['type']) . ' Product', 'price_to' => number_format($product->getPrice(), 2)];
     $productGrid->open()->getProductGrid()->search($filter);
     \PHPUnit_Framework_Assert::assertTrue($productGrid->getProductGrid()->isRowVisible($filter, false, false), 'Product duplicate is absent in Products grid.');
 }
 /**
  * Get configurable product options.
  *
  * @param InjectableFixture|null $product [optional]
  * @return array
  * @throws \Exception
  */
 public function getOptions(InjectableFixture $product)
 {
     /** @var ConfigurableProduct $product */
     $attributesData = $product->hasData('configurable_options') ? $product->getConfigurableOptions()['attributes_data'] : [];
     $listOptions = $this->getListOptions();
     $result = [];
     foreach ($attributesData as $option) {
         $title = $option['label'];
         if (!isset($listOptions[$title])) {
             throw new \Exception("Can't find option: \"{$title}\"");
         }
         /** @var Element $optionElement */
         $optionElement = $listOptions[$title];
         $type = $option['frontend_input'];
         $option['frontend_input'] = explode('/', $option['frontend_input'])[1];
         $typeMethod = preg_replace('/[^a-zA-Z]/', '', $option['frontend_input']);
         $getTypeData = 'get' . ucfirst(strtolower($typeMethod)) . 'Data';
         $optionData = $this->{$getTypeData}($optionElement);
         $optionData['title'] = $title;
         $optionData['type'] = $type;
         $isRequire = $this->_rootElement->find(sprintf($this->required, $title), Locator::SELECTOR_XPATH)->isVisible();
         $optionData['is_require'] = $isRequire ? 'Yes' : 'No';
         $result[$title] = $optionData;
     }
     return $result;
 }
 /**
  * Get form prices.
  *
  * @param InjectableFixture $product
  * @param CatalogCategoryView $catalogCategoryView
  * @return array
  */
 protected function getFormPrices(InjectableFixture $product, CatalogCategoryView $catalogCategoryView)
 {
     $productPriceBlock = $catalogCategoryView->getListProductBlock()->getProductPriceBlock($product->getName());
     $actualPrices = ['regular' => $productPriceBlock->getRegularPrice(), 'special' => $productPriceBlock->getSpecialPrice()];
     $actualPrices['discount_amount'] = number_format($actualPrices['regular'] - $actualPrices['special'], 2);
     return $actualPrices;
 }
 /**
  * Assert that video is displayed on category page on Store front.
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param InjectableFixture $initialProduct
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, InjectableFixture $initialProduct)
 {
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategoryByName($initialProduct->getCategoryIds()[0]);
     $src = $catalogCategoryView->getListProductBlock()->getProductItem($initialProduct)->getBaseImageSource();
     \PHPUnit_Framework_Assert::assertFalse(strpos($src, '/placeholder/') !== false, 'Video preview image is not displayed on category view when it should.');
 }
 /**
  * Prepare tier price data.
  *
  * @param InjectableFixture $product
  * @return array
  */
 protected function prepareTierPrices(InjectableFixture $product)
 {
     $tierPrices = $product->getTierPrice();
     foreach ($tierPrices as $key => $tierPrice) {
         $tierPrices[$key]['price'] = number_format($tierPrices[$key]['price'], $this->priceFormat);
     }
     return $tierPrices;
 }
 /**
  * Assertion that the product is correctly displayed in cart.
  *
  * @param CatalogProductView $catalogProductView
  * @param InjectableFixture $product
  * @param Browser $browser
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, InjectableFixture $product, Browser $browser, CheckoutCart $checkoutCart)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     $checkoutData = $product->getCheckoutData();
     $price = $checkoutCart->getCartBlock()->getCartItem($product)->getCartItemTypePrice('price');
     \PHPUnit_Framework_Assert::assertEquals($checkoutData['cartItem']['price'], $price, 'Product price in shopping cart is not correct.');
 }
 /**
  * Assert that video data received from external service is correct.
  *
  * @param CatalogProductEdit $editProductPage
  * @param InjectableFixture $initialProduct
  * @param array $video
  * @return void
  */
 public function processAssert(CatalogProductEdit $editProductPage, InjectableFixture $initialProduct, array $video)
 {
     $editProductPage->open(['id' => $initialProduct->getId()]);
     $editProductPage->getProductForm()->openTab('images-and-videos');
     $imagesTab = $editProductPage->getProductForm()->getTab('images-and-videos');
     $result = $imagesTab->clickFirstVideo()->getVideoDialog()->validate($video);
     \PHPUnit_Framework_Assert::assertTrue($result, 'Video data received from external service is not correct.');
 }
 /**
  * Assert that video is not displayed in admin panel.
  *
  * @param CatalogProductIndex $productGrid
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(CatalogProductIndex $productGrid, InjectableFixture $product)
 {
     $filter = ['sku' => $product->getSku()];
     $productGrid->open();
     $productGrid->getProductGrid()->search($filter);
     $src = $productGrid->getProductGrid()->getBaseImageSource();
     \PHPUnit_Framework_Assert::assertTrue(strpos($src, '/placeholder/') !== false, 'Product image is displayed in product grid when it should not');
 }
 /**
  * Check whether there is an opportunity to compare products using given attribute.
  *
  * @param InjectableFixture $product
  * @param CatalogProductAttribute $attribute
  * @param BrowserInterface $browser
  * @param CatalogProductView $catalogProductView
  * @param CatalogProductCompare $catalogProductCompare
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProductAttribute $attribute, BrowserInterface $browser, CatalogProductView $catalogProductView, CatalogProductCompare $catalogProductCompare)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->clickAddToCompare();
     $catalogProductCompare->open();
     $label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel();
     \PHPUnit_Framework_Assert::assertTrue($catalogProductCompare->getCompareProductsBlock()->isAttributeVisible($label), 'Attribute is absent on product compare page.');
 }
 /**
  * Assert that Catalog Price Rule is applied for product(s) in Shopping Cart
  * according to Priority(Priority/Stop Further Rules Processing).
  *
  * @param InjectableFixture $product
  * @param CatalogProductView $pageCatalogProductView
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param CheckoutCart $pageCheckoutCart
  * @param array $prices
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProductView $pageCatalogProductView, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CheckoutCart $pageCheckoutCart, array $prices)
 {
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($product->getCategoryIds()[0]);
     $catalogCategoryView->getListProductBlock()->openProductViewPage($product->getName());
     $pageCatalogProductView->getViewBlock()->addToCart($product);
     $actualGrandTotal = $pageCheckoutCart->getCartBlock()->getCartItem($product)->getCartItemTypePrice('price');
     \PHPUnit_Framework_Assert::assertEquals($prices['grand_total'], $actualGrandTotal);
 }
Ejemplo n.º 15
0
 /**
  * Get element for item block.
  *
  * @param InjectableFixture $address
  * @param int $itemIndex
  * @return ElementInterface
  */
 protected function getItemBlockElement(InjectableFixture $address, $itemIndex)
 {
     $conditions = [];
     foreach ($this->addressFields as $field) {
         $conditions[] = "contains(., '{$address->getData($field)}')";
     }
     $itemBlockSelector = sprintf($this->itemBlock, implode(' and ', $conditions));
     return $this->_rootElement->find($itemBlockSelector, Locator::SELECTOR_XPATH);
 }
Ejemplo n.º 16
0
 /**
  * Get data of the tabs.
  *
  * @param InjectableFixture|null $fixture
  * @param Element|null $element
  * @return array
  */
 public function getData(InjectableFixture $fixture = null, Element $element = null)
 {
     $widgetType = $fixture->getWidgetOptions()['type_id'];
     if ($this->hasRender($widgetType)) {
         return $this->callRender($widgetType, 'getData', ['InjectableFixture' => $fixture, 'Element' => $element]);
     } else {
         return parent::getData($fixture, $element);
     }
 }
 /**
  * Assert that video data received from external service is correct.
  *
  * @param CatalogProductIndex $productGrid
  * @param CatalogProductEdit $editProductPage
  * @param InjectableFixture $product
  * @param array $video
  * @return void
  */
 public function processAssert(CatalogProductIndex $productGrid, CatalogProductEdit $editProductPage, InjectableFixture $product, array $video)
 {
     $productGrid->open();
     $productGrid->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
     $editProductPage->getProductForm()->openSection('images-and-videos');
     $imagesTab = $editProductPage->getProductForm()->getSection('images-and-videos');
     $result = $imagesTab->clickFirstVideo()->getVideoDialog()->validate($video);
     \PHPUnit_Framework_Assert::assertTrue($result, 'Video data received from external service is not correct.');
 }
 /**
  * Assert that product can be added to active gift registry from shopping cart.
  *
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param InjectableFixture $product
  * @param GiftRegistry $giftRegistry
  * @param GiftRegistryItems $giftRegistryItems
  * @param BrowserInterface $browser
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, InjectableFixture $product, GiftRegistry $giftRegistry, GiftRegistryItems $giftRegistryItems, BrowserInterface $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     $catalogProductView->getMessagesBlock()->waitSuccessMessage();
     $checkoutCart->open();
     $checkoutCart->getGiftRegistryBlock()->addToGiftRegistry($giftRegistry);
     \PHPUnit_Framework_Assert::assertTrue($giftRegistryItems->getGiftRegistryItemsBlock()->isProductInGrid($product), "Product can not be added to active gift registry '{$giftRegistry->getTitle()}' from shopping cart.");
 }
 /**
  * Assert that products added to wishlist are present on Customers account on backend.
  *
  * @param CustomerIndex $customerIndex
  * @param Customer $customer
  * @param CustomerIndexEdit $customerIndexEdit
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(CustomerIndex $customerIndex, Customer $customer, CustomerIndexEdit $customerIndexEdit, InjectableFixture $product)
 {
     $customerIndex->open();
     $customerIndex->getCustomerGridBlock()->searchAndOpen(['email' => $customer->getEmail()]);
     $customerIndexEdit->getCustomerForm()->openTab('wishlist');
     /** @var \Magento\Wishlist\Test\Block\Adminhtml\Customer\Edit\Tab\Wishlist\Grid $wishlistGrid */
     $wishlistGrid = $customerIndexEdit->getCustomerForm()->getTab('wishlist')->getSearchGridBlock();
     \PHPUnit_Framework_Assert::assertTrue($wishlistGrid->isRowVisible(['product_name' => $product->getName()]), $product->getName() . " is not visible in customer wishlist on backend.");
 }
Ejemplo n.º 20
0
 /**
  * Get item block.
  *
  * @param InjectableFixture $product
  * @param int $itemIndex
  * @return ElementInterface
  */
 public function getItemBlockElement(InjectableFixture $product, $itemIndex)
 {
     $itemBlockSelector = sprintf($this->itemBlock, $product->getName());
     ++$itemIndex;
     $itemBlockElement = $this->_rootElement->find($itemBlockSelector . "[{$itemIndex}]", Locator::SELECTOR_XPATH);
     if (!$itemBlockElement->isVisible()) {
         $itemBlockElement = $this->_rootElement->find($itemBlockSelector, Locator::SELECTOR_XPATH);
     }
     return $itemBlockElement;
 }
 /**
  * Get associated items for grouped product.
  *
  * @param InjectableFixture $product
  * @return array
  */
 protected function getAssociatedItems(InjectableFixture $product)
 {
     $cartItems = [];
     /** @var GroupedProduct $product */
     $associatedProducts = $product->getDataFieldConfig('associated')['source']->getProducts();
     foreach ($associatedProducts as $product) {
         $cartItems[$product->getSku()] = parent::getCartItem($product);
     }
     return $cartItems;
 }
 /**
  * Assert that add view review links are present on product page.
  *
  * @param Browser $browser
  * @param CatalogProductView $catalogProductView
  * @param InjectableFixture $product
  * @param Review $review
  * @return void
  */
 public function processAssert(Browser $browser, CatalogProductView $catalogProductView, InjectableFixture $product, Review $review)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     // Verify add review link
     \PHPUnit_Framework_Assert::assertTrue($catalogProductView->getReviewViewBlock()->getAddReviewLink()->isVisible(), 'Add review link is not visible on product page.');
     // Verify view review link
     $viewReviewLink = $catalogProductView->getReviewViewBlock()->getViewReviewLink($review);
     \PHPUnit_Framework_Assert::assertTrue($viewReviewLink->isVisible(), 'View review link is not visible on product page.');
     \PHPUnit_Framework_Assert::assertContains('1', $viewReviewLink->getText(), 'There is more than 1 approved review.');
 }
Ejemplo n.º 23
0
 /**
  * Return product options on view page.
  *
  * @param InjectableFixture $product
  * @return array
  */
 public function getOptions(InjectableFixture $product)
 {
     $options = [];
     $associatedProducts = $product->getAssociated();
     foreach ($associatedProducts as $product) {
         $subProductBlock = $this->_rootElement->find(sprintf($this->subProductByName, $product['name']), Locator::SELECTOR_XPATH);
         $options[] = ['name' => $subProductBlock->find($this->productName)->getText(), 'qty' => $subProductBlock->find($this->qty)->getValue()];
     }
     return $options;
 }
 /**
  * Check whether the attribute is mandatory.
  *
  * @param CatalogProductIndex $catalogProductIndex
  * @param CatalogProductEdit $catalogProductEdit
  * @param CatalogProductAttribute $attribute
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(CatalogProductIndex $catalogProductIndex, CatalogProductEdit $catalogProductEdit, CatalogProductAttribute $attribute, InjectableFixture $product)
 {
     $catalogProductIndex->open()->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
     $productForm = $catalogProductEdit->getProductForm();
     $productForm->getAttributeElement($attribute)->setValue('');
     $catalogProductEdit->getFormPageActions()->save();
     $failedAttributes = $productForm->getRequireNoticeAttributes($product);
     $actualMessage = $failedAttributes['product-details'][$attribute->getFrontendLabel()];
     \PHPUnit_Framework_Assert::assertEquals(self::REQUIRE_MESSAGE, $actualMessage, 'JS error notice on product edit page is not equal to expected.');
 }
 /**
  * Assert that out of stock product is visible in the assigned category.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param CmsIndex $cmsIndex
  * @param InjectableFixture $product
  * @param CatalogCategory|null $category
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, InjectableFixture $product, CatalogCategory $category = null)
 {
     $categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $category->getName();
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($categoryName);
     $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
         $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     }
     \PHPUnit_Framework_Assert::assertTrue($isProductVisible, "Product is absent on category page.");
 }
Ejemplo n.º 26
0
 /**
  * Fill default fields.
  *
  * @param InjectableFixture $product
  * @return void
  */
 protected function fillDefaultField(InjectableFixture $product)
 {
     $data = [];
     foreach ($this->defaultFields as $field) {
         if ($product->hasData($field)) {
             $data[$field . '_autogenerate'] = 'No';
         }
     }
     $mapping = $this->dataMapping($data);
     $this->_fill($mapping);
 }
 /**
  * Add this attribute to Default attribute Template. Create product and Assert that created attribute
  * is displayed on product form (Products > Inventory > Catalog).
  *
  * @param InjectableFixture $product
  * @param CatalogProductIndex $productGrid
  * @param CatalogProductEdit $productEdit
  * @param CatalogProductAttribute $attribute
  * @param CatalogAttributeSet $attributeSet
  * @param CatalogProductAttribute $productAttributeOriginal
  * @throws \Exception
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProductIndex $productGrid, CatalogProductEdit $productEdit, CatalogProductAttribute $attribute, CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttributeOriginal = null)
 {
     if (!$product->hasData('sku')) {
         $product = $this->createProductWithAttributeSet($productAttributeOriginal, $attributeSet);
     }
     $filterProduct = ['sku' => $product->getSku()];
     $productGrid->open();
     $productGrid->getProductGrid()->searchAndOpen($filterProduct);
     $catalogProductAttribute = $productAttributeOriginal !== null ? array_merge($productAttributeOriginal->getData(), $attribute->getData()) : $attribute->getData();
     \PHPUnit_Framework_Assert::assertTrue($productEdit->getProductForm()->checkAttributeLabel($catalogProductAttribute), "Product Attribute is absent on Product form.");
 }
 /**
  * Assert form data equals fixture data.
  *
  * @param InjectableFixture $product
  * @param CatalogProduct $productGrid
  * @param CatalogProductEdit $productPage
  * @param string $urlKeyFormat [optional]
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProduct $productGrid, CatalogProductEdit $productPage, $urlKeyFormat = '%s')
 {
     $this->product = $product;
     $this->urlKeyFormat = $urlKeyFormat;
     $this->catalogProductEdit = $productPage;
     $filter = ['name' => $product->getName(), 'status' => 'Disabled'];
     $productGrid->open()->getProductGrid()->searchAndOpen($filter);
     $formData = $productPage->getProductForm()->getData($product);
     $fixtureData = $this->prepareFixtureData($product->getData());
     $errors = $this->verifyData($fixtureData, $formData);
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
 /**
  * Assert that Catalog Price Rule is applied & it impacts on product's discount price on Product page.
  *
  * @param InjectableFixture $product
  * @param CatalogProductView $pageCatalogProductView
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param array $prices
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProductView $pageCatalogProductView, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, array $prices)
 {
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($product->getCategoryIds()[0]);
     $catalogCategoryView->getListProductBlock()->openProductViewPage($product->getName());
     $productPriceBlock = $pageCatalogProductView->getViewBlock()->getPriceBlock();
     $actualPrices['regular'] = $productPriceBlock->getRegularPrice();
     $actualPrices['special'] = $productPriceBlock->getSpecialPrice();
     $actualPrices['discount_amount'] = number_format($actualPrices['regular'] - $actualPrices['special'], 2);
     $diff = $this->verifyData($actualPrices, $prices);
     \PHPUnit_Framework_Assert::assertEmpty($diff, $diff);
 }
 /**
  * Assert that configurable options available on configurable product Edit form on backend.
  *
  * @param CatalogProduct $catalogProductIndex
  * @param CatalogProductEdit $catalogProductEdit
  * @param CatalogProductAttribute $attribute
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(CatalogProduct $catalogProductIndex, CatalogProductEdit $catalogProductEdit, CatalogProductAttribute $attribute, InjectableFixture $product)
 {
     $options = $attribute->getOptions();
     $attributeOptionsFromFixture = [];
     foreach ($options as $option) {
         $attributeOptionsFromFixture[] = $option['admin'];
     }
     $catalogProductIndex->open()->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
     $productForm = $catalogProductEdit->getProductForm();
     $attributeOptions = $productForm->getAttributeElement($attribute)->getValues();
     \PHPUnit_Framework_Assert::assertEquals($attributeOptionsFromFixture, $attributeOptions);
 }