All files / realm/blong-gateway/test bundle.play.ts

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

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 541x 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 1x  
/**
 * Gateway Bundle management UI — Browse, Create, Edit full-stack tests.
 *
 * Bundles wrap an `access.role` (bundleId === roleId), so create goes through
 * the custom `gateway.bundle.add` handler which creates the role + bundle row.
 * Test-created bundles carry a "Playwright" description marker; `cleanupModel`
 * removes previous runs' rows via the browse page filter (runs first, in
 * declaration order), and the browse screenshot filters to the seeded Vision
 * AI bundle.
 */
import {expect, test} from '@feasibleone/blong-browser/playwright';
import {
    browseModel,
    cleanupModel,
    createAndEditModel,
} from '@feasibleone/blong-browser/playwright/model';
 
test.use({blongPermissions: true});
 
test.describe('Gateway Bundle', () => {
    // Remove test-created rows from previous runs (first test in this file), so
    // the DB does not need to be recreated between runs.
    cleanupModel(test, expect, {
        subject: 'gateway',
        object: 'bundle',
        search: 'Playwright',
        removeMethod: 'gateway.bundle.remove',
    });
 
    // Browse screenshot filters to the seeded Vision AI bundle so it stays
    // stable regardless of any test-created rows.
    browseModel(test, expect, {
        subject: 'gateway',
        object: 'bundle',
        searchText: 'Vision',
    });
 
    createAndEditModel(test, expect, {
        subject: 'gateway',
        object: 'bundle',
        fields: {
            'bundle.baseMonthlyCredits': 1000,
            'bundle.rateLimit': 50,
            'bundle.rateWindowSec': 60,
            'bundle.description': 'A test bundle created by Playwright',
            'bundle.isActive': true,
        },
        editFields: {
            'bundle.description': 'Edited by Playwright',
        },
        search: 'Playwright',
    });
});