Files
workinf_Blender_Wasm/web/tests/e2e/native-modal-key-probe.spec.ts
mes123456 f3e21c6b98
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
chore: checkpoint web Blender migration source, tools and docs
Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer,
web workflow engine and protocol, tooling, docs and task records.
Large generated evidence, user-testing archives, build snapshots and
imported test assets remain untracked.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-10 11:18:01 +08:00

40 lines
2.3 KiB
TypeScript

import { test, expect } from '@playwright/test';
import path from 'node:path';
import { observeNative } from '../fixtures/native-ui-workflow';
import { focusNativeViewport, waitNativeModal } from '../fixtures/native-modeling-workflow';
const fixture = path.resolve(import.meta.dirname, '../../../tests/files/web/basic_scene.blend');
/* Tracked-flow probe: follow the same prerequisites as
* modeling-native-modal-production.spec.ts, then sample modalActive around `g`. */
test('does g start and Escape cancel a native modal', async ({ page }) => {
await observeNative(page);
await page.goto('/');
const rec: Record<string, unknown> = {};
await page.getByTestId('blend-file-input').setInputFiles(fixture);
await expect(page.getByTestId('engine-status')).toContainText(/SceneIR/, { timeout: 60_000 });
const { canvas } = await focusNativeViewport(page);
rec.idle = await page.evaluate(() => (window as any).__nativeWorkflowGPU ?? null);
rec.editor = await page.evaluate(() => (window as any).__nativeWorkflowEditor ?? null);
const sample = async (label: string) => page.evaluate((tag) => ({
tag,
active: (window as any).__nativeWorkflowGPU?.modalActive ?? null,
ready: (window as any).__nativeWorkflowGPU?.displayAcknowledged ?? null,
failure: (window as any).__nativeWorkflowGPUFailure?.message ?? null,
requests: (window as any).__nativeWorkflowRequests?.length ?? 0,
}), label);
const series: unknown[] = [await sample('before-g')];
await canvas.focus();
await page.keyboard.press('g');
for (let i = 0; i < 20; i++) { await page.waitForTimeout(100); series.push(await sample(`g+${(i + 1) * 100}`)); }
rec.afterG = series;
rec.gpuAfterG = await page.evaluate(() => (window as any).__nativeWorkflowGPU ?? null);
rec.requestsTail = await page.evaluate(() => ((window as any).__nativeWorkflowRequests ?? []).slice(-10));
await page.keyboard.press('Escape');
for (let i = 0; i < 10; i++) await page.waitForTimeout(100);
rec.gpuAfterEscape = await page.evaluate(() => (window as any).__nativeWorkflowGPU ?? null);
rec.mainAfter = await page.evaluate(() => ((window as any).__nativeWorkflowMain?.nodes ?? []).map((n: any) => `${n.name}@${JSON.stringify(n.transform?.translation)}`));
rec.status = await page.getByTestId('engine-status').textContent().catch(() => null);
console.log(JSON.stringify(rec, null, 1));
});