Skip to content

Commit f905ec1

Browse files
committed
ACQE-8696: [Web API Automation] - AC-8972
- Write new web api automation test for product not returned when visibility is catalog only
1 parent a1c57b2 commit f905ec1

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\GraphQl\Catalog;
9+
10+
use Magento\Catalog\Model\Product\Visibility;
11+
use Magento\Catalog\Test\Fixture\Product as ProductFixture;
12+
use Magento\TestFramework\Fixture\DataFixture;
13+
use Magento\TestFramework\TestCase\GraphQlAbstract;
14+
15+
class ProductVisibilitySearchTest extends GraphQlAbstract
16+
{
17+
#[DataFixture(
18+
ProductFixture::class,
19+
['price' => 1, 'name' => 'API_TEST', 'visibility' => Visibility::VISIBILITY_IN_CATALOG],
20+
'prod1'
21+
)]
22+
public function testProductNotReturnedWhenVisibilityIsCatalogOnly(): void
23+
{
24+
$query = <<<'QUERY'
25+
query {
26+
products(
27+
search: "API"
28+
filter: { price: { from: "1" } }
29+
) {
30+
items {
31+
name
32+
sku
33+
}
34+
}
35+
}
36+
QUERY;
37+
38+
$response = $this->graphQlQuery($query);
39+
$this->assertArrayNotHasKey('errors', $response);
40+
$this->assertEmpty(
41+
$response['products']['items'],
42+
'Expected no products to be returned when product is set to Catalog-only visibility.'
43+
);
44+
}
45+
}

0 commit comments

Comments
 (0)