12 use Magento\CatalogSearch\Test\Page\AdvancedResult;
13 use Magento\Mtf\Constraint\AbstractConstraint;
31 public function processAssert(CatalogSearchQuery $catalogSearch, AdvancedResult $resultPage)
34 $queryText = $catalogSearch->getDataFieldConfig(
'query_text')[
'source'];
39 $productsOrder[] = $productFixture->getData(
'name');
43 $productNamesOnPage = $resultPage->getListProductBlock()->getProductNames();
45 foreach ($productNamesOnPage as $productOnPage) {
46 $idxInArray = array_search($productOnPage, $productsOrder,
true);
47 if (
false !== $idxInArray) {
48 if (0 !== $idxInArray) {
49 \PHPUnit\Framework\Assert::assertEmpty(
51 'Products are in incorrect order on the search result page' 54 array_shift($productsOrder);
57 }
while (count($productsOrder) && $resultPage->getBottomToolbar()->nextPage());
59 \PHPUnit\Framework\Assert::assertEmpty(
61 'Products are in incorrect order on the search result page' 72 return "Searched products were successfully found and they're in the right order.";