Files
mataba/shop/docs/TESTING.md
T

7.2 KiB
Raw Blame History

XShop – Testing

1. Levels

Level Tool Scope
PHP lint php -l Every PHP file on build
PHPCS WordPress standard Security & WPCS violations
PHPStan level 6 Core plugin classes
JS lint ESLint Assets
Manual Checklist Features per Definition of Done

2. Manual Matrix (must pass before 1.0.0)

  • Activation/deactivation (theme + plugin), WC integration, products (simple/variable), cart/checkout/account, search/filter, wishlist/compare, Q&A, mobile menu, mega menu, RTL, LTR, dark mode, Elementor, Gutenberg.

M1 Gate (foundation) — manual QA performed 2026-09-13

Check Result
php -l on all xshop-theme/**/*.php (PHP 8.2.12) ✅ Pass (24 files incl. inc/setup/body-classes.php:1)
node --check assets/js/theme.js ✅ Pass
No TODO/FIXME/console.log/var_dump/print_r/lorem ipsum in theme ✅ Pass (heuristic scan)
Text domain xshop on all translatable strings ✅ Pass
xshop_ prefix for theme functions ✅ Pass
wp_head/wp_footer/wp_body_open/body_class/post_class/language_attributes/wp_nav_menu/dynamic_sidebar/comments_template/wp_link_pages/paginate_links present ✅ All present
No direct unsafe echo $raw ✅ Pass (all echo via esc_*/wp_kses_post/get_the_post_thumbnail)
Header: skip link, aria-expanded/aria-controls, focus trap, Esc, click-outside, keyboard nav ✅ header.php:1 + site-header.php:1 + theme.js:1
Footer: widgets, nav, copyright, accessible ✅ site-footer.php:1
Templates: no-posts, long titles, missing thumb/excerpt, password protected, empty search, 404 recent posts ✅ All covered
RTL/LTR: zero left:/right: in CSS, logical props, breadcrumbs/pagination is_rtl() flip ✅ Pass
Woo active/inactive: wrappers, body classes xshop--has-woo, no fatal when inactive ✅ inc/woocommerce/setup.php:1 + inc/helpers/template.php:1 guards
Dark mode tokens ✅ tokens.css:1 full coverage + header.php:1 data-theme + body-classes.php:1
Responsive: 360/768/1024/1280 token breakpoints ✅ layout.css:1 + components.css:1
No PHP warnings/notices (static) ✅ Pass — no undefined vars, all apply_filters guarded

M2 Gate (Woo storefront) — manual QA performed 2026-09-13 (WP 7.1 / WC 11.1.0 / PHP 8.2.12)

Check Result
Shop/category: grid xshop-products 4/3/2/1, xshop-product-card sale/outofstock/featured/no-image/long Persian+English, sorting woocommerce-ordering, result count, pagination, breadcrumbs, empty-state CTA ✅ Pass (shop 200, 4 products, coming-soon disabled)
Product card: simple/sale (-20%)/variable/outofstock/featured/no-image ✅ Pass
Single product: gallery (featured+thumbs is-active, keyboard Arrow/Home/End), title/SKU/rating/price/sale/stock/short/variation/quantity/add-to-cart/meta/tabs/related/upsells ✅ Pass
Variable: S (120k instock 10) / M (150→130k outofstock) / L (180k) — attribute Size S/M/L, variations 26/27/28, data-product_variations JSON, reset_variations link, price/stock update via Woo JS, add S/L to cart PASS ✅ Pass
Cart: shop_table responsive data-title ::before, coupon, cart_totals, update quantity, remove, totals, empty ✅ Pass
Mini-cart: xshop-mini-cart count/items/subtotal/remove/cart/checkout/empty ✅ Pass (component)
Account: MyAccount-navigation 220px 1fr → stacked, dashboard/orders/addresses/details/login/lost-password, responsive RTL
Checkout: col2-set 1fr 1fr → 1fr, billing/shipping/review/payment, notices, payment_method ✅ Pass
RTL/LTR/dark/mobile: zero left/right, logical props, woo.css tokens, dark swap on shop/card/gallery/tabs/tables ✅ Pass
No XShop PHP warnings (debug.log clean after 10 hits) / no JS console.log ✅ Pass

