From 12346950bfaaa183f48a8c61f0d1ac411cb9aafd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Wed, 28 Aug 2024 12:09:01 +0200 Subject: [PATCH 1/2] fix: remove non-JS list of products --- lib/ProductOpener/Display.pm | 3 +- .../common/includes/list_of_products.tt.html | 15 +- .../crawler-access-category-facet-page.html | 349 +- .../crawler-access-product-page.html | 323 +- ...r-does-not-get-facet-knowledge-panels.html | 355 +- ...ormal-user-access-category-facet-page.html | 349 +- .../normal-user-access-nested-facet-page.html | 349 +- .../normal-user-access-product-page.html | 323 +- ...ormal-user-get-facet-knowledge-panels.html | 355 +- .../normal-user-get-non-official-cc-lc.html | 9 +- .../product_read/get-existing-product.html | 328 +- .../country-cambodia-exists-but-empty.html | 15 +- ...ountry-doesnotexist-ingredients-apple.html | 9 +- .../unknown_tags/country-doesnotexist.html | 9 +- .../unknown_tags/country-france-exists.html | 351 +- .../unknown_tags/ingredient-apple-exists.html | 357 +- ...tyingredient-does-not-exist-and-empty.html | 9 +- ...gredient-does-not-exist-but-not-empty.html | 351 +- .../web_html/fr-categories.html | 1043 +++- .../web_html/fr-countries.html | 5 +- .../web_html/fr-index.html | 2404 ++++++++- .../web_html/fr-product-2.html | 328 +- .../web_html/fr-product.html | 328 +- .../web_html/fr-search-results-cached.html | 695 ++- .../web_html/fr-search-results-no-cache.html | 695 ++- .../web_html/fr-search-results.html | 695 ++- .../web_html/world-categories.html | 2069 +++++++- .../web_html/world-countries.html | 5 +- .../web_html/world-index-signedin.html | 4456 ++++++++++++++++- .../web_html/world-index.html | 4456 ++++++++++++++++- .../web_html/world-label-organic.html | 1727 ++++++- .../web_html/world-product.html | 328 +- .../world-products-multiple-codes.html | 6 +- .../web_html/world-search-results.html | 1721 ++++++- .../routing/api-v0-attribute-groups.json | 2 +- .../routing/api-v3-product-code.json | 2 +- .../routing/api-v3-product-gs1-data-uri.json | 2 +- .../facet-url-group-by-in-english.json | 10 +- .../routing/facet-url-group-by.json | 10 +- .../routing/facet-url-with-page-number.json | 10 +- ...acet-url-with-synonym-and-page-number.json | 2 +- .../routing/facet-url.json | 2 +- .../geoip-get-country-from-ipv4-us.json | 2 +- .../geoip-get-country-from-ipv6-fr.json | 2 +- .../routing/invalid-last-url-component.json | 2 +- .../routing/products-code.json | 2 +- .../routing/products-codes.json | 2 +- .../rate-limit-on-facet-registered-user.json | 6 +- 48 files changed, 23973 insertions(+), 903 deletions(-) diff --git a/lib/ProductOpener/Display.pm b/lib/ProductOpener/Display.pm index 8759ad37d219a..7c4d5870bbd5e 100644 --- a/lib/ProductOpener/Display.pm +++ b/lib/ProductOpener/Display.pm @@ -5645,7 +5645,8 @@ sub search_and_display_products ($request_ref, $query_ref, $sort_by, $limit, $pa my $products_json = '[]'; if (defined $request_ref->{structured_response}{products}) { - $products_json = $json->encode($request_ref->{structured_response}{products}); + # We indent the JSON in the generated HTML so that we can easily see diffs in integration tests outputs + $products_json = $json->indent->encode($request_ref->{structured_response}{products}); } my $contributor_prefs_json = $json->encode( diff --git a/templates/web/common/includes/list_of_products.tt.html b/templates/web/common/includes/list_of_products.tt.html index 9e9ec45767b58..c49c846cddca7 100755 --- a/templates/web/common/includes/list_of_products.tt.html +++ b/templates/web/common/includes/list_of_products.tt.html @@ -113,20 +113,9 @@ [% product.product_name %] - [% ELSE %] -
  • - [% IF product.product_name == '' %] - - [% ELSE %] - - [% END %] -
    [% product.img %]
    - [% product.product_name %] -
    -
  • - [% END %] [% END %] - [% IF (jqm.defined) && !(jqm_loadmore.defined) %] + [% END %] + [% IF (jqm.defined) && !(jqm_loadmore.defined) %] [% ELSE %] diff --git a/tests/integration/expected_test_results/page_crawler/crawler-access-category-facet-page.html b/tests/integration/expected_test_results/page_crawler/crawler-access-category-facet-page.html index 6b1d7b81f48c5..1b068d09f1cdc 100644 --- a/tests/integration/expected_test_results/page_crawler/crawler-access-category-facet-page.html +++ b/tests/integration/expected_test_results/page_crawler/crawler-access-category-facet-page.html @@ -486,19 +486,8 @@

    Hazelnut spreads

    -
  • - - - -
    - -
    - Only-Product - Nutella - 100 g -
    -
  • - - - + + @@ -671,8 +660,338 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/page_crawler/crawler-access-product-page.html b/tests/integration/expected_test_results/page_crawler/crawler-access-product-page.html index a0e259e3ae304..dcee1a5152d61 100644 --- a/tests/integration/expected_test_results/page_crawler/crawler-access-product-page.html +++ b/tests/integration/expected_test_results/page_crawler/crawler-access-product-page.html @@ -3735,7 +3735,328 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/page_crawler/crawler-does-not-get-facet-knowledge-panels.html b/tests/integration/expected_test_results/page_crawler/crawler-does-not-get-facet-knowledge-panels.html index ed9c37bc25103..c524b7a336a35 100644 --- a/tests/integration/expected_test_results/page_crawler/crawler-does-not-get-facet-knowledge-panels.html +++ b/tests/integration/expected_test_results/page_crawler/crawler-does-not-get-facet-knowledge-panels.html @@ -441,7 +441,11 @@

    Cakes

    @@ -549,19 +553,8 @@

    Cakes

    -
  • - - - -
    - -
    - Only-Product - Nutella - 100 g -
    -
  • - - - + + @@ -734,8 +727,338 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/page_crawler/normal-user-access-category-facet-page.html b/tests/integration/expected_test_results/page_crawler/normal-user-access-category-facet-page.html index 8a88966b59305..666e50f9537c6 100644 --- a/tests/integration/expected_test_results/page_crawler/normal-user-access-category-facet-page.html +++ b/tests/integration/expected_test_results/page_crawler/normal-user-access-category-facet-page.html @@ -527,19 +527,8 @@

    -
  • - - - -
    - -
    - Only-Product - Nutella - 100 g -
    -
  • - - - + + @@ -712,8 +701,338 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/page_crawler/normal-user-access-nested-facet-page.html b/tests/integration/expected_test_results/page_crawler/normal-user-access-nested-facet-page.html index 7fae1d3b24727..6b69377723a6e 100644 --- a/tests/integration/expected_test_results/page_crawler/normal-user-access-nested-facet-page.html +++ b/tests/integration/expected_test_results/page_crawler/normal-user-access-nested-facet-page.html @@ -522,19 +522,8 @@

    -
  • - - - -
    - -
    - Only-Product - Nutella - 100 g -
    -
  • - - - + + @@ -707,8 +696,338 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/page_crawler/normal-user-access-product-page.html b/tests/integration/expected_test_results/page_crawler/normal-user-access-product-page.html index a0e259e3ae304..dcee1a5152d61 100644 --- a/tests/integration/expected_test_results/page_crawler/normal-user-access-product-page.html +++ b/tests/integration/expected_test_results/page_crawler/normal-user-access-product-page.html @@ -3735,7 +3735,328 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/page_crawler/normal-user-get-facet-knowledge-panels.html b/tests/integration/expected_test_results/page_crawler/normal-user-get-facet-knowledge-panels.html index e85e487ef0582..b9bc939e90dd5 100644 --- a/tests/integration/expected_test_results/page_crawler/normal-user-get-facet-knowledge-panels.html +++ b/tests/integration/expected_test_results/page_crawler/normal-user-get-facet-knowledge-panels.html @@ -441,7 +441,11 @@

    Cakes

    @@ -590,19 +594,8 @@

    -
  • - - - -
    - -
    - Only-Product - Nutella - 100 g -
    -
  • - - - + + @@ -775,8 +768,338 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/page_crawler/normal-user-get-non-official-cc-lc.html b/tests/integration/expected_test_results/page_crawler/normal-user-get-non-official-cc-lc.html index 23f20f155014c..7b38bfd046f54 100644 --- a/tests/integration/expected_test_results/page_crawler/normal-user-get-non-official-cc-lc.html +++ b/tests/integration/expected_test_results/page_crawler/normal-user-get-non-official-cc-lc.html @@ -565,8 +565,13 @@

    Descubre el proyecto

    diff --git a/tests/integration/expected_test_results/product_read/get-existing-product.html b/tests/integration/expected_test_results/product_read/get-existing-product.html index 1885df42bc7b0..eb91ab5273357 100644 --- a/tests/integration/expected_test_results/product_read/get-existing-product.html +++ b/tests/integration/expected_test_results/product_read/get-existing-product.html @@ -4896,7 +4896,333 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/unknown_tags/country-cambodia-exists-but-empty.html b/tests/integration/expected_test_results/unknown_tags/country-cambodia-exists-but-empty.html index df5ef3e46a485..e7156aa70ad57 100644 --- a/tests/integration/expected_test_results/unknown_tags/country-cambodia-exists-but-empty.html +++ b/tests/integration/expected_test_results/unknown_tags/country-cambodia-exists-but-empty.html @@ -397,7 +397,11 @@

    Cambodia

    @@ -645,8 +649,13 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/unknown_tags/country-doesnotexist-ingredients-apple.html b/tests/integration/expected_test_results/unknown_tags/country-doesnotexist-ingredients-apple.html index fb6eb288355c5..1966787dd8819 100644 --- a/tests/integration/expected_test_results/unknown_tags/country-doesnotexist-ingredients-apple.html +++ b/tests/integration/expected_test_results/unknown_tags/country-doesnotexist-ingredients-apple.html @@ -509,8 +509,13 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/unknown_tags/country-doesnotexist.html b/tests/integration/expected_test_results/unknown_tags/country-doesnotexist.html index fb6eb288355c5..1966787dd8819 100644 --- a/tests/integration/expected_test_results/unknown_tags/country-doesnotexist.html +++ b/tests/integration/expected_test_results/unknown_tags/country-doesnotexist.html @@ -509,8 +509,13 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/unknown_tags/country-france-exists.html b/tests/integration/expected_test_results/unknown_tags/country-france-exists.html index 532aafe9cf129..41a54ca2ce232 100644 --- a/tests/integration/expected_test_results/unknown_tags/country-france-exists.html +++ b/tests/integration/expected_test_results/unknown_tags/country-france-exists.html @@ -518,19 +518,8 @@

    -
  • - - - -
    - -
    - test - 100 g -
    -
  • - - - + + @@ -703,8 +692,340 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/unknown_tags/ingredient-apple-exists.html b/tests/integration/expected_test_results/unknown_tags/ingredient-apple-exists.html index 44407b94c4230..dbc053e07d2d7 100644 --- a/tests/integration/expected_test_results/unknown_tags/ingredient-apple-exists.html +++ b/tests/integration/expected_test_results/unknown_tags/ingredient-apple-exists.html @@ -430,7 +430,11 @@

    Apple

    @@ -579,19 +583,8 @@

    -
  • - - - -
    - -
    - test - 100 g -
    -
  • - - - + + @@ -764,8 +757,340 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/unknown_tags/ingredient-someunknownandemptyingredient-does-not-exist-and-empty.html b/tests/integration/expected_test_results/unknown_tags/ingredient-someunknownandemptyingredient-does-not-exist-and-empty.html index fb6eb288355c5..1966787dd8819 100644 --- a/tests/integration/expected_test_results/unknown_tags/ingredient-someunknownandemptyingredient-does-not-exist-and-empty.html +++ b/tests/integration/expected_test_results/unknown_tags/ingredient-someunknownandemptyingredient-does-not-exist-and-empty.html @@ -509,8 +509,13 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/unknown_tags/ingredient-someunknowningredient-does-not-exist-but-not-empty.html b/tests/integration/expected_test_results/unknown_tags/ingredient-someunknowningredient-does-not-exist-but-not-empty.html index 398d60da34144..bcecb0e8f8e1a 100644 --- a/tests/integration/expected_test_results/unknown_tags/ingredient-someunknowningredient-does-not-exist-but-not-empty.html +++ b/tests/integration/expected_test_results/unknown_tags/ingredient-someunknowningredient-does-not-exist-but-not-empty.html @@ -518,19 +518,8 @@

    -
  • - - - -
    - -
    - test - 100 g -
    -
  • - - - + + @@ -703,8 +692,340 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/web_html/fr-categories.html b/tests/integration/expected_test_results/web_html/fr-categories.html index 650a451cbe346..5b0a2b0cfa9dd 100644 --- a/tests/integration/expected_test_results/web_html/fr-categories.html +++ b/tests/integration/expected_test_results/web_html/fr-categories.html @@ -451,7 +451,11 @@

    Desserts

    @@ -606,44 +610,12 @@

    -
  • - - - -
    Tarte aux pommes et aux framboise bio avec une photo - Produit -
    - Tarte aux pommes et aux framboise bio avec une photo - Les tartes de Robert - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - Tarte aux pommes et aux framboise bio - Les tartes de Robert - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - Very good vanilla ice cream with no sugar and no additives - Alice's ice creams - 100 g -
    -
  • - + + + + @@ -816,8 +788,1001 @@

    Découvrez le projet

    diff --git a/tests/integration/expected_test_results/web_html/fr-countries.html b/tests/integration/expected_test_results/web_html/fr-countries.html index 6d2306fc2458c..be1f1523e772c 100644 --- a/tests/integration/expected_test_results/web_html/fr-countries.html +++ b/tests/integration/expected_test_results/web_html/fr-countries.html @@ -537,7 +537,10 @@

    Découvrez le projet

    diff --git a/tests/integration/expected_test_results/web_html/fr-product-2.html b/tests/integration/expected_test_results/web_html/fr-product-2.html index 293550ba10ce7..62318a8147c93 100644 --- a/tests/integration/expected_test_results/web_html/fr-product-2.html +++ b/tests/integration/expected_test_results/web_html/fr-product-2.html @@ -3955,7 +3955,333 @@

    Découvrez le projet

    diff --git a/tests/integration/expected_test_results/web_html/fr-product.html b/tests/integration/expected_test_results/web_html/fr-product.html index a2c5ae6885e11..f49f5492f8e69 100644 --- a/tests/integration/expected_test_results/web_html/fr-product.html +++ b/tests/integration/expected_test_results/web_html/fr-product.html @@ -3969,7 +3969,333 @@

    Découvrez le projet

    diff --git a/tests/integration/expected_test_results/web_html/fr-search-results-cached.html b/tests/integration/expected_test_results/web_html/fr-search-results-cached.html index 059d5255b76e1..282addb6ed57c 100644 --- a/tests/integration/expected_test_results/web_html/fr-search-results-cached.html +++ b/tests/integration/expected_test_results/web_html/fr-search-results-cached.html @@ -458,31 +458,10 @@

    Résultats de la recherche - France

    -
  • - - - -
    - -
    - Tarte aux pommes et aux framboise bio - Les tartes de Robert - 100 g -
    -
  • - - - -
  • - - - -
    Tarte aux pommes et aux framboise bio avec une photo - Produit -
    - Tarte aux pommes et aux framboise bio avec une photo - Les tartes de Robert - 100 g -
    -
  • - - + + + @@ -659,8 +638,672 @@

    Découvrez le projet

    diff --git a/tests/integration/expected_test_results/web_html/fr-search-results-no-cache.html b/tests/integration/expected_test_results/web_html/fr-search-results-no-cache.html index 771548e93eccd..3e8d09e7b1bbd 100644 --- a/tests/integration/expected_test_results/web_html/fr-search-results-no-cache.html +++ b/tests/integration/expected_test_results/web_html/fr-search-results-no-cache.html @@ -458,30 +458,10 @@

    Résultats de la recherche - France

    -
  • - - - -
    Tarte aux pommes et aux framboise bio - Produit -
    - Tarte aux pommes et aux framboise bio - Les tartes de Robert - 100 g -
    -
  • - - - -
  • - - - -
    Tarte aux pommes et aux framboise bio avec une photo - Produit -
    - Tarte aux pommes et aux framboise bio avec une photo - Les tartes de Robert - 100 g -
    -
  • - - + + + @@ -658,8 +638,673 @@

    Découvrez le projet

    diff --git a/tests/integration/expected_test_results/web_html/fr-search-results.html b/tests/integration/expected_test_results/web_html/fr-search-results.html index 059d5255b76e1..282addb6ed57c 100644 --- a/tests/integration/expected_test_results/web_html/fr-search-results.html +++ b/tests/integration/expected_test_results/web_html/fr-search-results.html @@ -458,31 +458,10 @@

    Résultats de la recherche - France

    -
  • - - - -
    - -
    - Tarte aux pommes et aux framboise bio - Les tartes de Robert - 100 g -
    -
  • - - - -
  • - - - -
    Tarte aux pommes et aux framboise bio avec une photo - Produit -
    - Tarte aux pommes et aux framboise bio avec une photo - Les tartes de Robert - 100 g -
    -
  • - - + + + @@ -659,8 +638,672 @@

    Découvrez le projet

    diff --git a/tests/integration/expected_test_results/web_html/world-categories.html b/tests/integration/expected_test_results/web_html/world-categories.html index 47bd057bf3d17..022306c234028 100644 --- a/tests/integration/expected_test_results/web_html/world-categories.html +++ b/tests/integration/expected_test_results/web_html/world-categories.html @@ -451,7 +451,11 @@

    Desserts

    @@ -726,83 +730,18 @@

    -
  • - - - -
    Tarte aux pommes et aux framboise bio avec une photo - Product -
    - Organic apple and raspberry pie with a picture - Les tartes de Robert - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - Apple pie - Bob's pies - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - Organic apple and raspberry pie - Les tartes de Robert - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - Very bad vanilla ice cream with lots of sugar and additives - Bob's ice creams - 100 g -
    -
  • - - + -
  • - - - -
    - -
    - Very good vanilla ice cream with no sugar and no additives - Alice's ice creams - 100 g -
    -
  • - + + -
  • - - - -
    - -
    - Tarta de manzana - Pablo's tartas - 100 g -
    -
  • - + + + + @@ -975,8 +914,1988 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/web_html/world-countries.html b/tests/integration/expected_test_results/web_html/world-countries.html index 054ac8c261f5b..d305c62bdb4aa 100644 --- a/tests/integration/expected_test_results/web_html/world-countries.html +++ b/tests/integration/expected_test_results/web_html/world-countries.html @@ -549,7 +549,10 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/web_html/world-index.html b/tests/integration/expected_test_results/web_html/world-index.html index 5bbdde0d702fa..448f00d06c378 100644 --- a/tests/integration/expected_test_results/web_html/world-index.html +++ b/tests/integration/expected_test_results/web_html/world-index.html @@ -592,174 +592,32 @@

    Contribute

    -
  • - - - -
    Tarte aux pommes et aux framboise bio avec une photo - Product -
    - Organic apple and raspberry pie with a picture - Les tartes de Robert - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - Olio d'oliva - Mario's olive oils - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - Crema di nocciole - Bob's creme - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - ラムネレモネード - ラムネ - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - Tarta de manzana - Pablo's tartas - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - Organic apple and raspberry juice - Bob's juices - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - Organic apple juice - Bob's juices - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - Vegan pizza with basil and oregano - Bob's pizzas - 100 g -
    -
  • - + + -
  • - - - -
    - -
    - Very good vanilla ice cream with no sugar and no additives - Alice's ice creams - 100 g -
    -
  • - + + -
  • - - - -
    - -
    - Very bad vanilla ice cream with lots of sugar and additives - Bob's ice creams - 100 g -
    -
  • - + + -
  • - - - -
    - -
    - test_default - Bob's salads - 100 g -
    -
  • - + + -
  • - - - -
    - -
    - Organic apple and raspberry pie - Les tartes de Robert - 100 g -
    -
  • - + + -
  • - - - -
    - -
    - Apple pie - Bob's pies - 100 g -
    -
  • - + + + + @@ -931,8 +789,4290 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/web_html/world-label-organic.html b/tests/integration/expected_test_results/web_html/world-label-organic.html index 42bad2511db70..acd209ef1b86c 100644 --- a/tests/integration/expected_test_results/web_html/world-label-organic.html +++ b/tests/integration/expected_test_results/web_html/world-label-organic.html @@ -445,7 +445,11 @@

    Organic

    @@ -720,70 +724,16 @@

    -
  • - - - -
    Tarte aux pommes et aux framboise bio avec une photo - Product -
    - Organic apple and raspberry pie with a picture - Les tartes de Robert - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - Organic apple and raspberry pie - Les tartes de Robert - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - Organic apple juice - Bob's juices - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - Organic apple and raspberry juice - Bob's juices - 100 g -
    -
  • - + + -
  • - - - -
    - -
    - Olio d'oliva - Mario's olive oils - 100 g -
    -
  • - + + + + @@ -956,8 +906,1659 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/web_html/world-product.html b/tests/integration/expected_test_results/web_html/world-product.html index 539296c2f4bb3..39836a7ba2960 100644 --- a/tests/integration/expected_test_results/web_html/world-product.html +++ b/tests/integration/expected_test_results/web_html/world-product.html @@ -4466,7 +4466,333 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/web_html/world-products-multiple-codes.html b/tests/integration/expected_test_results/web_html/world-products-multiple-codes.html index decf427addc52..871596b76fd1f 100644 --- a/tests/integration/expected_test_results/web_html/world-products-multiple-codes.html +++ b/tests/integration/expected_test_results/web_html/world-products-multiple-codes.html @@ -519,7 +519,11 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/web_html/world-search-results.html b/tests/integration/expected_test_results/web_html/world-search-results.html index 7a60329f9cb9f..dd8fe07f4775b 100644 --- a/tests/integration/expected_test_results/web_html/world-search-results.html +++ b/tests/integration/expected_test_results/web_html/world-search-results.html @@ -456,70 +456,16 @@

    Search results - World

    -
  • - - - -
    - -
    - Apple pie - Bob's pies - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - Organic apple and raspberry pie - Les tartes de Robert - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - Organic apple juice - Bob's juices - 100 g -
    -
  • - - - -
  • - - - -
    - -
    - Organic apple and raspberry juice - Bob's juices - 100 g -
    -
  • - + + -
  • - - - -
    Tarte aux pommes et aux framboise bio avec une photo - Product -
    - Organic apple and raspberry pie with a picture - Les tartes de Robert - 100 g -
    -
  • - + + + + @@ -696,8 +642,1659 @@

    Discover the project

    diff --git a/tests/unit/expected_test_results/routing/api-v0-attribute-groups.json b/tests/unit/expected_test_results/routing/api-v0-attribute-groups.json index 086ff732fc2bb..e7cfcb322a1e7 100644 --- a/tests/unit/expected_test_results/routing/api-v0-attribute-groups.json +++ b/tests/unit/expected_test_results/routing/api-v0-attribute-groups.json @@ -15,8 +15,8 @@ "original_query_string" : "api/v0/attribute_groups", "page" : 1, "query_string" : "api/v0/attribute_groups", - "rate_limiter_bucket" : null, "rate_limiter_blocking" : 0, + "rate_limiter_bucket" : null, "rate_limiter_limit" : null, "rate_limiter_user_requests" : null } diff --git a/tests/unit/expected_test_results/routing/api-v3-product-code.json b/tests/unit/expected_test_results/routing/api-v3-product-code.json index 22b31178d8f8a..a3a3c09e0089c 100644 --- a/tests/unit/expected_test_results/routing/api-v3-product-code.json +++ b/tests/unit/expected_test_results/routing/api-v3-product-code.json @@ -17,8 +17,8 @@ "original_query_string" : "api/v3/product/03564703999971", "page" : 1, "query_string" : "api/v3/product/03564703999971", - "rate_limiter_bucket" : "product", "rate_limiter_blocking" : 0, + "rate_limiter_bucket" : "product", "rate_limiter_limit" : 100, "rate_limiter_user_requests" : null } diff --git a/tests/unit/expected_test_results/routing/api-v3-product-gs1-data-uri.json b/tests/unit/expected_test_results/routing/api-v3-product-gs1-data-uri.json index 073261cd5c997..97af1dded4e1c 100644 --- a/tests/unit/expected_test_results/routing/api-v3-product-gs1-data-uri.json +++ b/tests/unit/expected_test_results/routing/api-v3-product-gs1-data-uri.json @@ -17,8 +17,8 @@ "original_query_string" : "api/v3/product/https%3A%2F%2Fid.gs1.org%2F01%2F03564703999971%2F10%2FABC%2F21%2F123456%3F17%3D211200", "page" : 1, "query_string" : "api/v3/product/https%3A%2F%2Fid.gs1.org%2F01%2F03564703999971%2F10%2FABC%2F21%2F123456%3F17%3D211200", - "rate_limiter_bucket" : "product", "rate_limiter_blocking" : 0, + "rate_limiter_bucket" : "product", "rate_limiter_limit" : 100, "rate_limiter_user_requests" : null } diff --git a/tests/unit/expected_test_results/routing/facet-url-group-by-in-english.json b/tests/unit/expected_test_results/routing/facet-url-group-by-in-english.json index 45e570edc10e9..92b7108dcd606 100644 --- a/tests/unit/expected_test_results/routing/facet-url-group-by-in-english.json +++ b/tests/unit/expected_test_results/routing/facet-url-group-by-in-english.json @@ -11,6 +11,10 @@ "page" : 1, "param" : {}, "query_string" : "category/breads/ingredients", + "rate_limiter_blocking" : 0, + "rate_limiter_bucket" : "facet_tags", + "rate_limiter_limit" : null, + "rate_limiter_user_requests" : null, "tag" : "es:breads", "tag_prefix" : "", "tagid" : "es:breads", @@ -22,9 +26,5 @@ "tagtype" : "categories" } ], - "tagtype" : "categories", - "rate_limiter_bucket": "facet_tags", - "rate_limiter_blocking" : 0, - "rate_limiter_limit" : null, - "rate_limiter_user_requests" : null + "tagtype" : "categories" } diff --git a/tests/unit/expected_test_results/routing/facet-url-group-by.json b/tests/unit/expected_test_results/routing/facet-url-group-by.json index ce1fa706725a4..dd4377e92ca34 100644 --- a/tests/unit/expected_test_results/routing/facet-url-group-by.json +++ b/tests/unit/expected_test_results/routing/facet-url-group-by.json @@ -11,6 +11,10 @@ "page" : 1, "param" : {}, "query_string" : "category/breads/ingredients", + "rate_limiter_blocking" : 0, + "rate_limiter_bucket" : "facet_tags", + "rate_limiter_limit" : null, + "rate_limiter_user_requests" : null, "tag" : "en:breads", "tag_prefix" : "", "tagid" : "en:breads", @@ -22,9 +26,5 @@ "tagtype" : "categories" } ], - "tagtype" : "categories", - "rate_limiter_bucket": "facet_tags", - "rate_limiter_blocking" : 0, - "rate_limiter_limit" : null, - "rate_limiter_user_requests" : null + "tagtype" : "categories" } diff --git a/tests/unit/expected_test_results/routing/facet-url-with-page-number.json b/tests/unit/expected_test_results/routing/facet-url-with-page-number.json index 1b21c84740f9a..78fa436faafae 100644 --- a/tests/unit/expected_test_results/routing/facet-url-with-page-number.json +++ b/tests/unit/expected_test_results/routing/facet-url-with-page-number.json @@ -10,6 +10,10 @@ "page" : "4", "param" : {}, "query_string" : "category/breads/4", + "rate_limiter_blocking" : 0, + "rate_limiter_bucket" : "facet_products", + "rate_limiter_limit" : null, + "rate_limiter_user_requests" : null, "tag" : "en:breads", "tag_prefix" : "", "tagid" : "en:breads", @@ -21,9 +25,5 @@ "tagtype" : "categories" } ], - "tagtype" : "categories", - "rate_limiter_bucket" : "facet_products", - "rate_limiter_blocking" : 0, - "rate_limiter_limit" : null, - "rate_limiter_user_requests" : null + "tagtype" : "categories" } diff --git a/tests/unit/expected_test_results/routing/facet-url-with-synonym-and-page-number.json b/tests/unit/expected_test_results/routing/facet-url-with-synonym-and-page-number.json index 4af23adc6306d..6f8147875e244 100644 --- a/tests/unit/expected_test_results/routing/facet-url-with-synonym-and-page-number.json +++ b/tests/unit/expected_test_results/routing/facet-url-with-synonym-and-page-number.json @@ -10,8 +10,8 @@ "page" : "4", "param" : {}, "query_string" : "category/bread/4", - "rate_limiter_bucket" : "facet_products", "rate_limiter_blocking" : 0, + "rate_limiter_bucket" : "facet_products", "rate_limiter_limit" : 5, "rate_limiter_user_requests" : null, "tag" : "en:bread", diff --git a/tests/unit/expected_test_results/routing/facet-url.json b/tests/unit/expected_test_results/routing/facet-url.json index 19212b9bbd266..c28611e55b1d3 100644 --- a/tests/unit/expected_test_results/routing/facet-url.json +++ b/tests/unit/expected_test_results/routing/facet-url.json @@ -10,8 +10,8 @@ "page" : 1, "param" : {}, "query_string" : "category/breads", - "rate_limiter_bucket" : "facet_products", "rate_limiter_blocking" : 0, + "rate_limiter_bucket" : "facet_products", "rate_limiter_limit" : 10, "rate_limiter_user_requests" : null, "tag" : "en:breads", diff --git a/tests/unit/expected_test_results/routing/geoip-get-country-from-ipv4-us.json b/tests/unit/expected_test_results/routing/geoip-get-country-from-ipv4-us.json index 9b4e13babe1c6..16da7be6b7da2 100644 --- a/tests/unit/expected_test_results/routing/geoip-get-country-from-ipv4-us.json +++ b/tests/unit/expected_test_results/routing/geoip-get-country-from-ipv4-us.json @@ -16,8 +16,8 @@ "original_query_string" : "api/v3/geopip/12.45.23.45", "page" : 1, "query_string" : "api/v3/geopip/12.45.23.45", - "rate_limiter_bucket" : null, "rate_limiter_blocking" : 0, + "rate_limiter_bucket" : null, "rate_limiter_limit" : null, "rate_limiter_user_requests" : null } diff --git a/tests/unit/expected_test_results/routing/geoip-get-country-from-ipv6-fr.json b/tests/unit/expected_test_results/routing/geoip-get-country-from-ipv6-fr.json index b9b68369dfad3..53f2260b80d52 100644 --- a/tests/unit/expected_test_results/routing/geoip-get-country-from-ipv6-fr.json +++ b/tests/unit/expected_test_results/routing/geoip-get-country-from-ipv6-fr.json @@ -16,8 +16,8 @@ "original_query_string" : "api/v3/geopip/2001:ac8:25:3b::e01d", "page" : 1, "query_string" : "api/v3/geopip/2001:ac8:25:3b::e01d", - "rate_limiter_bucket" : null, "rate_limiter_blocking" : 0, + "rate_limiter_bucket" : null, "rate_limiter_limit" : null, "rate_limiter_user_requests" : null } diff --git a/tests/unit/expected_test_results/routing/invalid-last-url-component.json b/tests/unit/expected_test_results/routing/invalid-last-url-component.json index 2087dba75209f..097650297babb 100644 --- a/tests/unit/expected_test_results/routing/invalid-last-url-component.json +++ b/tests/unit/expected_test_results/routing/invalid-last-url-component.json @@ -13,8 +13,8 @@ "page" : 1, "param" : {}, "query_string" : "category/breads/no-nutrition-data", - "rate_limiter_bucket" : null, "rate_limiter_blocking" : 0, + "rate_limiter_bucket" : null, "rate_limiter_limit" : null, "rate_limiter_user_requests" : null, "status_code" : 404, diff --git a/tests/unit/expected_test_results/routing/products-code.json b/tests/unit/expected_test_results/routing/products-code.json index 0b6fca1b89e86..2c439c9fd1ceb 100644 --- a/tests/unit/expected_test_results/routing/products-code.json +++ b/tests/unit/expected_test_results/routing/products-code.json @@ -11,8 +11,8 @@ "original_query_string" : "products/3564703999971", "page" : 1, "query_string" : "products/3564703999971", - "rate_limiter_bucket" : null, "rate_limiter_blocking" : 0, + "rate_limiter_bucket" : null, "rate_limiter_limit" : null, "rate_limiter_user_requests" : null, "search" : 1 diff --git a/tests/unit/expected_test_results/routing/products-codes.json b/tests/unit/expected_test_results/routing/products-codes.json index 463049c79130d..fd143a24dbb88 100644 --- a/tests/unit/expected_test_results/routing/products-codes.json +++ b/tests/unit/expected_test_results/routing/products-codes.json @@ -11,8 +11,8 @@ "original_query_string" : "products/3564703999971,3564703999972", "page" : 1, "query_string" : "products/3564703999971,3564703999972", - "rate_limiter_bucket" : null, "rate_limiter_blocking" : 0, + "rate_limiter_bucket" : null, "rate_limiter_limit" : null, "rate_limiter_user_requests" : null, "search" : 1 diff --git a/tests/unit/expected_test_results/routing/rate-limit-on-facet-registered-user.json b/tests/unit/expected_test_results/routing/rate-limit-on-facet-registered-user.json index beaad2a0913aa..bedc1fa209201 100644 --- a/tests/unit/expected_test_results/routing/rate-limit-on-facet-registered-user.json +++ b/tests/unit/expected_test_results/routing/rate-limit-on-facet-registered-user.json @@ -10,14 +10,13 @@ "page" : 1, "param" : {}, "query_string" : "category/breads", - "rate_limiter_bucket" : "facet_products", "rate_limiter_blocking" : 0, + "rate_limiter_bucket" : "facet_products", "rate_limiter_limit" : 10, "rate_limiter_user_requests" : null, "tag" : "en:breads", "tag_prefix" : "", "tagid" : "en:breads", - "user_id": "userid", "tags" : [ { "tag" : "en:breads", @@ -26,5 +25,6 @@ "tagtype" : "categories" } ], - "tagtype" : "categories" + "tagtype" : "categories", + "user_id" : "userid" } From 3ddf1890f3b20050df2b62117b2b63bc2017de81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Wed, 28 Aug 2024 14:36:45 +0200 Subject: [PATCH 2/2] json indent --- lib/ProductOpener/Display.pm | 3 +- .../crawler-access-category-facet-page.html | 6 +- .../crawler-access-product-page.html | 323 +---------------- ...r-does-not-get-facet-knowledge-panels.html | 12 +- ...ormal-user-access-category-facet-page.html | 6 +- .../normal-user-access-nested-facet-page.html | 6 +- .../normal-user-access-product-page.html | 323 +---------------- ...ormal-user-get-facet-knowledge-panels.html | 12 +- .../normal-user-get-non-official-cc-lc.html | 6 +- .../product_read/get-existing-product.html | 328 +----------------- .../country-cambodia-exists-but-empty.html | 12 +- ...ountry-doesnotexist-ingredients-apple.html | 6 +- .../unknown_tags/country-doesnotexist.html | 6 +- .../unknown_tags/country-france-exists.html | 6 +- .../unknown_tags/ingredient-apple-exists.html | 12 +- ...tyingredient-does-not-exist-and-empty.html | 6 +- ...gredient-does-not-exist-but-not-empty.html | 6 +- .../web_html/fr-categories.html | 12 +- .../web_html/fr-countries.html | 5 +- .../web_html/fr-index.html | 6 +- .../web_html/fr-product-2.html | 328 +----------------- .../web_html/fr-product.html | 328 +----------------- .../web_html/fr-search-results-cached.html | 6 +- .../web_html/fr-search-results-no-cache.html | 6 +- .../web_html/fr-search-results.html | 6 +- .../web_html/world-categories.html | 12 +- .../web_html/world-countries.html | 5 +- .../web_html/world-index-signedin.html | 6 +- .../web_html/world-index.html | 6 +- .../web_html/world-label-organic.html | 12 +- .../web_html/world-product.html | 328 +----------------- .../world-products-multiple-codes.html | 6 +- .../web_html/world-search-results.html | 6 +- 33 files changed, 41 insertions(+), 2116 deletions(-) diff --git a/lib/ProductOpener/Display.pm b/lib/ProductOpener/Display.pm index 7c4d5870bbd5e..043199964c139 100644 --- a/lib/ProductOpener/Display.pm +++ b/lib/ProductOpener/Display.pm @@ -227,6 +227,7 @@ my $uri_finder = URI::Find->new( # Sort keys of JSON output # $json has utf8 disabled: it encodes to Perl Unicode strings my $json = JSON::MaybeXS->new->utf8(0)->allow_nonref->canonical; +my $json_indent = JSON::MaybeXS->new->indent(1)->utf8(0)->allow_nonref->canonical; # $json_utf8 has utf8 enabled: it encodes to UTF-8 bytes my $json_utf8 = JSON::MaybeXS->new->utf8(1)->allow_nonref->canonical; @@ -5646,7 +5647,7 @@ sub search_and_display_products ($request_ref, $query_ref, $sort_by, $limit, $pa if (defined $request_ref->{structured_response}{products}) { # We indent the JSON in the generated HTML so that we can easily see diffs in integration tests outputs - $products_json = $json->indent->encode($request_ref->{structured_response}{products}); + $products_json = $json_indent->encode($request_ref->{structured_response}{products}); } my $contributor_prefs_json = $json->encode( diff --git a/tests/integration/expected_test_results/page_crawler/crawler-access-category-facet-page.html b/tests/integration/expected_test_results/page_crawler/crawler-access-category-facet-page.html index 1b068d09f1cdc..9f773b5e5acc8 100644 --- a/tests/integration/expected_test_results/page_crawler/crawler-access-category-facet-page.html +++ b/tests/integration/expected_test_results/page_crawler/crawler-access-category-facet-page.html @@ -660,11 +660,7 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/page_crawler/crawler-does-not-get-facet-knowledge-panels.html b/tests/integration/expected_test_results/page_crawler/crawler-does-not-get-facet-knowledge-panels.html index c524b7a336a35..f917a1d441fcd 100644 --- a/tests/integration/expected_test_results/page_crawler/crawler-does-not-get-facet-knowledge-panels.html +++ b/tests/integration/expected_test_results/page_crawler/crawler-does-not-get-facet-knowledge-panels.html @@ -441,11 +441,7 @@

    Cakes

    @@ -727,11 +723,7 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/page_crawler/normal-user-get-facet-knowledge-panels.html b/tests/integration/expected_test_results/page_crawler/normal-user-get-facet-knowledge-panels.html index b9bc939e90dd5..14ff13c1acaf2 100644 --- a/tests/integration/expected_test_results/page_crawler/normal-user-get-facet-knowledge-panels.html +++ b/tests/integration/expected_test_results/page_crawler/normal-user-get-facet-knowledge-panels.html @@ -441,11 +441,7 @@

    Cakes

    @@ -768,11 +764,7 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/product_read/get-existing-product.html b/tests/integration/expected_test_results/product_read/get-existing-product.html index eb91ab5273357..1885df42bc7b0 100644 --- a/tests/integration/expected_test_results/product_read/get-existing-product.html +++ b/tests/integration/expected_test_results/product_read/get-existing-product.html @@ -4896,333 +4896,7 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/unknown_tags/country-cambodia-exists-but-empty.html b/tests/integration/expected_test_results/unknown_tags/country-cambodia-exists-but-empty.html index e7156aa70ad57..ad193dccdba20 100644 --- a/tests/integration/expected_test_results/unknown_tags/country-cambodia-exists-but-empty.html +++ b/tests/integration/expected_test_results/unknown_tags/country-cambodia-exists-but-empty.html @@ -397,11 +397,7 @@

    Cambodia

    @@ -649,11 +645,7 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/unknown_tags/country-doesnotexist-ingredients-apple.html b/tests/integration/expected_test_results/unknown_tags/country-doesnotexist-ingredients-apple.html index 1966787dd8819..fca460ea8bbe0 100644 --- a/tests/integration/expected_test_results/unknown_tags/country-doesnotexist-ingredients-apple.html +++ b/tests/integration/expected_test_results/unknown_tags/country-doesnotexist-ingredients-apple.html @@ -509,11 +509,7 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/unknown_tags/country-doesnotexist.html b/tests/integration/expected_test_results/unknown_tags/country-doesnotexist.html index 1966787dd8819..fca460ea8bbe0 100644 --- a/tests/integration/expected_test_results/unknown_tags/country-doesnotexist.html +++ b/tests/integration/expected_test_results/unknown_tags/country-doesnotexist.html @@ -509,11 +509,7 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/unknown_tags/country-france-exists.html b/tests/integration/expected_test_results/unknown_tags/country-france-exists.html index 41a54ca2ce232..0fc1023ac4865 100644 --- a/tests/integration/expected_test_results/unknown_tags/country-france-exists.html +++ b/tests/integration/expected_test_results/unknown_tags/country-france-exists.html @@ -692,11 +692,7 @@

    Discover the project

    @@ -757,11 +753,7 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/unknown_tags/ingredient-someunknowningredient-does-not-exist-but-not-empty.html b/tests/integration/expected_test_results/unknown_tags/ingredient-someunknowningredient-does-not-exist-but-not-empty.html index bcecb0e8f8e1a..f23fe470ac305 100644 --- a/tests/integration/expected_test_results/unknown_tags/ingredient-someunknowningredient-does-not-exist-but-not-empty.html +++ b/tests/integration/expected_test_results/unknown_tags/ingredient-someunknowningredient-does-not-exist-but-not-empty.html @@ -692,11 +692,7 @@

    Discover the project

    @@ -788,11 +784,7 @@

    Découvrez le projet

    diff --git a/tests/integration/expected_test_results/web_html/fr-product.html b/tests/integration/expected_test_results/web_html/fr-product.html index f49f5492f8e69..a2c5ae6885e11 100644 --- a/tests/integration/expected_test_results/web_html/fr-product.html +++ b/tests/integration/expected_test_results/web_html/fr-product.html @@ -3969,333 +3969,7 @@

    Découvrez le projet

    diff --git a/tests/integration/expected_test_results/web_html/fr-search-results-cached.html b/tests/integration/expected_test_results/web_html/fr-search-results-cached.html index 282addb6ed57c..7e2d65717383f 100644 --- a/tests/integration/expected_test_results/web_html/fr-search-results-cached.html +++ b/tests/integration/expected_test_results/web_html/fr-search-results-cached.html @@ -638,11 +638,7 @@

    Découvrez le projet

    @@ -914,11 +910,7 @@

    Discover the project

    @@ -906,11 +902,7 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/web_html/world-products-multiple-codes.html b/tests/integration/expected_test_results/web_html/world-products-multiple-codes.html index 871596b76fd1f..decf427addc52 100644 --- a/tests/integration/expected_test_results/web_html/world-products-multiple-codes.html +++ b/tests/integration/expected_test_results/web_html/world-products-multiple-codes.html @@ -519,11 +519,7 @@

    Discover the project

    diff --git a/tests/integration/expected_test_results/web_html/world-search-results.html b/tests/integration/expected_test_results/web_html/world-search-results.html index dd8fe07f4775b..51e963c470e40 100644 --- a/tests/integration/expected_test_results/web_html/world-search-results.html +++ b/tests/integration/expected_test_results/web_html/world-search-results.html @@ -642,11 +642,7 @@

    Discover the project