9 use Magento\Mtf\TestCase\Injectable;
10 use Magento\CatalogRule\Test\Fixture\CatalogRule;
13 use Magento\Mtf\TestStep\TestStepFactory;
18 use Magento\Indexer\Test\Page\Adminhtml\IndexManagement;
19 use Magento\Cms\Test\Page\CmsIndex;
20 use Magento\Catalog\Test\Page\Category\CatalogCategoryView;
21 use Magento\Catalog\Test\Page\Product\CatalogProductView;
22 use Magento\CatalogRule\Test\Page\Adminhtml\CatalogRuleIndex;
23 use Magento\CatalogRule\Test\Page\Adminhtml\CatalogRuleNew;
69 private $catalogRuleIndex;
76 private $catalogRuleNew;
83 private $indexManagement;
90 private $cmsIndexPage;
97 private $catalogProductViewPage;
104 private $catalogCategoryViewPage;
111 private $assertIndexerStatus;
118 private $assertCatalogPriceRuleNotAppliedProductPage;
125 private $assertCatalogPriceRuleAppliedProductPage;
132 private $stepFactory;
151 IndexManagement $indexManagement,
152 CatalogRuleIndex $catalogRuleIndex,
153 CatalogRuleNew $catalogRuleNew,
154 CmsIndex $cmsIndexPage,
155 CatalogProductView $catalogProductViewPage,
156 CatalogCategoryView $catalogCategoryViewPage,
160 TestStepFactory $stepFactory
162 $this->indexManagement = $indexManagement;
163 $this->catalogRuleIndex = $catalogRuleIndex;
164 $this->catalogRuleNew = $catalogRuleNew;
165 $this->cmsIndexPage = $cmsIndexPage;
166 $this->catalogProductViewPage = $catalogProductViewPage;
167 $this->catalogCategoryViewPage = $catalogCategoryViewPage;
168 $this->assertIndexerStatus = $assertIndexerStatus;
169 $this->assertCatalogPriceRuleNotAppliedProductPage = $assertCatalogPriceRuleNotAppliedProductPage;
170 $this->assertCatalogPriceRuleAppliedProductPage = $assertCatalogPriceRuleAppliedProductPage;
171 $this->stepFactory = $stepFactory;
190 CatalogRule $catalogPriceRule,
191 CatalogRule $catalogPriceRuleOriginal,
193 array $productPrice1 =
null,
194 array $productPrice2 =
null,
199 $products = $this->stepFactory->create(CreateProductsStep::class, [
'products' =>
$products])->run()[
'products'];
204 $catalogPriceRuleOriginal->persist();
205 $this->assertIndexerStatus->processAssert($this->indexManagement, $indexers,
true);
206 $this->objectManager->create(\
Magento\Customer\Test\TestStep\LogoutCustomerOnFrontendStep::class)->run();
207 $this->assertCatalogPriceRuleNotAppliedProductPage->processAssert(
208 $this->catalogProductViewPage,
210 $this->catalogCategoryViewPage,
214 'name' => $catalogPriceRuleOriginal->getName(),
215 'rule_id' => $catalogPriceRuleOriginal->getId(),
217 $this->catalogRuleIndex->open();
218 $this->catalogRuleIndex->getCatalogRuleGrid()->searchAndOpen($filter);
219 $this->catalogRuleNew->getFormPageActions()->saveAndApply();
222 $this->assertIndexerStatus->processAssert($this->indexManagement, $indexers,
true);
223 $this->assertCatalogPriceRuleAppliedProductPage->processAssert(
224 $this->catalogProductViewPage,
226 $this->catalogCategoryViewPage,
231 $this->catalogRuleIndex->open();
232 $this->catalogRuleIndex->getCatalogRuleGrid()->searchAndOpen($filter);
233 $this->catalogRuleNew->getEditForm()->fill($catalogPriceRule);
234 $this->catalogRuleNew->getFormPageActions()->saveAndApply();
235 $this->assertIndexerStatus->processAssert($this->indexManagement, $indexers,
false);
236 $this->objectManager->create(\
Magento\Customer\Test\TestStep\LogoutCustomerOnFrontendStep::class)->run();
237 $this->assertCatalogPriceRuleNotAppliedProductPage->processAssert(
238 $this->catalogProductViewPage,
240 $this->catalogCategoryViewPage,
245 $this->assertIndexerStatus->processAssert($this->indexManagement, $indexers,
true);
246 $this->assertCatalogPriceRuleAppliedProductPage->processAssert(
247 $this->catalogProductViewPage,
249 $this->catalogCategoryViewPage,
254 $this->catalogRuleIndex->open();
255 $this->catalogRuleIndex->getCatalogRuleGrid()->searchAndOpen($filter);
256 $this->catalogRuleNew->getFormPageActions()->delete();
257 $this->catalogRuleNew->getModalBlock()->acceptAlert();
258 $this->assertIndexerStatus->processAssert($this->indexManagement, $indexers,
false);
259 $this->assertCatalogPriceRuleAppliedProductPage->processAssert(
260 $this->catalogProductViewPage,
262 $this->catalogCategoryViewPage,
269 $this->assertIndexerStatus->processAssert($this->indexManagement, $indexers,
true);
270 $this->objectManager->create(\
Magento\Customer\Test\TestStep\LogoutCustomerOnFrontendStep::class)->run();
271 $this->assertCatalogPriceRuleNotAppliedProductPage->processAssert(
272 $this->catalogProductViewPage,
274 $this->catalogCategoryViewPage,
286 $this->objectManager->create(\
Magento\CatalogRule\Test\TestStep\DeleteAllCatalogRulesStep::class)->run();
test(Indexer $cli, CatalogRule $catalogPriceRule, CatalogRule $catalogPriceRuleOriginal, Cron $cron, array $productPrice1=null, array $productPrice2=null, Customer $customer=null, array $products=null, $indexers=null)
reindex(array $indexes=[])
__inject(IndexManagement $indexManagement, CatalogRuleIndex $catalogRuleIndex, CatalogRuleNew $catalogRuleNew, CmsIndex $cmsIndexPage, CatalogProductView $catalogProductViewPage, CatalogCategoryView $catalogCategoryViewPage, AssertIndexerStatus $assertIndexerStatus, AssertCatalogPriceRuleNotAppliedProductPage $assertCatalogPriceRuleNotAppliedProductPage, AssertCatalogPriceRuleAppliedProductPage $assertCatalogPriceRuleAppliedProductPage, TestStepFactory $stepFactory)