All files / core/blong-kopi/test $subject.play.ts

100% Statements 64/64
100% Branches 1/1
100% Functions 0/0
100% Lines 64/64

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 651x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 1x  
/**
 * `$subject.$object` CRUD — Browse, Create, Edit full-stack tests.
 *
 * `cleanupModel` deletes test-created rows (`ENT-PLAY-*`) left over from
 * previous runs so the unique `$objectName` constraint does not trip on
 * re-runs; `browseModel` filters to the stable seeded marker so test-created
 * rows never leak into the baseline screenshot.
 *
 * TROUBLESHOOTING: if create/edit fails at login while browse passes, check the
 * Playwright trace (under `.playwright` results) for a 502 on
 * `/rpc/login/.well-known/mle`, and the dev-server log for
 * `blong: graceful shutdown timed out after 30000ms, forcing exit` — that is
 * dev-server (`blong-watch`) restart instability, not a test bug. Rerun once;
 * see the blong-playwright skill → "Login Flake Triage" for the full triage.
 */
import {expect, test} from '@feasibleone/blong-browser/playwright';
import {
    browseModel,
    cleanupModel,
    createAndEditModel,
} from '@feasibleone/blong-browser/playwright/model';
 
test.use({blongPermissions: true});
 
test.describe('$Object', () => {
    cleanupModel(test, expect, {
        subject: '$subject',
        object: '$object',
        search: 'ENT-PLAY',
        removeMethod: '$subject.$object.remove',
    });
 
    browseModel(test, expect, {
        subject: '$subject',
        object: '$object',
        searchText: 'Sample $Object One',
    });
 
    createAndEditModel(test, expect, {
        subject: '$subject',
        object: '$object',
        fields: {
            '$object.$objectName': 'ENT-PLAY-001',
            '$object.$objectStatus': 'Sent',
        },
        editFields: {
            '$object.$objectName': 'ENT-PLAY-001 Edited',
        },
        search: 'ENT-PLAY-001',
        // Master-detail: the create test switches to the `line` tab, adds two
        // rows and captures tab screenshots; the edit test captures the loaded
        // `line` tab. The generic knex adapter persists the sibling arrays.
        details: [
            {
                object: 'line',
                rows: 2,
                fields: {
                    lineName: 'Widget',
                    lineQuantity: 2,
                },
            },
        ],
    });
});