Skip to content

Commit 541098b

Browse files
author
Valeriy Nayda
committed
GraphQL-175: Improve graphql product pagination
-- Remove API-functional tests due to sort order and pagination functionality is covered by testFilterProductsByNameASC
1 parent 9ad5a2c commit 541098b

File tree

1 file changed

+2
-75
lines changed

1 file changed

+2
-75
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php

Lines changed: 2 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -386,79 +386,6 @@ public function testSearchWithFilterWithPageSizeEqualTotalCount()
386386
$this->graphQlQuery($query);
387387
}
388388

389-
/**
390-
* The query returns a total_count of 2 records; setting the pageSize = 1 and currentPage = 2
391-
* Expected result is to get the second product on the list on the second page
392-
*
393-
* @magentoApiDataFixture Magento/Catalog/_files/multiple_products.php
394-
*/
395-
public function testSearchWithFilterPageSizeLessThanCurrentPage()
396-
{
397-
398-
$query
399-
= <<<QUERY
400-
{
401-
products(
402-
search : "simple"
403-
filter:
404-
{
405-
special_price:{neq:"null"}
406-
price:{lt:"60"}
407-
or:
408-
{
409-
sku:{like:"%simple%"}
410-
name:{like:"%configurable%"}
411-
}
412-
weight:{eq:"1"}
413-
}
414-
pageSize:1
415-
currentPage:2
416-
sort:
417-
{
418-
price:DESC
419-
}
420-
)
421-
{
422-
items
423-
{
424-
sku
425-
price {
426-
minimalPrice {
427-
amount {
428-
value
429-
currency
430-
}
431-
}
432-
}
433-
name
434-
... on PhysicalProductInterface {
435-
weight
436-
}
437-
type_id
438-
attribute_set_id
439-
}
440-
total_count
441-
page_info
442-
{
443-
page_size
444-
}
445-
}
446-
}
447-
QUERY;
448-
/**
449-
* @var ProductRepositoryInterface $productRepository
450-
*/
451-
$productRepository = ObjectManager::getInstance()->get(ProductRepositoryInterface::class);
452-
// when pageSize = 1 and currentPage = 2, it should have simple2 on first page and simple1 on 2nd page
453-
// since sorting is done on price in the DESC order
454-
$product = $productRepository->get('simple1');
455-
$filteredProducts = [$product];
456-
457-
$response = $this->graphQlQuery($query);
458-
$this->assertEquals(1, $response['products']['total_count']);
459-
$this->assertProductItems($filteredProducts, $response);
460-
}
461-
462389
/**
463390
* Requesting for items that match a specific SKU or NAME within a certain price range sorted by Price in ASC order
464391
*
@@ -549,11 +476,11 @@ public function testQueryProductsInCurrentPageSortedByPriceASC()
549476
}
550477

551478
/**
552-
* Verify the items in the second page is correct after sorting their name in ASC order
479+
* Verify the items is correct after sorting their name in ASC order
553480
*
554481
* @magentoApiDataFixture Magento/Catalog/_files/multiple_mixed_products_2.php
555482
*/
556-
public function testFilterProductsInNextPageSortedByNameASC()
483+
public function testFilterProductsByNameASC()
557484
{
558485
$query
559486
= <<<QUERY

0 commit comments

Comments
 (0)