parent
f2d20bb409
commit
fca089c20d
5 changed files with 298 additions and 70 deletions
21
tools/e2e.sh
21
tools/e2e.sh
|
|
@ -201,15 +201,24 @@ extract_ld() {
|
|||
| grep -o '<script type="application/ld+json">[^<]*' \
|
||||
| sed 's/^<script type="application\/ld+json">//'
|
||||
}
|
||||
if extract_ld / | jq -e '."@type" == "Organization" and .vatID == "NL003329281B38"' >/dev/null 2>&1; then
|
||||
# The home record is an @graph (Organization + WebSite joined by @id); the
|
||||
# org node inside it must carry the registered identity.
|
||||
if extract_ld / | jq -e '[."@graph"[]? | select(."@type" == "Organization" and .vatID == "NL003329281B38")] | length == 1' >/dev/null 2>&1; then
|
||||
ok "home Organization schema parses and carries the VAT identity"
|
||||
else
|
||||
bad "Organization schema" "missing, unparseable, or wrong identity"
|
||||
fi
|
||||
if extract_ld /shop/fp6-pmos | jq -e '."@type" == "Product" and (.offers | length) == 3' >/dev/null 2>&1; then
|
||||
ok "product schema parses with one offer per colour"
|
||||
# Variants are a ProductGroup: one variant Product per colour, each with its
|
||||
# own single offer — not one Product with three prices.
|
||||
if extract_ld /shop/fp6-pmos | jq -e '."@type" == "ProductGroup" and (.hasVariant | length) == 3 and ([.hasVariant[].offers] | length) == 3' >/dev/null 2>&1; then
|
||||
ok "product schema parses with one variant (and offer) per colour"
|
||||
else
|
||||
bad "Product schema" "missing, unparseable, or wrong offer count"
|
||||
bad "ProductGroup schema" "missing, unparseable, or wrong variant count"
|
||||
fi
|
||||
if extract_ld /shop | jq -e '."@type" == "ItemList" and (.itemListElement | length) >= 1' >/dev/null 2>&1; then
|
||||
ok "shop index carries an ItemList of the product pages"
|
||||
else
|
||||
bad "shop ItemList" "missing or unparseable"
|
||||
fi
|
||||
body_has /shop/fp6-pmos '"price":"563.30"' "schema price is the checkout integer"
|
||||
# Merchant-grade offer fields: what Merchant Center's website-crawl feed
|
||||
|
|
@ -219,10 +228,10 @@ body_has /shop/fp6-pmos 'OfferShippingDetails' "offers carry shipping detai
|
|||
body_has /shop/fp6-pmos 'MerchantReturnPolicy' "offers carry a return policy"
|
||||
body_has /shop/fp6-pmos '"sku":"fp6-pmos-green"' "offers carry per-variant skus"
|
||||
body_has /shop/fp6-pmos '"brand":{"@type":"Brand","name":"Fairphone"}' "product carries the hardware brand"
|
||||
if extract_ld /shop/fp6-pmos | jq -e '.offers[0].shippingDetails | length == 3' >/dev/null 2>&1; then
|
||||
if extract_ld /shop/fp6-pmos | jq -e '.hasVariant[0].offers.shippingDetails | length == 3' >/dev/null 2>&1; then
|
||||
ok "shipping details cover all three zones"
|
||||
else
|
||||
bad "shipping zones" "expected NL + EU + world tiers in the first offer"
|
||||
bad "shipping zones" "expected NL + EU + world tiers in the first variant's offer"
|
||||
fi
|
||||
if [ "$SHOP_OPEN" = 1 ]; then
|
||||
body_has /shop/fp6-pmos 'schema.org/InStock' "open shop maps to InStock availability"
|
||||
|
|
|
|||
Loading…
Reference in a new issue