10 use Magento\Catalog\Test\Page\Category\CatalogCategoryView;
11 use Magento\Catalog\Test\Page\Product\CatalogProductView;
12 use Magento\Checkout\Test\Page\CheckoutCart;
13 use Magento\Cms\Test\Page\CmsIndex;
14 use Magento\Mtf\Constraint\AbstractConstraint;
15 use Magento\Mtf\Fixture\FixtureInterface;
80 $this->fptLabel =
$product->getDataFieldConfig(
'attribute_set_id')[
'source']
81 ->getAttributeSet()->getDataFieldConfig(
'assigned_attributes')[
'source']
82 ->getAttributes()[0]->getFrontendLabel();
84 $actualPrices = $this->
getPrices($product);
86 \PHPUnit\Framework\Assert::assertEquals(
89 'Prices on front should be equal to defined in dataset' 100 $this->checkoutCart->open();
101 $this->checkoutCart->getCartBlock()->clearShoppingCart();
114 $this->cmsIndex->open();
115 $this->cmsIndex->getTopmenu()->selectCategoryByName(
$product->getCategoryIds()[0]);
118 $this->catalogCategoryView->getListProductBlock()->getProductItem(
$product)->open();
119 $actualPrices = $this->
addToCart($product, $actualPrices);
121 $actualPrices = $this->
getCartPrice($product, $actualPrices);
123 return array_filter($actualPrices);
135 $priceBlock = $this->catalogCategoryView->getWeeeListProductBlock()->getProductItem(
$product)->getPriceBlock();
136 $actualPrices[
'category_price'] = $priceBlock->getPrice();
137 $actualPrices[
'fpt_category'] = $priceBlock->getFptPrice();
138 $actualPrices[
'fpt_total_category'] = $priceBlock->getFinalPrice();
140 return $actualPrices;
152 $viewBlock = $this->catalogProductView->getViewBlock();
153 $priceBlock = $this->catalogProductView->getWeeeViewBlock()->getPriceBlock();
156 $actualPrices[
'product_page_price'] = $priceBlock->getPrice();
157 $actualPrices[
'product_page_fpt'] = $priceBlock->getFptPrice();
158 $actualPrices[
'product_page_fpt_total'] = $priceBlock->getFinalPrice();
160 $viewBlock->clickAddToCart();
161 $this->catalogProductView->getMessagesBlock()->waitSuccessMessage();
162 return $actualPrices;
174 $this->checkoutCart->open();
175 $productItem = $this->checkoutCart->getCartBlock()->getCartItem(
$product);
176 $productWeeeItem = $this->checkoutCart->getWeeeCartBlock()->getCartItem(
$product);
177 $actualPrices[
'cart_item_price'] = $productItem->getPrice();
178 $actualPrices[
'cart_item_fpt'] = $productWeeeItem->getPriceFptBlock()->getFpt();
179 $actualPrices[
'cart_item_fpt_total'] = $productWeeeItem->getPriceFptBlock()->getFptTotal();
180 $actualPrices[
'cart_item_subtotal'] = $productItem->getSubtotalPrice();
181 $actualPrices[
'cart_item_subtotal_fpt'] = $productWeeeItem->getSubtotalFptBlock()->getFpt();
182 $actualPrices[
'cart_item_subtotal_fpt_total'] = $productWeeeItem->getSubtotalFptBlock()->getFptTotal();
183 $actualPrices[
'grand_total'] = $this->checkoutCart->getTotalsBlock()->getGrandTotal();
184 $actualPrices[
'grand_total_excl_tax'] = $this->checkoutCart->getTotalsBlock()->getGrandTotalExcludingTax();
185 $actualPrices[
'grand_total_incl_tax'] = $this->checkoutCart->getTotalsBlock()->getGrandTotalIncludingTax();
186 $actualPrices[
'total_fpt'] = $this->checkoutCart->getWeeeTotalsBlock()->getFptBlock()->getTotalFpt();
188 return $actualPrices;
198 return 'FPT is applied to product.';
addToCart(CatalogProductSimple $product, array $actualPrices)
getCategoryPrice(FixtureInterface $product, $actualPrices)
processAssert(CatalogProductSimple $product, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, array $prices)
getPrices(CatalogProductSimple $product)
getCartPrice(CatalogProductSimple $product, array $actualPrices)