love-ecommerce-template 1.0.0 · SDK 1.2.0

Testing

Tests run your template in the real application (the preview runtime) and a headless Chrome/Edge/Chromium, once per dataset.

node sdk test [dir]
  --dataset normal,empty     # datasets (default: normal, single-store, empty, edge-cases, no-stores, stores-paused)
  --quick                    # normal dataset only
  --no-browser               # files and rendering suites only
  --filter checkout          # only matching checks
  --json

Results are saved in .template-sdk/test-results/report.json with screenshots (desktop and phone per dataset).

Built-in checks

Files

Rendering

Browser

Your tests

Files tests/*.test.js export a function that registers tests:

module.exports = function (t) {
    t.test('name', async ({ page, http, url, dataset, expect, contract, project }) => {
        // ...
    }, { dataset: 'single-store', viewport: { width: 390, height: 844, mobile: true }, browser: true });
};
ArgumentDescription
pagea browser page (null with browser: false): setViewport(width, height, mobile) goto(u, opts) reload(opts) idle(quiet) evaluate(expr, arg) exists(sel) visible(sel) count(sel) text(sel) click(sel) fill(sel, value) waitFor(selOrFn, timeout) screenshot(file, opts) close()
http(path, init)fetch against the preview server
urlthe preview server URL
datasetthe dataset: id, name, summary (storeName, stores, products, coupons, customers, storeMode…)
expect(value)toBe toEqual toBeTruthy toBeFalsy toContain toMatch toBeGreaterThan toBeGreaterThanOrEqual toBeLessThan toHaveLength and .not
contractthe discovered contract
projectthe project (read files)

Example

module.exports = function (t) {
    // <title> carries the store name (with a single active store, that store's own name)
    t.test('the server puts the store name in the title', async ({ http, dataset, expect }) => {
        const res = await http('/');
        expect(res.status).toBe(200);
        const html = await res.text();
        const title = (/<title>([^<]*)<\\/title>/.exec(html) || [])[1] || '';
        expect(title).toContain(dataset.summary.storeName.replace(/&/g, '&amp;'));
    }, { dataset: 'single-store', browser: false });

    t.test('the page title still names the store in the browser', async ({ page, dataset, expect }) => {
        await page.goto('/');
        expect(await page.evaluate('document.title')).toContain(dataset.summary.storeName);
    }, { dataset: 'single-store' });
};
Generated 2026-10-01 11:59 UTC from the application source (contract 7075c14c24bbaf06).