Add compression estimates, transparent image output and full format selection
This commit is contained in:
1 parent
65cebb31ca
commit
2b897267d1
22 files changed
+220
-30
No files matched your search
+23
-5
@@ -1,5 +1,11 @@
|
||||
const { _electron: electron } = require('playwright');
|
||||
const fs=require('node:fs/promises'),path=require('node:path'),assert=require('node:assert/strict');
|
||||
async function saveDialog(dialog){
|
||||
const closed=dialog.waitForEvent('close');
|
||||
try { await dialog.locator('#save').click({noWaitAfter:true}); }
|
||||
catch(error){ if(!dialog.isClosed() || !String(error.message).includes('has been closed')) throw error; }
|
||||
await closed;
|
||||
}
|
||||
const root=path.resolve(__dirname,'..'),out=path.join(root,'test-results');
|
||||
(async()=>{
|
||||
await fs.mkdir(out,{recursive:true});
|
||||
@@ -20,26 +26,38 @@ const root=path.resolve(__dirname,'..'),out=path.join(root,'test-results');
|
||||
const pdf=updated.history[0].outputs[0];await page.evaluate(file=>window.orbit.selectFiles([file]),pdf);
|
||||
await page.locator('#tab-tools').click();
|
||||
const passwordPromise=app.waitForEvent('window');await page.locator('[data-action="password-add"]').click();const password=await passwordPromise;
|
||||
await password.locator('#password').fill('FileBow-Test');await password.locator('#confirm').fill('FileBow-Test');await password.locator('#save').click();
|
||||
await password.locator('#password').fill('FileBow-Test');await password.locator('#confirm').fill('FileBow-Test');await saveDialog(password);
|
||||
await page.waitForFunction(()=>!document.querySelector('#job:not([hidden])'));updated=await page.evaluate(()=>window.orbit.state());assert.equal(updated.history[0].status,'success');
|
||||
await page.evaluate(file=>window.orbit.selectFiles([file]),updated.history[0].outputs[0]);
|
||||
const unlockPromise=app.waitForEvent('window');await page.locator('[data-action="password-remove"]').click();const unlock=await unlockPromise;await unlock.locator('#password').fill('FileBow-Test');await unlock.locator('#save').click();
|
||||
const unlockPromise=app.waitForEvent('window');await page.locator('[data-action="password-remove"]').click();const unlock=await unlockPromise;await unlock.locator('#password').fill('FileBow-Test');await saveDialog(unlock);
|
||||
await page.waitForFunction(()=>!document.querySelector('#job:not([hidden])'));updated=await page.evaluate(()=>window.orbit.state());assert.equal(updated.history[0].status,'success');
|
||||
await page.evaluate(files=>window.orbit.selectFiles(files),[pdf,updated.history[0].outputs[0]]);
|
||||
const combinePromise=app.waitForEvent('window');await page.locator('[data-action="combine"]').click();const combine=await combinePromise;await combine.locator('#save').click();
|
||||
const combinePromise=app.waitForEvent('window');await page.locator('[data-action="combine"]').click();const combine=await combinePromise;await saveDialog(combine);
|
||||
await page.waitForFunction(()=>!document.querySelector('#job:not([hidden])'));updated=await page.evaluate(()=>window.orbit.state());assert.equal(updated.history[0].status,'success');
|
||||
const imageFile=path.join(out,'Beispielbild.png');await fs.copyFile(path.join(root,'assets/icon.png'),imageFile);await page.evaluate(file=>window.orbit.selectFiles([file]),imageFile);
|
||||
await page.locator('#tab-tools').click();
|
||||
const dialogPromise=app.waitForEvent('window');await page.locator('[data-action="edit-resize"]').click();const edit=await dialogPromise;
|
||||
await edit.waitForSelector('#width',{timeout:30000});await edit.locator('#width').fill('96');await edit.screenshot({path:path.join(out,'02-resize.png')});
|
||||
await edit.locator('#save').click();await page.waitForFunction(()=>!document.querySelector('#job:not([hidden])'));
|
||||
await saveDialog(edit);await page.waitForFunction(()=>!document.querySelector('#job:not([hidden])'));
|
||||
updated=await page.evaluate(()=>window.orbit.state());assert.equal(updated.history[0].status,'success');
|
||||
const compressPromise=app.waitForEvent('window');await page.locator('[data-action="compress"]').click();const compress=await compressPromise;await compress.locator('#quality').fill('65');await compress.locator('#save').click();
|
||||
const compressPromise=app.waitForEvent('window');await page.locator('[data-action="compress"]').click();const compress=await compressPromise;await compress.locator('#quality').fill('65');await compress.waitForFunction(()=>document.querySelector('#estimate').textContent.includes('Voraussichtliche Größe'),null,{timeout:30000});await compress.screenshot({path:path.join(out,'06-compression.png')});await saveDialog(compress);
|
||||
await page.waitForFunction(()=>!document.querySelector('#job:not([hidden])'));updated=await page.evaluate(()=>window.orbit.state());assert.equal(updated.history[0].status,'success');
|
||||
assert.ok(updated.history[0].outputs[0].endsWith('.png'));
|
||||
await page.locator('#tab-quick').click();
|
||||
const formatsPromise=app.waitForEvent('window');await page.locator('[data-action="more-formats"]').click();const formats=await formatsPromise;
|
||||
await formats.locator('#format').selectOption('tiff');await saveDialog(formats);
|
||||
await page.waitForFunction(()=>!document.querySelector('#job:not([hidden])'));updated=await page.evaluate(()=>window.orbit.state());assert.equal(updated.history[0].status,'success');assert.ok(updated.history[0].outputs[0].endsWith('.tiff'));
|
||||
await page.locator('[data-action="convert-gif"]').click();
|
||||
await page.waitForFunction(()=>!document.querySelector('#job:not([hidden])'));updated=await page.evaluate(()=>window.orbit.state());assert.equal(updated.history[0].status,'success');assert.ok(updated.history[0].outputs[0].endsWith('.gif'));
|
||||
const wheelPromise=app.waitForEvent('window');await page.locator('#wheel-open').click();const wheel=await wheelPromise;
|
||||
await wheel.waitForSelector('.action');await wheel.screenshot({path:path.join(out,'03-wheel.png')});await wheel.keyboard.press('Escape');
|
||||
await page.locator('[data-page="settings"]').click();await page.locator('#theme').selectOption('light');await page.waitForFunction(()=>document.documentElement.dataset.theme==='light');await page.screenshot({path:path.join(out,'04-settings-light.png')});
|
||||
await page.locator('#theme').selectOption('dark');await page.locator('[data-page="history"]').click();await page.screenshot({path:path.join(out,'05-history.png')});
|
||||
await page.locator('[data-page="about"]').click();
|
||||
await app.evaluate(({shell})=>{global.__supportUrls=[];shell.openExternal=async url=>{global.__supportUrls.push(url);};});
|
||||
await page.locator('#support').click();
|
||||
assert.deepEqual(await app.evaluate(()=>global.__supportUrls),['https://ko-fi.com/E0Z827VO8I']);
|
||||
await page.screenshot({path:path.join(out,'07-about.png')});
|
||||
assert.deepEqual(errors,[]);await fs.writeFile(path.join(out,'ui-result.json'),JSON.stringify({passed:true,native:state.native,history:updated.history.map(x=>({label:x.label,status:x.status})),errors},null,2));
|
||||
console.log('UI smoke passed: startup, native bridge, conversion, PDF passwords, combining, compression, editor, radial menu, themes, history.');
|
||||
}finally{await app.close();}
|
||||
|
||||
Reference in new issue
Block a user