9 use Magento\Checkout\Test\Page\CheckoutCart;
10 use Magento\Mtf\Fixture\InjectableFixture;
28 const TEST_TYPE =
'acceptance_test, extended_acceptance_test';
68 $navigateProductsOrder,
81 $initialProductName = array_shift($navigateProductsOrder);
82 $initialProduct = $this->products[$initialProductName];
83 $lastProductName = end($navigateProductsOrder);
84 $lastProduct = $this->products[$lastProductName];
88 $this->checkoutCart->open();
89 $this->checkoutCart->getCartBlock()->clearShoppingCart();
92 $this->browser->open($_ENV[
'app_frontend_url'] . $initialProduct->getUrlKey() .
'.html');
94 foreach ($navigateProductsOrder as $productShortName) {
100 $checkoutProducts[] = $lastProduct;
101 $this->catalogProductView->getViewBlock()->addToCart($lastProduct);
102 $this->catalogProductView->getMessagesBlock()->waitSuccessMessage();
114 $list = array_map(
'trim', explode(
',',
$selectable));
116 foreach ($list as
$item) {
117 list($productName, $isSelectable) = array_map(
'trim', explode(
':',
$item));
118 $this->selectable[$productName] = $isSelectable;
130 $shortNames = $this->productsToVerify[
$product];
133 foreach ($shortNames as $shortName) {
134 $products[$shortName] = $this->products[$shortName];
148 $product = $this->products[$productShortName];
149 $this->catalogProductView->getRelatedProductBlock()->getProductItem(
$product)->open();
151 if (empty($this->productsToVerify[$productShortName])) {
168 foreach ($this->productsToVerify[
$product] as $productShortName) {
169 $productToVerify = $this->products[$productShortName];
170 $isSelect = $this->selectable[$productShortName];
172 if (
'yes' == $isSelect) {
173 $this->catalogProductView->getRelatedProductBlock()->getProductItem($productToVerify)->select();
174 $selected[] = $productToVerify;
188 \PHPUnit\Framework\Assert::assertFalse(
189 $this->catalogProductView->getRelatedProductBlock()->isVisible(),
190 "Related section is present." 208 $fixtureData[$productName] = $this->selectable[$shortName];
210 foreach ($this->catalogProductView->getRelatedProductBlock()->getProducts() as $productItem) {
211 $pageProductName = $productItem->getProductName();
212 $pageData[$pageProductName] = $productItem->isSelectable() ?
'yes' :
'no';
217 \PHPUnit\Framework\Assert::assertEquals(
220 'Wrong products are displayed in related section.' 232 $this->checkoutCart->open();
234 foreach ($checkoutProducts as
$product) {
235 \PHPUnit\Framework\Assert::assertTrue(
236 $this->checkoutCart->getCartBlock()->getCartItem(
$product)->isVisible(),
237 "Product {$product->getName()} absent in cart."