#!/bin/bash # Comprehensive Variant System E2E Test # Tests all aspects of the variant collection system BASE_URL="http://localhost:5000" echo "=========================================" echo "VARIANT SYSTEM E2E TEST" echo "=========================================" echo "" echo "TEST 1: Check VariantCollections endpoint exists" STATUS=$(curl -s -o /dev/null -w "%{http_code}" $BASE_URL/Admin/VariantCollections 2>&1) echo "Status: $STATUS (Expected: 401 - auth required, or 200 if logged in)" echo "" echo "TEST 2: Check Products API returns variant fields" curl -s $BASE_URL/api/catalog/products 2>&1 | grep -o '"variantCollectionId":[^,]*' | head -1 echo "" echo "TEST 3: Check if any products have variants" VARIANTS=$(curl -s $BASE_URL/api/catalog/products 2>&1 | grep -o '"variantsJson":"[^"]*"' | grep -v 'null') if [ -z "$VARIANTS" ]; then echo "No products with variants found" else echo "Products with variants:" echo "$VARIANTS" fi echo "" echo "TEST 4: Check VariantCollections API endpoint" STATUS=$(curl -s -o /dev/null -w "%{http_code}" $BASE_URL/api/variant-collections 2>&1) echo "API endpoint status: $STATUS (Expected: 200 or 401)" echo "" echo "TEST 5: Test database schema" echo "Checking Products table for variant columns..." # This would need sqlite3 installed echo "" echo "=========================================" echo "ISSUES TO FIX:" echo "1. Edit form doesn't populate VariantCollectionId/VariantsJson" echo "2. No dynamic variant input fields (users must edit JSON)" echo "3. No API endpoint to fetch variant collection properties" echo "4. No JavaScript to handle variant collection selection" echo "5. No user guidance on variant JSON format" echo "========================================="