Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions resources/common/common_api.robot
Original file line number Diff line number Diff line change
Expand Up @@ -2276,6 +2276,87 @@ Response body array element should contain property with value at least once:
Should Be Equal As Strings ${result} TRUE
... Property '${property_path}' with value '${expected_value}' was not found in array at '${json_path}'

Array element should contain property with value greater than at least once:
[Documentation] Checks that within the array at ${json_path}, at least one element has
... property ${expected_property} whose numeric value is > ${expected_value}.
... Elements lacking the property are ignored.
...
... *Example:*
... Array element should contain property with value greater than at least once: [data][0][attributes][abstractProducts][0][prices] DEFAULT 1
[Arguments] ${json_path} ${expected_property} ${expected_value}
@{arr}= Get Value From Json ${response_body} ${json_path}
${length}= Get Length @{arr}
Should Be True ${length} > 0 No elements found at path '${json_path}'.

${hit}= Set Variable ${False}
FOR ${i} IN RANGE 0 ${length}
${el}= Get From List @{arr} ${i}
${got}= Run Keyword And Ignore Error Get From Dictionary ${el} ${expected_property}
${status}= Set Variable ${got}[0]
${raw}= Set Variable ${got}[1]
IF '${status}' == 'PASS'
# Coerce both sides to numbers (int/float or numeric strings)
${act_conv}= Run Keyword And Ignore Error Convert To Number ${raw}
IF '${act_conv}[0]' == 'PASS'
${actual}= Set Variable ${act_conv}[1]
ELSE
${actual}= Evaluate float(${raw})
END
${exp_conv}= Run Keyword And Ignore Error Convert To Number ${expected_value}
IF '${exp_conv}[0]' == 'PASS'
${expected}= Set Variable ${exp_conv}[1]
ELSE
${expected}= Evaluate float(${expected_value})
END

IF ${actual} > ${expected}
${hit}= Set Variable ${True}
Exit For Loop
END
END
END
Should Be True ${hit} No element at '${json_path}' has property '${expected_property}' greater than '${expected_value}'.

Array element should contain property with value less than at least once:
[Documentation] Checks that within the array at ${json_path}, at least one element has
... property ${expected_property} whose numeric value is < ${expected_value}.
... Elements lacking the property are ignored.
...
... *Example:*
... Array element should contain property with value less than at least once: [data][0][attributes][abstractProducts][0][prices] ORIGINAL 200000
[Arguments] ${json_path} ${expected_property} ${expected_value}
@{arr}= Get Value From Json ${response_body} ${json_path}
${length}= Get Length @{arr}
Should Be True ${length} > 0 No elements found at path '${json_path}'.

${hit}= Set Variable ${False}
FOR ${i} IN RANGE 0 ${length}
${el}= Get From List @{arr} ${i}
${got}= Run Keyword And Ignore Error Get From Dictionary ${el} ${expected_property}
${status}= Set Variable ${got}[0]
${raw}= Set Variable ${got}[1]
IF '${status}' == 'PASS'
${act_conv}= Run Keyword And Ignore Error Convert To Number ${raw}
IF '${act_conv}[0]' == 'PASS'
${actual}= Set Variable ${act_conv}[1]
ELSE
${actual}= Evaluate float(${raw})
END
${exp_conv}= Run Keyword And Ignore Error Convert To Number ${expected_value}
IF '${exp_conv}[0]' == 'PASS'
${expected}= Set Variable ${exp_conv}[1]
ELSE
${expected}= Evaluate float(${expected_value})
END

IF ${actual} < ${expected}
${hit}= Set Variable ${True}
Exit For Loop
END
END
END
Should Be True ${hit} No element at '${json_path}' has property '${expected_property}' less than '${expected_value}'.

