@ihyeon/flow-qa 0.10.11 → 0.10.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/report.js +2 -1
- package/dist/src/ui/public/app.js +26 -5
- package/package.json +1 -1
package/dist/src/report.js
CHANGED
|
@@ -7,7 +7,8 @@ import { localized, localizeProductMessage } from "./i18n.js";
|
|
|
7
7
|
import { idSchema } from "./schema.js";
|
|
8
8
|
import { targetLabel } from "./targets.js";
|
|
9
9
|
export const RUN_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
10
|
-
|
|
10
|
+
// Saved reports include step results for each attempt in addition to the suite's checks.
|
|
11
|
+
export const MAX_SAVED_REPORT_BYTES = 16 * 1024 * 1024;
|
|
11
12
|
const archiveEnvelopeSchema = z.object({
|
|
12
13
|
schemaVersion: z.literal('flow-qa/report-1'), runId: z.string().regex(RUN_ID), suiteId: idSchema,
|
|
13
14
|
parentRunId: z.string().regex(RUN_ID).optional(),
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
const t = i18n.t;
|
|
6
6
|
const names = { scenario: 'nav.scenario', library: 'nav.library', history: 'nav.history', settings: 'nav.settings' };
|
|
7
7
|
const defaultReportFilter = () => ({ search: '', status: 'all', sort: 'recorded', repeatedOnly: false });
|
|
8
|
+
let refreshRequest = 0;
|
|
9
|
+
let appliedRefreshRequest = 0;
|
|
10
|
+
let pendingSettingsRefresh = 0;
|
|
8
11
|
const app = { state: null, connected: false, displayTargets: [], draft: null, selectedCaseIds: new Set(), script: '', neutralScript: '', scriptRevision: 0, savedFile: '', savedHash: '', origin: 'none', sourceFlow: '', boundSource: null, stale: false, dirty: false, busy: false, planning: false, planRequest: 0, stopping: false, report: null, reportParent: null, reportMarkdown: '', selectedRun: '', reportRequest: 0, reportLoading: false, reportFilter: defaultReportFilter(), rerunOrigin: null, rerunTargetMismatch: false, navigationVersion: 0, comparison: null, comparisonRequest: 0, comparisonBusy: false, comparisonStatus: 'comparison.selectBoth', comparisonPins: { baseline: null, current: null }, comparisonSelectionGeneration: 0, comparisonValidation: null, history: { runs: [], nextCursor: null, pagesLoaded: 0, loaded: false, loading: false, request: 0, debounce: null, kind: null, error: null, updatesAvailable: false, pendingRecentUpdate: false, parentRunId: '' }, view: 'scenario' };
|
|
9
12
|
|
|
10
13
|
function el(tag, className, value) {
|
|
@@ -226,10 +229,10 @@
|
|
|
226
229
|
$('target-select').firstChild.value = '';
|
|
227
230
|
for (const target of app.state?.targets || []) { const option = el('option', '', targetDisplay(target)); option.value = target.name; $('target-select').append(option); }
|
|
228
231
|
if ((app.state?.targets || []).some((x) => x.name === selected)) $('target-select').value = selected;
|
|
229
|
-
if (previousFingerprint !== app.displayTargets.find((item) => item.name === selected)?.targetFingerprint) $('review-checkbox').checked = false;
|
|
230
232
|
targetDescription();
|
|
231
233
|
const list = $('target-list'); replace(list);
|
|
232
234
|
for (const target of app.state?.targets || []) { const row = el('div', 'settings-entry'); row.append(el('strong', '', target.name), document.createTextNode(` · ${targetLabel(target)}${target.description ? ` · ${target.description}` : ''}`)); list.append(row); }
|
|
235
|
+
return previousFingerprint !== selectedTarget()?.targetFingerprint;
|
|
233
236
|
}
|
|
234
237
|
function targetDescription() { const target = selectedTarget(); $('target-description').textContent = target ? `${targetLabel(target)}${target.description ? ` · ${target.description}` : ''}` : t('scenario.targetHint'); readiness(); }
|
|
235
238
|
async function syncScriptForTarget() {
|
|
@@ -627,15 +630,33 @@
|
|
|
627
630
|
readiness();
|
|
628
631
|
}
|
|
629
632
|
async function refresh(full = false) {
|
|
630
|
-
const
|
|
633
|
+
const request = ++refreshRequest;
|
|
634
|
+
if (full) pendingSettingsRefresh = request;
|
|
631
635
|
let state;
|
|
632
|
-
try { state = await api('/api/state'); }
|
|
636
|
+
try { state = await api('/api/state'); }
|
|
637
|
+
catch (error) {
|
|
638
|
+
if (request !== refreshRequest) return;
|
|
639
|
+
appliedRefreshRequest = request;
|
|
640
|
+
app.connected = false;
|
|
641
|
+
renderActive();
|
|
642
|
+
throw error;
|
|
643
|
+
}
|
|
644
|
+
if (request < appliedRefreshRequest) return;
|
|
645
|
+
appliedRefreshRequest = request;
|
|
646
|
+
const previousActive = app.state?.active;
|
|
633
647
|
const initialize = !app.state;
|
|
634
648
|
const libraryChanged = JSON.stringify(app.state?.suites) !== JSON.stringify(state.suites);
|
|
635
649
|
const historyChanged = JSON.stringify(app.state?.runs) !== JSON.stringify(state.runs);
|
|
636
650
|
app.state = state; app.connected = true;
|
|
637
651
|
renderActive(); if (libraryChanged) renderLibrary(); if (historyChanged) { recentRunsChanged(); renderComparisonOptions(); }
|
|
638
|
-
|
|
652
|
+
// A newer poll can satisfy the pending settings refresh.
|
|
653
|
+
const refreshSettings = pendingSettingsRefresh !== 0 && request >= pendingSettingsRefresh;
|
|
654
|
+
if (refreshSettings) pendingSettingsRefresh = 0;
|
|
655
|
+
if (refreshSettings || initialize) {
|
|
656
|
+
const targetChanged = targetOptions();
|
|
657
|
+
modelForms();
|
|
658
|
+
if (targetChanged) void syncScriptForTarget();
|
|
659
|
+
}
|
|
639
660
|
if (previousActive?.kind === 'run' && !state.active) { if (state.lastError) notice(state.lastError, true); else noticeKey('app.runEnded'); }
|
|
640
661
|
if (state.lastError && state.lastError !== app.lastError) { app.lastError = state.lastError; notice(state.lastError, true); }
|
|
641
662
|
await validateComparisonSelection(state);
|
|
@@ -974,7 +995,7 @@
|
|
|
974
995
|
async function saveModel(event) { event.preventDefault(); const form = event.currentTarget; await work(async () => { const values = new FormData(form); const body = { role: form.dataset.role, baseURL: String(values.get('baseURL') || '').trim(), model: String(values.get('model') || '').trim() }; const apiKeyEnv = String(values.get('apiKeyEnv') || '').trim(); if (apiKeyEnv) body.apiKeyEnv = apiKeyEnv; await api('/api/models', body); await refresh(true); noticeKey('app.modelSaved'); }); }
|
|
975
996
|
async function clearModel(role) { await work(async () => { await api('/api/models', { role, clear: true }); await refresh(true); noticeKey('app.modelCleared'); }); }
|
|
976
997
|
function targetFields() { const mobile = $('target-kind').value !== 'web'; for (const [id, required] of [['target-url-field', !mobile], ['target-bundle-field', mobile], ['target-device-field', mobile]]) { const field = $(id); field.hidden = !required; field.querySelector('input').required = required; } }
|
|
977
|
-
async function saveTarget(event) { event.preventDefault(); const form = event.currentTarget; await work(async () => { const values = new FormData(form); const kind = String(values.get('kind') || 'web'); const body = { name: String(values.get('name') || '').trim(), description: String(values.get('description') || '').trim() }; if (kind === 'web') body.url = String(values.get('url') || '').trim(); else { body.kind = 'mobile'; body.platform = kind; body.bundleId = String(values.get('bundleId') || '').trim(); body.device = String(values.get('device') || '').trim(); } await api('/api/targets', body); form.reset(); targetFields(); await refresh(true);
|
|
998
|
+
async function saveTarget(event) { event.preventDefault(); const form = event.currentTarget; await work(async () => { const values = new FormData(form); const kind = String(values.get('kind') || 'web'); const body = { name: String(values.get('name') || '').trim(), description: String(values.get('description') || '').trim() }; if (kind === 'web') body.url = String(values.get('url') || '').trim(); else { body.kind = 'mobile'; body.platform = kind; body.bundleId = String(values.get('bundleId') || '').trim(); body.device = String(values.get('device') || '').trim(); } await api('/api/targets', body); form.reset(); targetFields(); await refresh(true); noticeKey('app.targetSaved'); }); }
|
|
978
999
|
function renderLanguage() {
|
|
979
1000
|
const editedModels = [...document.querySelectorAll('.model-form')].map((form) => ({ role: form.dataset.role, values: Object.fromEntries([...form.querySelectorAll('input')].map((input) => [input.name, input.value])) }));
|
|
980
1001
|
const focusedModel = document.activeElement?.closest?.('.model-form');
|