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>
9 lines
3.2 KiB
TypeScript
9 lines
3.2 KiB
TypeScript
import { expect, test, type Page } from '@playwright/test'; import fs from 'node:fs'; import path from 'node:path'; import { observeNative, performNativeAction, captureNativeWorkflowState, exposeWebTools } from '../fixtures/native-ui-workflow'; import { queryNativeJSON, readNativeHistory, waitNativeModal } from '../fixtures/native-modeling-workflow'; import { openFromUI, runWasmPython, switchNativeWorkspace } from '../fixtures/wasm-console-workflow';
|
|
const root=path.resolve(import.meta.dirname,'../../..'),fixture=path.resolve(root,process.env.WBV2_CASE_FIXTURE!),meta=JSON.parse(fs.readFileSync(fixture.replace(/\.blend$/,'.json'),'utf8')); const read=(page:Page)=>queryNativeJSON(page,`import bpy,json; print(json.dumps({'workspace':bpy.context.window.workspace.name,'lens':bpy.data.objects[${JSON.stringify(meta.camera.name)}].data.lens}))`); const ui=(page:Page)=>page.locator('main.blender-app').evaluate(e=>Object.fromEntries(['data-workspace','data-editor-workflow-status','data-editor-workflow-workspace','data-editor-workflow-area','aria-busy'].map(k=>[k,e.getAttribute(k)])));
|
|
test.afterEach(async({page},info)=>{const main=await read(page).catch(error=>({error:String(error)})),history=await readNativeHistory(page).catch(error=>({error:String(error)}));fs.writeFileSync(info.outputPath('workspace-final.json'),JSON.stringify({diagnostic:true,acceptance:'NOT_CLAIMED',main,history,ui:await ui(page),native:await captureNativeWorkflowState(page)},null,2));});
|
|
test('B6 workspace after native history diagnostic',async({page},info)=>{const evidence:Record<string,unknown>={diagnostic:true,acceptance:'NOT_CLAIMED'},record=(key:string,value:unknown)=>{evidence[key]=value;fs.writeFileSync(info.outputPath('workspace-progress.json'),JSON.stringify(evidence,null,2));};await observeNative(page);await page.goto('/');await expect.poll(()=>page.evaluate(()=>Array.isArray((window as any).__nativeWorkflowMain?.nodes)),{timeout:60000}).toBe(true);await openFromUI(page,()=>page.getByTestId('blend-file-input').setInputFiles(fixture));
|
|
await waitNativeModal(page,false);await expect(page.locator('canvas[aria-label="Blender desktop"]')).toHaveAttribute('data-native-input-ready','true',{timeout:60000});const firstFrame=await page.evaluate(()=>(window as any).__nativeWorkflowGPU?.requestId);await exposeWebTools(page);await waitNativeModal(page,false,firstFrame);await switchNativeWorkspace(page,'Scripting');const before=await read(page);record('before',before);
|
|
await runWasmPython(page,`import bpy; bpy.data.objects[${JSON.stringify(meta.camera.name)}].data.lens=${before.value.lens+2}`);await performNativeAction(page,{type:'applyCommand',command:'undo'},()=>page.getByRole('button',{name:'撤销',exact:true}).click());expect((await read(page)).value.lens).toBe(before.value.lens);await performNativeAction(page,{type:'applyCommand',command:'redo'},()=>page.getByRole('button',{name:'重做',exact:true}).click());expect((await read(page)).value.lens).toBe(before.value.lens+2);record('history',{ui:await ui(page),native:await captureNativeWorkflowState(page)});
|
|
await switchNativeWorkspace(page,'Animation');const after=await read(page);expect(after.value).toEqual({workspace:'Animation',lens:before.value.lens+2});record('switched',{main:after,ui:await ui(page)});
|
|
});
|