Get company user id by customer reference:
[Documentation] This keyword sends the GET request to the ``/company-users?include=customers`` endpoint and returns company user id by customer reference. Sets variable : ``{companyUserId}``
...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Search_by_abstract_sku_per_store
Then I send a GET request: /catalog-search?q=${abstract.alternative_products.product_1.sku}
And Response status code should be: 200
And Response body parameter should be: [data][0][attributes][abstractProducts][0][abstractSku] ${abstract.alternative_products.product_1.sku}
And Response body parameter should be: [data][0][attributes][abstractProducts][0][prices][0][DEFAULT] ${abstract.alternative_products.product_1.price_de}
And Response body parameter should be either: [data][0][attributes][abstractProducts][0][prices][0][DEFAULT] [data][0][attributes][abstractProducts][0][prices][1][DEFAULT] ${abstract.alternative_products.product_1.price_de}
When I set Headers: store=AT
Then I send a GET request: /catalog-search?q=${abstract.alternative_products.product_1.sku}
And Response status code should be: 200
And Response body parameter should be: [data][0][attributes][abstractProducts][0][abstractSku] ${abstract.alternative_products.product_1.sku}
And Response body parameter should be: [data][0][attributes][abstractProducts][0][prices][0][DEFAULT] ${abstract.alternative_products.product_1.price_at}
And Response body parameter should be either: [data][0][attributes][abstractProducts][0][prices][0][DEFAULT] [data][0][attributes][abstractProducts][0][prices][1][DEFAULT] ${abstract.alternative_products.product_1.price_at}
34 changes: 10 additions & 24 deletions tests/api/b2b/glue/search_endpoints/catalog_search/positive.robot
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ Search_with_empty_search_criteria_all_default_values_check
And Response body parameter should be:
... [data][0][attributes][abstractProducts][0][prices][0][currency][name]
... ${currency.eur.name}
And Response body parameter should be greater than:
... [data][0][attributes][abstractProducts][0][prices][0][DEFAULT]
And Array element should contain property with value greater than at least once:
... [data][0][attributes][abstractProducts][0][prices] DEFAULT
... 1
# FIlters - all filters are NOT applied
And Each array element should contain property with value: [data][0][attributes][valueFacets] activeValue None
Expand Down Expand Up @@ -183,9 +183,7 @@ Search_by_concrete_sku
And Response body parameter should be:
... [data][0][attributes][abstractProducts][0][abstractName]
... ${abstract.alternative_products.product_1.name}
And Response body parameter should be greater than:
... [data][0][attributes][abstractProducts][0][prices][0][DEFAULT]
... 10
And Array element should contain property with value greater than at least once: [data][0][attributes][abstractProducts][0][prices] DEFAULT 10
#categories
And Response should contain the array of a certain size: [data][0][attributes][valueFacets][0][values] 4
#labels
Expand All @@ -210,9 +208,7 @@ Search_by_abstract_sku
And Response body parameter should be:
... [data][0][attributes][abstractProducts][0][abstractName]
... ${abstract.alternative_products.product_1.name}
And Response body parameter should be greater than:
... [data][0][attributes][abstractProducts][0][prices][0][DEFAULT]
... 10
And Array element should contain property with value greater than at least once: [data][0][attributes][abstractProducts][0][prices] DEFAULT 10
#categories
And Response should contain the array of a certain size: [data][0][attributes][valueFacets][0][values] 4
#labels
Expand Down Expand Up @@ -241,9 +237,7 @@ Search_by_full_name
And Response body parameter should be:
... [data][0][attributes][abstractProducts][0][abstractName]
... ${abstract.alternative_products.product_1.name}
And Response body parameter should be greater than:
... [data][0][attributes][abstractProducts][0][prices][0][DEFAULT]
... 10
And Array element should contain property with value greater than at least once: [data][0][attributes][abstractProducts][0][prices] DEFAULT 10
#categories
And Response should contain the array larger than a certain size:
... [data][0][attributes][valueFacets][0][values]
Expand Down Expand Up @@ -756,9 +750,7 @@ Search_with_specific_currency
And Response body parameter should be:
... [data][0][attributes][abstractProducts][0][prices][0][currency][name]
... ${currency.chf.name}
And Response body parameter should be greater than:
... [data][0][attributes][abstractProducts][0][prices][0][DEFAULT]
... 1
And Array element should contain property with value greater than at least once: [data][0][attributes][abstractProducts][0][prices] DEFAULT 1
And Response body has correct self link

