mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-09-26 19:27:58 +00:00
Fixes #1791. ## What Adds `6:'Group Data'` to the `typeMap` in `public/packets.js` so the Packets-view "message type" multi-select shows a Group Data checkbox. The filter pipeline already keys by integer payload_type, so this just registers the missing option. Also aligns the Live-view legend label in `public/live.js` to "Group Data" for cross-view consistency. ## Why Triage (in #1791) confirmed payload_type=6 (GRP_DATA) was the only ordinary type omitted from the static `typeMap`. `packet-filter.js`, `live.js`, `app.js`, and `map.js` all already know about it — only the Packets-page checklist was missing it. ## Test (TDD red → green) Branch history (4 production commits before round-1 review): - `19ed5beb` — **test-only red commit**: adds Playwright E2E that opens the type-filter menu, asserts a `data-type-id="6"` checkbox labeled "Group Data" exists, selects it, and asserts every visible row's type badge reads "Group Data". Also seeds one GRP_DATA packet into the CI fixture (`.github/workflows/deploy.yml`) so the filter has a row to match. - `823a7d8d` — adds the one-line `typeMap` entry. First CI run on this commit failed on an unrelated test (not the #1791 assertion); the #1791 test ran and passed. - `eec2428` — fixture cleanup: `path_json=[]`/`resolved_path=[]` so the seeded GRP_DATA hop-row count matches the raw_hex `path_len=0`. CI green. - `8f85f5f` — labels the type-6 entry "Group Data" (was briefly "Grp Data"). CI green. E2E assertion: `test-e2e-playwright.js` block `Packets type filter includes Group Data (#1791)`. ## Round-1 review follow-ups - `e3651c99` — `public/live.js` legend: `'Grp Data'` → `'Group Data'`. - `4475c2f7` — test cleanup hardening: error string aligned to assertion, duplicated selector extracted, regex tightened to strict equality, `#typeMenu` explicitly closed, `meshcore-time-window` localStorage key cleared, page reloaded so the in-memory `selectedTypes` Set is reset. - `b90bc33f` — `.github/workflows/deploy.yml`: drop self-referential `#1797` citation from fixture comment, switch synthetic fixture id from `-1` to `-1000000` sentinel with explanatory comment. ## Scope Single-line typeMap registration plus its E2E test scaffolding, fixture seed, and the live.js label alignment. --------- Co-authored-by: clawbot <bot@openclaw.dev> Co-authored-by: meshcore-bot <bot@meshcore.local> Co-authored-by: openclaw-bot <bot@openclaw.local>
76 lines
2.7 KiB
JavaScript
76 lines
2.7 KiB
JavaScript
/**
|
|
* E2E for #1279 P2 #2 — Live legend covers all remaining named payload types.
|
|
* After PR #1276 the legend already lists Advert/Message/Direct/Request/
|
|
* Response/Trace/Path/Ack; this PR adds Anon Req, Group Data, Multipart,
|
|
* Control and Raw Custom.
|
|
*
|
|
* Run: BASE_URL=http://localhost:13581 node test-issue-1279-legend-p2-e2e.js
|
|
*/
|
|
'use strict';
|
|
const { chromium } = require('playwright');
|
|
|
|
const BASE = process.env.BASE_URL || 'http://localhost:13581';
|
|
|
|
let passed = 0, failed = 0;
|
|
async function step(name, fn) {
|
|
try { await fn(); passed++; console.log(' ✓ ' + name); }
|
|
catch (e) { failed++; console.error(' ✗ ' + name + ': ' + e.message); }
|
|
}
|
|
function assert(c, m) { if (!c) throw new Error(m || 'assertion failed'); }
|
|
|
|
async function gotoLive(page) {
|
|
await page.goto(BASE + '/#/live', { waitUntil: 'domcontentloaded' });
|
|
await page.waitForSelector('#liveLegend', { timeout: 8000, state: 'attached' });
|
|
await page.waitForTimeout(400);
|
|
const hidden = await page.evaluate(() => {
|
|
const el = document.getElementById('liveLegend');
|
|
return !!el && el.classList.contains('hidden');
|
|
});
|
|
if (hidden) {
|
|
await page.evaluate(() => {
|
|
try { localStorage.removeItem('live-legend-hidden'); } catch (_) {}
|
|
const el = document.getElementById('liveLegend');
|
|
if (el) el.classList.remove('hidden');
|
|
});
|
|
}
|
|
}
|
|
|
|
async function legendText(page) {
|
|
return page.evaluate(() => {
|
|
const el = document.getElementById('liveLegend');
|
|
return el ? (el.textContent || '').toLowerCase() : '';
|
|
});
|
|
}
|
|
|
|
(async () => {
|
|
const browser = await chromium.launch({
|
|
headless: true,
|
|
executablePath: process.env.CHROMIUM_PATH || undefined,
|
|
args: ['--no-sandbox', '--disable-gpu', '--disable-dev-shm-usage'],
|
|
});
|
|
|
|
console.log(`\n=== #1279 P2 legend covers all 13 payload types — E2E against ${BASE} ===`);
|
|
|
|
const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } });
|
|
const page = await ctx.newPage();
|
|
page.setDefaultTimeout(8000);
|
|
page.on('pageerror', (e) => console.error('[pageerror]', e.message));
|
|
|
|
await step('navigate to /live', async () => { await gotoLive(page); });
|
|
|
|
// Types already covered by #1274/#1276: Advert/Message/Direct/Request/
|
|
// Response/Trace/Path/Ack. New ones added by #1279 P2:
|
|
const newRows = ['anon req', 'group data', 'multipart', 'control', 'raw custom'];
|
|
for (const label of newRows) {
|
|
await step(`legend lists "${label}"`, async () => {
|
|
const t = await legendText(page);
|
|
assert(t.indexOf(label) !== -1, 'legend missing row: ' + label);
|
|
});
|
|
}
|
|
|
|
await ctx.close();
|
|
await browser.close();
|
|
console.log(`\n=== ${passed} passed, ${failed} failed ===`);
|
|
process.exit(failed === 0 ? 0 : 1);
|
|
})().catch((e) => { console.error(e); process.exit(1); });
|