10 use Magento\Catalog\Test\Page\Product\CatalogProductView;
11 use Magento\Checkout\Test\Page\CheckoutCart;
12 use Magento\Mtf\Client\BrowserInterface;
13 use Magento\Mtf\Constraint\AbstractConstraint;
14 use Magento\Mtf\Fixture\FixtureInterface;
33 private $fixtureActualPrice;
40 private $fixturePrice;
52 CatalogProductView $catalogProductView,
54 BrowserInterface $browser,
57 $checkoutCart->open();
58 $checkoutCart->getCartBlock()->clearShoppingCart();
60 $browser->open($_ENV[
'app_frontend_url'] .
$product->getUrlKey() .
'.html');
61 $requiredQty =
$product->getDataFieldConfig(
'tier_price')[
'source']->getData()[0][
'price_qty'];
62 $catalogProductView->getViewBlock()->setQtyAndClickAddToCart($requiredQty);
63 $catalogProductView->getMessagesBlock()->waitSuccessMessage();
66 $this->countPrices(
$product, $checkoutCart);
67 \PHPUnit\Framework\Assert::assertEquals(
68 $this->fixtureActualPrice,
70 'Product price in shopping cart is not correct.' 84 $this->fixturePrice =
$product->getPrice();
85 $this->prepareFormPrice(
$product, $checkoutCart);
86 $this->countCheckoutCartItemPrice(
$product);
98 $checkoutCart->open();
100 $this->formPrice =
$cartItem->getPrice();
109 private function countCheckoutCartItemPrice(FixtureInterface
$product)
111 $tierPrice =
$product->getDataFieldConfig(
'tier_price')[
'source']->getData()[0];
113 if ($tierPrice[
'value_type'] ===
"Discount") {
114 $this->fixtureActualPrice = $this->fixturePrice * (1 - $tierPrice[
'percentage_value'] / 100);
116 $this->fixtureActualPrice = $tierPrice[
'price'];
127 return 'Product is correctly displayed in cart.';
processAssert(CatalogProductView $catalogProductView, FixtureInterface $product, BrowserInterface $browser, CheckoutCart $checkoutCart)