##### PAGINATION AND SORTING #####
Expand Down Expand Up @@ -900,9 +892,7 @@ Search_sort_by_price_asc
And Response body parameter should be: [data][0][type] catalog-search
And Response body parameter should be: [data][0][attributes][sort][currentSortParam] price_asc
And Response body parameter should be: [data][0][attributes][sort][currentSortOrder] asc
And Response body parameter should be less than:
... [data][0][attributes][abstractProducts][0][prices][0][DEFAULT]
... 50
And Array element should contain property with value less than at least once: [data][0][attributes][abstractProducts][0][prices] DEFAULT 50
And Response body has correct self link

Search_sort_by_price_desc
Expand All @@ -913,9 +903,7 @@ Search_sort_by_price_desc
And Response body parameter should be: [data][0][type] catalog-search
And Response body parameter should be: [data][0][attributes][sort][currentSortParam] price_desc
And Response body parameter should be: [data][0][attributes][sort][currentSortOrder] desc
And Response body parameter should be greater than:
... [data][0][attributes][abstractProducts][0][prices][0][DEFAULT]
... 10000
And Array element should contain property with value greater than at least once: [data][0][attributes][abstractProducts][0][prices] DEFAULT 10000
And Response body has correct self link

Search_sort_by_price_filter_query_parameter_and_pagination
Expand All @@ -932,9 +920,7 @@ Search_sort_by_price_filter_query_parameter_and_pagination
And Response body parameter should be: [data][0][attributes][pagination][maxPage] 1
And Response should contain the array of a certain size: [data][0][attributes][abstractProducts] 18
And Array element should contain property with value at least once: [data][0][attributes][valueFacets] activeValue ${brand_1}
And Response body parameter should be greater than:
... [data][0][attributes][abstractProducts][0][prices][0][DEFAULT]
... 5000
And Array element should contain property with value greater than at least once: [data][0][attributes][abstractProducts][0][prices] DEFAULT 5000

Search_by_abstract_sku_with_abstract_include
When I send a GET request:
Expand All @@ -955,4 +941,4 @@ Search_by_abstract_sku_with_abstract_include
And Response include should contain certain entity type: abstract-products
And Response include element has self link: abstract-products
And Response body parameter should be: [included][0][id] ${abstract.alternative_products.product_1.sku}
And Response body has correct self link
And Response body has correct self link
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Search_with_empty_search_criteria_all_default_values_check
And Response body parameter should be: [data][0][attributes][abstractProducts][0][prices][0][currency][code] ${currency.eur.code}
And Response body parameter should be: [data][0][attributes][abstractProducts][0][prices][0][currency][symbol] ${currency.eur.symbol}
And Response body parameter should be: [data][0][attributes][abstractProducts][0][prices][0][currency][name] ${currency.eur.name}
And Response body parameter should be greater than: [data][0][attributes][abstractProducts][0][prices][0][DEFAULT] 1
And Array element should contain property with value greater than at least once: [data][0][attributes][abstractProducts][0][prices] DEFAULT 1
#Filters - category
And Response body parameter should contain: [data][0][attributes] valueFacets
And Response body parameter should be: [data][0][attributes][valueFacets][0][name] category
Expand Down Expand Up @@ -141,7 +141,7 @@ Search_by_concrete_sku
And Response should contain the array of a certain size: [data][0][attributes][abstractProducts] 1
And Response body parameter should be: [data][0][attributes][abstractProducts][0][abstractSku] ${abstract_product_with_alternative.sku}
And Response body parameter should be: [data][0][attributes][abstractProducts][0][abstractName] ${abstract_product_with_alternative.name}
And Response body parameter should be greater than: [data][0][attributes][abstractProducts][0][prices][0][DEFAULT] 10
And Array element should contain property with value greater than at least once: [data][0][attributes][abstractProducts][0][prices] DEFAULT 10
#categories
And Response should contain the array of a certain size: [data][0][attributes][valueFacets][0][values] 4
#labels
Expand Down Expand Up @@ -170,7 +170,7 @@ Search_by_abstract_sku
And Response should contain the array of a certain size: [data][0][attributes][abstractProducts] 3
And Response body parameter should be: [data][0][attributes][abstractProducts][2][abstractSku] ${abstract_product_with_alternative.sku}
And Response body parameter should be: [data][0][attributes][abstractProducts][2][abstractName] ${abstract_product_with_alternative.name}
And Response body parameter should be greater than: [data][0][attributes][abstractProducts][0][prices][0][DEFAULT] 10
And Array element should contain property with value greater than at least once: [data][0][attributes][abstractProducts][0][prices] DEFAULT 10
#categories
And Response should contain the array of a certain size: [data][0][attributes][valueFacets][0][values] 6
#labels
Expand Down Expand Up @@ -199,7 +199,7 @@ Search_by_full_name
And Response should contain the array of a certain size: [data][0][attributes][abstractProducts] 12
And Response body parameter should be: [data][0][attributes][abstractProducts][0][abstractSku] ${abstract_product_with_alternative.sku}
And Response body parameter should be: [data][0][attributes][abstractProducts][0][abstractName] ${abstract_product_with_alternative.name}
And Response body parameter should be greater than: [data][0][attributes][abstractProducts][0][prices][0][DEFAULT] 10
And Array element should contain property with value greater than at least once: [data][0][attributes][abstractProducts][0][prices] DEFAULT 10
#categories
And Response should contain the array larger than a certain size: [data][0][attributes][valueFacets][0][values] 4
#labels
Expand Down Expand Up @@ -547,7 +547,7 @@ Search_with_specific_currency
And Response body parameter should be: [data][0][attributes][abstractProducts][0][prices][0][currency][code] ${currency.chf.code}
And Response body parameter should be: [data][0][attributes][abstractProducts][0][prices][0][currency][symbol] ${currency.chf.symbol}
And Response body parameter should be: [data][0][attributes][abstractProducts][0][prices][0][currency][name] ${currency.chf.name}
And Response body parameter should be greater than: [data][0][attributes][abstractProducts][0][prices][0][DEFAULT] 1
And Array element should contain property with value greater than at least once: [data][0][attributes][abstractProducts][0][prices] DEFAULT 1
And Response body has correct self link