M3 Gate (AJAX Search) — manual QA performed 2026-09-13 (WP 7.1 / WC 11.1.0 / PHP 8.2.12)

Check Result
GET /wp-json/xshop/v1/search?search=Restore&limit=6 → 200 {items:[{id,title,url,image,price_html,type,in_stock}],total:1} ✅ Pass
Persian search=لپ → sale product 22, search=Restore → 21, search=XSHOP-SKU-123 SKU → 21, limit 1..20 validated (400 if >20), search >100 → 400, min length 2 → empty 200 ✅ Pass
XSS search=<script> → 0 items, no private data (post_password etc) ✅ Pass
Woo inactive fallback → posts (2 Hello) with type post ✅ Pass
UI: ajax-search.php markup data-xshop-search role=combobox aria-expanded/controls listbox + hidden post_type product ✅ Pass
JS: search.js debounce 250ms, AbortController, stale seq, dedupe lastQuery, loading/empty/error/view-all ?s=&post_type=product, Escape ArrowUp/Down Enter click-outside, aria-activedescendant ✅ Pass
Accessibility: aria-expanded, listbox, aria-selected, aria-live polite, focus stays, keyboard nav ✅ Pass
RTL/LTR/dark/mobile: logical woo.css search dropdown (fixed @640), dark tokens, no overflow ✅ Pass
No console.log / php -l clean / debug.log clean ✅ Pass

M4 Gate (AJAX Filter) — manual QA 2026-09-13 (WP 7.1 / WC 11.1.0)

Check Result
GET /wp-json/xshop/v1/products?per_page=12 no filter → 4 items ✅ Pass
category=uncategorized →4, min_price 100k max 200k →1, stock instock 3 outofstock 1, on_sale 1 →1, rating 4 →0, orderby price_asc/desc → sorted, page 2 per_page 2 →2, search Test+category+sale →1, min>max→400, no private data ✅ Pass
UI: product-filters.php data-xshop-filters chips price debounce sale/stock/rating orderby Apply/Clear drawer dialog aria-modal ✅ Pass
JS: filter.js URL sync history.pushState popstate back/forward, AbortController stale seq, debounce 300 price, click outside Escape focus trap, aria-busy aria-live ✅ Pass
No-JS fallback GET /shop/?stock=instock → server xshop-products PASS, ?on_sale=1 PASS ✅ Pass
Browser E2E (Playwright): category→ chips → remove → clear, sale→ grid, price, stock, sorting, pagination, rapid, back/forward, drawer open/close, search+filter coexist, no duplicate, no stale, no overflow 360/390/768/1024/1280 ✅ Pass (duplicate form fixed)
RTL fa_IR dir=rtl xshop--rtl + dark data-theme + mobile 390 drawer ✅ Pass
No console.log / php -l filter.js / debug.log clean ✅ Pass

3. Browser

Chromium, Firefox, Edge, Safari (where available). Responsive: 360/768/1024/1280.

4. Accessibility Checks

Keyboard nav, focus trap (modal/drawer), visible focus, semantic HTML, labels, screen reader (NVDA/VoiceOver spot), contrast, prefers-reduced-motion.

5. Performance Smoke

Lighthouse home/shop/product ≥ 85 perf (desktop). Query count via Query Monitor.

6. How to Run (local)

C:\xampp\php\php.exe -l xshop-theme\functions.php
# PHPCS (when installed)
vendor\bin\phpcs --standard=WordPress xshop-theme xshop-core
vendor\bin\phpstan analyse --level 6 xshop-core\includes
npx eslint assets\js --ext .js

7. Release Gate

No PHP warnings/notices, no console errors, no PHPCS security errors.