10 use Magento\CatalogSearch\Test\Page\AdvancedSearch;
11 use Magento\Indexer\Test\Page\Adminhtml\IndexManagement;
12 use Magento\Mtf\TestCase\Injectable;
17 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductAttributeIndex;
18 use Magento\Mtf\Fixture\FixtureFactory;
19 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductNew;
20 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit;
21 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
22 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductAttributeNew;
23 use Magento\CatalogSearch\Test\Page\AdvancedResult;
26 use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
83 private $assertSearchAttributeTest;
97 private $attributeForSearch;
104 private $attributeDisable;
118 private $advancedSearch;
125 private $indexManagement;
146 private $productGrid;
153 private $newProductPage;
160 private $productEdit;
167 private $attributeNewPage;
174 private $assertIndexerStatus;
181 private $assertCreateProducts;
188 private $productAttributePage;
195 private $assertSuccessSaveMessage;
202 private $assertAdvancedSearchResult;
209 private $assertAttributeStatus;
233 IndexManagement $indexManagement,
234 AdvancedSearch $advancedSearch,
235 AdvancedResult $resultPage,
236 CatalogProductIndex $productGrid,
237 CatalogProductNew $newProductPage,
238 CatalogProductEdit $productEdit,
241 CatalogProductAttributeIndex $productAttributePage,
242 CatalogProductAttributeNew $attributeNewPage,
243 AssertSuccessSaveMessage $assertSuccessSaveMessage,
248 $this->indexManagement = $indexManagement;
249 $this->advancedSearch = $advancedSearch;
250 $this->resultPage = $resultPage;
251 $this->productGrid = $productGrid;
252 $this->newProductPage = $newProductPage;
253 $this->productEdit = $productEdit;
254 $this->assertIndexerStatus = $assertIndexerStatus;
255 $this->assertCreateProducts = $assertCreateProducts;
256 $this->productAttributePage = $productAttributePage;
257 $this->attributeNewPage = $attributeNewPage;
258 $this->assertSuccessSaveMessage = $assertSuccessSaveMessage;
259 $this->assertSearchAttributeTest = $assertSearchAttributeTest;
260 $this->assertAdvancedSearchResult = $assertAdvancedSearchResult;
261 $this->assertAttributeStatus = $assertAttributeStatus;
286 FixtureFactory $fixtureFactory,
287 CatalogProductSimple $productSearch,
288 CatalogProductAttribute $attributeEnable,
289 CatalogProductAttribute $attributeDisable,
290 CatalogProductAttribute $attributeGlobalStatus,
292 array $isVisibleInAdvancedSearch,
293 array $productDropDownList,
299 $this->attributeDisable = $attributeDisable;
300 $this->attributeForSearch = $attributeForSearch;
301 $this->indexers = explode(
',', $indexers);
306 $this->indexManagement->open();
307 $this->indexManagement->getMainBlock()->updateBySchedule($this->indexers);
309 $this->assertSuccessSaveMessage->processAssert($this->indexManagement, $this->indexers);
314 $this->assertIndexerStatus->processAssert($this->indexManagement, $this->indexers);
315 $this->productAttributePage->open();
316 $this->productAttributePage->getGrid()->searchAndOpen([
'attribute_code' => $attributeForSearch[
'name']]);
317 $this->attributeNewPage->getAttributeForm()->fill($attributeEnable);
318 $this->attributeNewPage->getPageActions()->save();
320 $this->assertAttributeStatus->processAssert($this->productAttributePage);
323 $this->assertIndexerStatus->processAssert($this->indexManagement, $this->indexers,
false);
325 $this->assertSearchAttributeTest->processAssert($this->advancedSearch, $attributeForSearch);
329 $this->productAttributePage->open();
330 $this->productAttributePage->getGrid()->searchAndOpen([
'attribute_code' => $attributeForSearch[
'name']]);
331 $this->attributeNewPage->getAttributeForm()->fill($attributeGlobalStatus);
332 $this->attributeNewPage->getPageActions()->save();
334 $this->assertAttributeStatus->processAssert($this->productAttributePage);
337 $this->assertIndexerStatus->processAssert($this->indexManagement, $this->indexers,
false);
340 $this->assertSearchAttributeTest->processAssert($this->advancedSearch, $attributeForSearch);
346 list($fixtureCode, $dataset) = explode(
'::',
$product);
347 $this->productGrid->open();
348 $this->productGrid->getGridPageActionBlock()->addProduct($productDropDownList[$key]);
349 $product = $fixtureFactory->createByCode($fixtureCode, [
'dataset' => $dataset]);
351 $this->newProductPage->getFormPageActions()->save(
$product);
353 $this->assertCreateProducts->processAssert($this->productEdit);
358 $this->advancedSearch->open();
359 $this->advancedSearch->getForm()->fill($productSearch)->submit();
362 $this->assertAdvancedSearchResult->processAssert($isVisibleInAdvancedSearch, $allProducts, $this->resultPage);
363 $this->productAttributePage->open();
364 $this->productAttributePage->getGrid()->searchAndOpen([
'attribute_code' => $this->attributeForSearch[
'name']]);
365 $this->attributeNewPage->getAttributeForm()->fill($this->attributeDisable);
366 $this->attributeNewPage->getPageActions()->save();
368 $this->assertAttributeStatus->processAssert($this->productAttributePage);
370 $this->assertIndexerStatus->processAssert($this->indexManagement, $this->indexers,
false);
372 unset($this->attributeForSearch[
'isVisible']);
373 $this->assertSearchAttributeTest->processAssert($this->advancedSearch, $this->attributeForSearch);
383 $this->productAttributePage->open();
384 $this->productAttributePage->getGrid()->searchAndOpen([
'attribute_code' => $this->attributeForSearch[
'name']]);
385 $this->attributeNewPage->getAttributeForm()->fill($this->attributeDisable);
386 $this->attributeNewPage->getPageActions()->save();
387 $this->indexManagement->open();
388 $this->indexManagement->getMainBlock()->massaction([],
'Update on Save',
false,
'Select All');
389 $this->cli->reindex();
__inject(IndexManagement $indexManagement, AdvancedSearch $advancedSearch, AdvancedResult $resultPage, CatalogProductIndex $productGrid, CatalogProductNew $newProductPage, CatalogProductEdit $productEdit, AssertIndexerStatus $assertIndexerStatus, AssertProductSaveMessage $assertCreateProducts, CatalogProductAttributeIndex $productAttributePage, CatalogProductAttributeNew $attributeNewPage, AssertSuccessSaveMessage $assertSuccessSaveMessage, AssertSearchAttributeTest $assertSearchAttributeTest, AssertAdvancedSearchProductResult $assertAdvancedSearchResult, AssertProductAttributeSaveMessage $assertAttributeStatus)
test(Indexer $cli, Category $category, FixtureFactory $fixtureFactory, CatalogProductSimple $productSearch, CatalogProductAttribute $attributeEnable, CatalogProductAttribute $attributeDisable, CatalogProductAttribute $attributeGlobalStatus, $attributeForSearch, array $isVisibleInAdvancedSearch, array $productDropDownList, array $products, $indexers=null)
reindex(array $indexes=[])