9 use Magento\Checkout\Test\Page\CheckoutCart;
10 use Magento\Cms\Test\Page\CmsIndex;
11 use Magento\Mtf\Fixture\InjectableFixture;
28 const TEST_TYPE =
'acceptance_test, extended_acceptance_test';
60 $navigateProductsOrder,
74 $initialProductName = array_shift($navigateProductsOrder);
75 $initialProduct = $this->products[$initialProductName];
76 $initialProductToVerify = $productsToVerify[$initialProductName];
79 $this->checkoutCart->open();
80 $this->checkoutCart->getCartBlock()->clearShoppingCart();
82 $this->browser->open($_ENV[
'app_frontend_url'] . $initialProduct->getUrlKey() .
'.html');
83 $this->catalogProductView->getViewBlock()->addToCart($initialProduct);
84 $this->catalogProductView->getMessagesBlock()->waitSuccessMessage();
86 foreach ($navigateProductsOrder as $productName) {
87 $this->
addToCart($this->products[$productName]);
89 if (empty($productsToVerify[$productName])) {
105 $this->checkoutCart->getCrosssellBlock()->getProductItem(
$product)->clickAddToCart();
106 if ($this->cmsIndex->getTitleBlock()->getTitle() ==
$product->getName()) {
107 $this->catalogProductView->getViewBlock()->addToCart(
$product);
110 $this->catalogProductView->getMessagesBlock()->waitSuccessMessage();
120 $this->checkoutCart->open();
121 \PHPUnit\Framework\Assert::assertFalse(
122 $this->checkoutCart->getCrosssellBlock()->isVisible(),
123 "Cross-sell block is present." 136 $pageProductNames = [];
138 foreach ($promotedProductNames as $promotedProductName) {
139 $productNames[] = $this->products[$promotedProductName]->getName();
141 $this->checkoutCart->open();
142 foreach ($this->checkoutCart->getCrosssellBlock()->getProducts() as $productItem) {
143 $pageProductNames[] = $productItem->getProductName();
147 sort($pageProductNames);
148 \PHPUnit\Framework\Assert::assertEquals(
151 'Wrong products are displayed in cross-sell section.'
assertCrossSellSection(array $promotedProductNames)
assertAbsentCrossSellSection()
test( $products, $promotedProducts, $navigateProductsOrder, $productsToVerify, CmsIndex $cmsIndex, CheckoutCart $checkoutCart)
addToCart(InjectableFixture $product)