RUNNABLE SOURCE / 12 TEST SCRIPTSRead the scripts we executed
These are the source files for this reference run. Puppeteer browser tests run against a local Node.js application; the seeded failure is documented in the fixture.
Download source bundle ↗Node.jsPuppeteerChromiumJavaScriptHTML / CSS
REF-001 · Valid new-card checkoutpassed
Source SHA-256: 8153260e9e3fe236d7e25c0ad702591c2b21f93b11e9403e009c7b852dcab16c
// Controlled reference project — not client work. REF-001: Valid new-card checkout
export default async function ({checkout,assert}) {
const actual=await checkout();
assert.equal(actual.httpStatus,201,"A shopper can place a one-unit order with a valid new test card.");
assert.ok(actual.uiMessage.includes("Order confirmed"),'Visible outcome must match the acceptance criterion');
assert.equal(actual.orderCount,1,'Server order count must match the expected outcome');
return actual;
}
Download script ↗REF-002 · Empty-cart lower boundarypassed
Source SHA-256: 3604e6523b2231afa9721102a63bac4970d67459696c6234064cd20c56f9e327
// Controlled reference project — not client work. REF-002: Empty-cart lower boundary
export default async function ({checkout,assert}) {
const actual=await checkout();
assert.equal(actual.httpStatus,422,"A zero-quantity cart is rejected without creating an order.");
assert.ok(actual.uiMessage.includes("Quantity must be 1 to 5."),'Visible outcome must match the acceptance criterion');
assert.equal(actual.orderCount,0,'Server order count must match the expected outcome');
return actual;
}
Download script ↗REF-003 · Maximum-stock boundarypassed
Source SHA-256: d46c48c6e83d14ebf7dd60ba62f3812bcc8bceb325b42f3548dc2f69214037a8
// Controlled reference project — not client work. REF-003: Maximum-stock boundary
export default async function ({checkout,assert}) {
const actual=await checkout();
assert.equal(actual.httpStatus,201,"Exactly five units are accepted and charged at the reference total of $120.");
assert.ok(actual.uiMessage.includes("Order confirmed"),'Visible outcome must match the acceptance criterion');
assert.equal(actual.orderCount,1,'Server order count must match the expected outcome');
assert.equal(actual.payload.total,120,'Five units at $24 must total $120');
return actual;
}
Download script ↗REF-004 · Quantity above available stockpassed
Source SHA-256: be9c6b89530370e67308d480277f112fd83eba4c69c1269be5e341d600778c6b
// Controlled reference project — not client work. REF-004: Quantity above available stock
export default async function ({checkout,assert}) {
const actual=await checkout();
assert.equal(actual.httpStatus,422,"Six units exceed the available stock and do not create an order.");
assert.ok(actual.uiMessage.includes("Quantity must be 1 to 5."),'Visible outcome must match the acceptance criterion');
assert.equal(actual.orderCount,0,'Server order count must match the expected outcome');
return actual;
}
Download script ↗REF-005 · Required shipping addresspassed
Source SHA-256: 7cfd396524632558aa37ee2d1d968503a77765c452121feea3e08d61b4e70dba
// Controlled reference project — not client work. REF-005: Required shipping address
export default async function ({checkout,assert}) {
const actual=await checkout();
assert.equal(actual.httpStatus,422,"An empty shipping address is rejected without creating an order.");
assert.ok(actual.uiMessage.includes("Shipping address is required."),'Visible outcome must match the acceptance criterion');
assert.equal(actual.orderCount,0,'Server order count must match the expected outcome');
return actual;
}
Download script ↗REF-006 · Postal-code length boundarypassed
Source SHA-256: 5c195c4356047b83ba8082a034546e7fd907c5fbaddeac9485ce5be6670541ba
// Controlled reference project — not client work. REF-006: Postal-code length boundary
export default async function ({checkout,assert}) {
const actual=await checkout();
assert.equal(actual.httpStatus,422,"A four-digit postal code is rejected; the required format is five digits.");
assert.ok(actual.uiMessage.includes("Enter a 5-digit US postal code."),'Visible outcome must match the acceptance criterion');
assert.equal(actual.orderCount,0,'Server order count must match the expected outcome');
return actual;
}
Download script ↗REF-007 · Read-only role cannot orderpassed
Source SHA-256: 67947a3520f457c66a3a36478af004e8ce32700829ba20f494decd9c957e6aba
// Controlled reference project — not client work. REF-007: Read-only role cannot order
export default async function ({checkout,assert}) {
const actual=await checkout();
assert.equal(actual.httpStatus,403,"A viewer is denied order creation by the server.");
assert.ok(actual.uiMessage.includes("Read-only viewers cannot place orders."),'Visible outcome must match the acceptance criterion');
assert.equal(actual.orderCount,0,'Server order count must match the expected outcome');
return actual;
}
Download script ↗REF-008 · Missing payment cardpassed
Source SHA-256: e8e4f8a81c124e7e538468520e8f7c17cc02c45f08aeba48f98a9c72b9fbe48f
// Controlled reference project — not client work. REF-008: Missing payment card
export default async function ({checkout,assert}) {
const actual=await checkout();
assert.equal(actual.httpStatus,422,"A missing new-card number is rejected without creating an order.");
assert.ok(actual.uiMessage.includes("Enter a valid 16-digit test card number."),'Visible outcome must match the acceptance criterion');
assert.equal(actual.orderCount,0,'Server order count must match the expected outcome');
return actual;
}
Download script ↗REF-009 · Invalid payment-card checksumpassed
Source SHA-256: af3d2dba259d9af99d939c05988a86420f379e80aa4c41aec08ad0eea68ee7d1
// Controlled reference project — not client work. REF-009: Invalid payment-card checksum
export default async function ({checkout,assert}) {
const actual=await checkout();
assert.equal(actual.httpStatus,422,"A 16-digit number with an invalid checksum is rejected.");
assert.ok(actual.uiMessage.includes("Enter a valid 16-digit test card number."),'Visible outcome must match the acceptance criterion');
assert.equal(actual.orderCount,0,'Server order count must match the expected outcome');
return actual;
}
Download script ↗REF-010 · Saved-card checkout regressionfailed
Source SHA-256: 477d726b506e91010b76fc6a0641762f15b52eda90f331f27907d97bacaad52a
// Controlled reference project — not client work. REF-010: Saved-card checkout regression
export default async function ({checkout,assert}) {
const actual=await checkout();
assert.equal(actual.httpStatus,201,"A valid saved test card should authorize and create an order.");
assert.ok(actual.uiMessage.includes("Order confirmed"),'Visible outcome must match the acceptance criterion');
assert.equal(actual.orderCount,1,'Server order count must match the expected outcome');
return actual;
}
Download script ↗REF-011 · Duplicate request is idempotentpassed
Source SHA-256: d866f6c345aa43a4c51c3213afc3db2b9a62ffd0e6fdc54be735fbc31ae7077c
// Controlled reference project — not client work. REF-011: Duplicate request is idempotent
export default async function ({duplicateRequest,assert}) {
const actual=await duplicateRequest();
assert.equal(actual.responses[0].httpStatus,201,'First request must create an order');
assert.equal(actual.responses[1].httpStatus,200,'Duplicate request must replay the existing order');
assert.equal(actual.responses[0].payload.orderId,actual.responses[1].payload.orderId,'Duplicate key must return the same order ID');
assert.equal(actual.orderCount,1,'Duplicate request must create only one order');
return actual;
}
Download script ↗REF-012 · Mobile keyboard checkoutpassed
Source SHA-256: 36e28cc456ac4aab018ee9d28b684abbac2e42351f91137df1bd97ca233f56ca
// Controlled reference project — not client work. REF-012: Mobile keyboard checkout
export default async function ({checkout,assert}) {
const actual=await checkout({keyboard:true});
assert.equal(actual.httpStatus,201,"A shopper can submit a valid order using the keyboard at a 390 × 844 mobile viewport.");
assert.ok(actual.uiMessage.includes("Order confirmed"),'Visible outcome must match the acceptance criterion');
assert.equal(actual.orderCount,1,'Server order count must match the expected outcome');
return actual;
}
Download script ↗The reference project’s runtime and source are available in the bundle README. This records test-suite behavior on the controlled fixture; it is not proof of testing a client’s application.