import { test, expect } from '@playwright/test'; import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; const HTML_PATH = path.resolve('tables/dist/tables.html'); const HTML_RAW = fs.readFileSync(HTML_PATH, 'utf8'); const MDL_COLUMNS = [ { field: 'id', title: 'ID', width: '6em' }, { field: 'title', title: 'Deliverable' }, { field: 'party', title: 'Party', enum: ['Acme', 'Beta', 'Gamma'] }, { field: 'dueDate', title: 'Due', format: 'date' }, { field: 'status', title: 'Status', enum: ['pending', 'submitted', 'accepted'] }, ]; function makeRow(id, title, party, dueDate, status, editable = true) { return { url: `/Working/MDL/${id}.yaml.html`, data: { id, title, party, dueDate, status }, editable, }; } const ROWS = [ makeRow('D-001', 'Site survey report', 'Acme', '2026-05-12', 'pending'), makeRow('D-002', 'Foundation drawings A', 'Beta', '2026-05-20', 'submitted'), makeRow('D-003', 'Procurement schedule', 'Acme', '2026-05-08', 'accepted'), makeRow('D-004', 'Safety plan', 'Gamma', '2026-05-15', 'pending'), makeRow('D-005', 'Geotechnical report', 'Beta', '2026-05-30', 'submitted'), ]; // Inject a complete table context into the page. Same pattern as // form-safety.spec.js: write a patched copy of tables.html to a temp // file and navigate via file://. async function loadTableWithContext(page, context) { const ctxJson = JSON.stringify(context).replace(/<\//g, '<\\/'); const replacement = ``; const patched = HTML_RAW.replace( /