10 use Magento\CatalogSearch\Test\Page\AdvancedResult;
11 use Magento\Mtf\Constraint\AbstractConstraint;
26 const ERROR_MESSAGE =
'We can\'t find any items matching these search criteria.';
41 'tax_class_id' =>
'tax_class',
53 public function processAssert(
56 array $productsSearch,
57 CatalogProductSimple $productSearch
64 $searchResult[$productsSearch[$key]->getSku()] = $productsSearch[$key];
69 foreach ($searchResult as $sku =>
$product) {
73 $isProductVisible =
$resultPage->getListProductBlock()->getProductItem(
$product)->isVisible();
74 }
while (!$isProductVisible &&
$resultPage->getBottomToolbar()->nextPage());
76 if (!$isProductVisible) {
77 $errors[] =
'- failed to find the product (SKU - "' 78 . $sku .
'", name - "' .
$name .
'") according to the search parameters';
82 \PHPUnit\Framework\Assert::assertTrue(
84 "The following errors occurred:\n" . implode(
"\n",
$errors)
95 protected function checkSearchData(array $searchResult, CatalogProductSimple $productSearch)
97 $searchBlock = $this->resultPage->getSearchResultBlock();
100 if (empty($searchResult)) {
104 if (!$searchBlock->isVisibleMessages($textMessage)) {
105 $errors[] =
'- message does not match the search script';
108 $searchData = $searchBlock->getSearchSummaryItems();
111 if (!isset($searchData[$key])) {
112 $errors[] =
'- "' . $key .
'" not found on the page';
114 $errors[] =
'- "' . $key .
'" value does not match the page';
130 foreach ($productSearch->getData() as $key =>
$value) {
131 if ($key ===
'price') {
132 if (isset(
$value[
'price_from'])) {
133 $compareData[$key][] =
$value[
'price_from'];
135 if (isset(
$value[
'price_to'])) {
136 $compareData[$key][] =
$value[
'price_to'];
139 $index = isset($this->placeholder[$key]) ? $this->placeholder[$key] : $key;
143 unset($compareData[
'url_key']);
155 return 'All products are involved in the search were found successfully.';
elseif(isset( $params[ 'redirect_parent']))
prepareFixtureData(CatalogProductSimple $productSearch)
checkSearchData(array $searchResult, CatalogProductSimple $productSearch)
if(!isset($_GET['name'])) $name