Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DeleteCompareProductsTest.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Catalog\Test\Page\Product\CatalogProductCompare;
11 use Magento\Mtf\Fixture\FixtureFactory;
12 
28 {
29  /* tags */
30  const MVP = 'yes';
31  const STABLE = 'no';
32  /* end tags */
33 
40 
48  public function __prepare(FixtureFactory $fixtureFactory, Customer $customer)
49  {
50  parent::__prepare($fixtureFactory, $customer);
51  $config = $this->fixtureFactory->createByCode('configData', ['dataset' => 'compare_products']);
52  $config->persist();
53  }
54 
64  public function test(
65  $products,
66  $removeProductIndex,
67  $isCustomerLoggedIn,
68  CatalogProductCompare $catalogProductCompare
69  ) {
70  //Steps
71  $this->catalogProductCompare = $catalogProductCompare;
72  $this->cmsIndex->open();
73  if ($isCustomerLoggedIn == 'Yes') {
74  $this->loginCustomer();
75  }
76  $this->products = $this->createProducts($products);
77  $this->addProducts($this->products);
78  $this->cmsIndex->getLinksBlock()->openLink("Compare Products");
79  $this->catalogProductCompare->getCompareProductsBlock()->removeProduct($removeProductIndex);
80 
81  return ['product' => $this->products[$removeProductIndex - 1], 'countProducts' => count($this->products)];
82  }
83 
89  public function tearDown()
90  {
91  if (count($this->products) > 1) {
92  $this->cmsIndex->open();
93  $this->cmsIndex->getLinksBlock()->openLink("Compare Products");
94  $this->catalogProductCompare->getCompareProductsBlock()->removeAllProducts();
95  }
96  }
97 }
$config
Definition: fraud_order.php:17
test( $products, $removeProductIndex, $isCustomerLoggedIn, CatalogProductCompare $catalogProductCompare)
__prepare(FixtureFactory $fixtureFactory, Customer $customer)