All files / realm/blong-access/test role.play.ts

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

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 611x 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 2x 2x 2x 1x  
/**
 * `access.role` CRUD — Browse, Create, Edit full-stack tests.
 *
 * The `roleName` display name lives in `core_resource.resourceName` (provided
 * by the custom `access.role.find`), while the browse `search` runs against the
 * `description` string column — so the created rows carry an `ACC-PLAY` marker
 * in their description for reliable cleanup + edit targeting.
 */
import {expect, test} from '@feasibleone/blong-browser/playwright';
import {
    browseModel,
    cleanupModel,
    createAndEditModel,
} from '@feasibleone/blong-browser/playwright/model';
 
test.use({blongPermissions: true});
 
test.describe('Access Role', () => {
    cleanupModel(test, expect, {
        subject: 'access',
        object: 'role',
        search: 'ACC-PLAY',
        removeMethod: 'access.role.remove',
    });
 
    browseModel(test, expect, {
        subject: 'access',
        object: 'role',
        searchText: 'Admin',
    });
 
    createAndEditModel(test, expect, {
        subject: 'access',
        object: 'role',
        fields: {
            'role.roleName': 'ACC-PLAY-Role',
            'role.roleBit': 999,
            'role.description': 'ACC-PLAY role',
        },
        editFields: {
            'role.description': 'ACC-PLAY role edited',
        },
        search: 'ACC-PLAY',
        // Capability pivot over the access.capability dropdown — assignment via
        // the `granted` boolean cell; edit-on-detail unticks it.
        details: [
            {
                object: 'capability',
                pivot: true,
                fields: {granted: true},
                editFields: {granted: false},
            },
            // The effective-ACL panel is view-only (`actions.allowAdd: false`).
            // The Record Access matrix is *not* captured here: its rows are the
            // graph's roles and users, so its content shifts as other specs create
            // and delete them — it has its own spec (`matrix.play.ts`).
            {object: 'effective', tab: 'Access', allowAdd: false, screenshots: {empty: false}},
        ],
    });
});