perf: optimize full interface loading and refresh paths

This commit is contained in:
abaishu0730 committed 2026-10-28 09:24:04 +08:00
1 parent 649a0df832
commit f317314a3c
57 files changed
+791 -136

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ test('history UI saves IMAP-only credentials locally, explicitly queries sent ma
t.after(async()=>{await browser?.close();await runtime.close();fs.rmSync(dir,{recursive:true,force:true});});
let connects=0;
const raw=Buffer.from('From: sender@example.test\r\nTo: orders@example.test\r\nSubject: Test notice\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n<img src="https://tracker.example.test/pixel"> Huizhou evidence');
runtime.mail.imapFactory=()=>({mailbox:{uidValidity:1n},on(){},async connect(){connects++;},async list(){return [{path:'Sent',specialUse:'\\Sent'}];},async getMailboxLock(_path,opts){assert.equal(opts.readOnly,true);return {release(){}};},async search(){return [1];},async fetchOne(uid,q){return q.source?{source:raw}:{uid,size:raw.length,envelope:{subject:'Test notice'}};},async logout(){},close(){}});
runtime.mail.imapFactory=()=>({mailbox:{uidValidity:1n},on(){},async connect(){connects++;},async list(){return [{path:'Sent',specialUse:'\\Sent'}];},async getMailboxLock(_path,opts){assert.equal(opts.readOnly,true);return {release(){}};},async search(){return [1];},async *fetch(){yield {uid:1,size:raw.length,envelope:{subject:'Test notice'}};},async fetchOne(uid,q){return q.source?{source:raw}:{uid,size:raw.length,envelope:{subject:'Test notice'}};},async logout(){},close(){}});
browser=await loadPlaywright().chromium.launch(browserOptions());const page=await browser.newPage();const requests=[];page.on('request',r=>requests.push(r.url()));
await page.goto('http://127.0.0.1:'+runtime.server.address().port+'/#mail');await login(page);await page.getByRole('button',{name:'只读查阅已发送邮件',exact:true}).click();
await page.getByRole('button',{name:'添加只读邮箱',exact:true}).click({timeout:5000});