19 lines
1.8 KiB
JavaScript
19 lines
1.8 KiB
JavaScript
import {_electron as electron} from 'playwright-core';
|
|
import assert from 'node:assert/strict';
|
|
import fs from 'node:fs/promises';
|
|
import path from 'node:path';
|
|
const exe=path.resolve('.test-output/installed app/轻映 AI.exe'),project=path.resolve('output/无职转生_30秒_修订版/无职转生_修订版.qycut');
|
|
const app=await electron.launch({executablePath:exe,args:[project],env:{...process.env,QY_TEST_USERDATA:path.resolve('.test-output/final-project-profile')}});
|
|
try{
|
|
const page=await app.firstWindow();await page.waitForFunction(()=>!!window.studio&&document.querySelector('.project-title'));
|
|
const state=await page.evaluate(()=>window.studio.bootstrap());assert.equal(state.project.clips.filter(c=>c.track==='video').length,23);assert.equal(state.config.processingMode,'gpu');
|
|
assert.ok(state.project.media.every(m=>!m.missing));
|
|
await page.getByRole('button',{name:'导出视频',exact:true}).click();
|
|
const select=page.getByLabel('编码加速');assert.equal(await select.inputValue(),'gpu');
|
|
assert.deepEqual(await select.locator('option').evaluateAll(options=>options.map(o=>o.value)),['cpu','gpu','hybrid']);
|
|
for(const value of ['cpu','hybrid','gpu']){await select.selectOption(value);assert.equal(await select.inputValue(),value);}
|
|
await page.screenshot({path:'.test-output/installed-gpu-modes.png'});await page.locator('.modal .icon-button').click();
|
|
await page.getByRole('button',{name:'剪辑',exact:true}).click();await page.screenshot({path:'.test-output/installed-real-project.png'});
|
|
await fs.writeFile('.test-output/final-project-report.json',JSON.stringify({installedExe:exe,project,videoClips:23,mediaMissing:false,defaultMode:'gpu',modes:['cpu','gpu','hybrid'],passed:true},null,2));console.log('PASS installed project and all three engine selectors');
|
|
}finally{await app.close();}
|