#### PAGINATION AND SORTING #####
Expand Down Expand Up @@ -662,7 +662,7 @@ Search_sort_by_price_asc
And Response body parameter should be: [data][0][type] catalog-search
And Response body parameter should be: [data][0][attributes][sort][currentSortParam] price_asc
And Response body parameter should be: [data][0][attributes][sort][currentSortOrder] asc
And Response body parameter should be less than: [data][0][attributes][abstractProducts][0][prices][0][DEFAULT] 50
And Array element should contain property with value less than at least once: [data][0][attributes][abstractProducts][0][prices] DEFAULT 50
And Response body has correct self link

Search_sort_by_price_desc
Expand All @@ -673,7 +673,7 @@ Search_sort_by_price_desc
And Response body parameter should be: [data][0][type] catalog-search
And Response body parameter should be: [data][0][attributes][sort][currentSortParam] price_desc
And Response body parameter should be: [data][0][attributes][sort][currentSortOrder] desc
And Response body parameter should be greater than: [data][0][attributes][abstractProducts][0][prices][0][DEFAULT] 10000
And Array element should contain property with value greater than at least once: [data][0][attributes][abstractProducts][0][prices] DEFAULT 10000
And Response body has correct self link

Search_sort_by_price_filter_query_parameter_and_pagination
Expand All @@ -689,7 +689,7 @@ Search_sort_by_price_filter_query_parameter_and_pagination
And Response body parameter should be: [data][0][attributes][pagination][maxPage] 2
And Response should contain the array of a certain size: [data][0][attributes][abstractProducts] 24
And Response body parameter should be: [data][0][attributes][valueFacets][4][activeValue] ${brand_4}
And Response body parameter should be: [data][0][attributes][abstractProducts][0][prices][0][DEFAULT] 345699
And Response body parameter should be either: [data][0][attributes][abstractProducts][0][prices][0][DEFAULT] [data][0][attributes][abstractProducts][0][prices][1][DEFAULT] 345699

Search_by_abstract_sku_with_abstract_include
When I send a GET request: /catalog-search?q=${abstract_product_with_alternative.sku}&include=abstract-products
Expand Down
Loading