From a2d9fcb259621829bf4ec9680b5dbeac95ab5805 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 15 十月 2026 16:19:54 +0800
Subject: [PATCH] fix(crm): 销售目标达成分析默认查当前季度

---
 scripts/login-theme-live-qa.cjs |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/scripts/login-theme-live-qa.cjs b/scripts/login-theme-live-qa.cjs
new file mode 100644
index 0000000..9c3c21a
--- /dev/null
+++ b/scripts/login-theme-live-qa.cjs
@@ -0,0 +1,48 @@
+// Actual application/router/forms, simulated APIs, no real authentication.
+const assert=require('node:assert/strict');
+const {chromium}=require('C:/Users/浜�/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/playwright');
+const fs=require('fs'),path=require('path');
+const output=path.resolve(__dirname,'../../scripts/login-theme-20261015');fs.mkdirSync(output,{recursive:true});
+(async()=>{
+ const server=await(await import('vite')).createServer({root:path.resolve(__dirname,'..'),server:{host:'127.0.0.1',port:5182}});await server.listen();
+ const browser=await chromium.launch({headless:true,executablePath:'C:/Program Files/Google/Chrome/Application/chrome.exe'});
+ const page=await browser.newPage({viewport:{width:1664,height:941},reducedMotion:'reduce'});
+ const errors=[];let authPosts=0;page.on('pageerror',e=>errors.push(e.message));
+ await page.route('**/admin-api/**',async route=>{
+  const url=route.request().url();if(route.request().method()==='POST')authPosts++;
+  const data=url.includes('company-config')?{companyName:'婊嬭ˉ鍝佺鐞嗗钩鍙�',loginTitle:'婊嬭ˉ鍝佽涓氭暟瀛楀寲绠$悊骞冲彴',loginDescription:'浼犳壙涓尰鑽簿鍗� 路 鏈嶅姟鍋ュ悍缇庡ソ鐢熸椿'}:url.includes('tenant')?[]:null;
+  await route.fulfill({contentType:'application/json',body:JSON.stringify({code:0,data,msg:''})});
+ });
+ try {
+  await page.goto('http://127.0.0.1:5182/auth/login',{waitUntil:'domcontentloaded',timeout:60000});
+  await page.getByRole('heading',{name:'娆㈣繋鍥炴潵'}).waitFor({timeout:60000});
+  await page.waitForFunction(()=>!document.querySelector('#__app-loading__')||getComputedStyle(document.querySelector('#__app-loading__')).opacity==='0');
+  await page.waitForFunction(()=>document.querySelector('.herbal-auth__background')?.complete);
+  const user=page.getByRole('textbox',{name:'璐﹀彿',exact:true}),password=page.locator('input[autocomplete="current-password"]');
+  await user.fill('婕旂ず璐︽埛');await password.fill('not-a-real-password');await page.locator('.herbal-login__heading').click();await page.waitForTimeout(400);
+  assert.equal(await user.getAttribute('autocomplete'),'username');assert.equal(await password.getAttribute('type'),'password');
+  await page.getByRole('button',{name:'鏄剧ず瀵嗙爜',exact:true}).focus();await page.keyboard.press('Space');assert.equal(await password.getAttribute('type'),'text');
+  assert.equal(await password.evaluate(e=>getComputedStyle(e).paddingRight),'44px');
+  await page.getByRole('button',{name:'闅愯棌瀵嗙爜',exact:true}).click();assert.equal(await password.getAttribute('type'),'password');
+  const remember=page.locator('button[role="checkbox"]').first();await remember.click();assert.equal(await remember.getAttribute('aria-checked'),'true');
+  await page.screenshot({path:path.join(output,'desktop-login.png'),fullPage:true});
+  const tokens=await page.evaluate(()=>{const s=getComputedStyle(document.documentElement);return{brand:document.documentElement.dataset.brandTheme,primary:s.getPropertyValue('--primary').trim(),background:s.getPropertyValue('--background-deep').trim()}});
+  assert.equal(tokens.brand,'herbal');assert.equal(tokens.background,'37 33% 95%');
+  await page.locator('.herbal-auth__toolbar button').last().click();await page.waitForFunction(()=>document.documentElement.classList.contains('dark'));await page.waitForTimeout(350);
+  assert.equal(await page.evaluate(()=>getComputedStyle(document.documentElement).getPropertyValue('--primary').trim()),'357 64% 73%');
+  assert.equal(await page.locator('.herbal-panel').evaluate(e=>getComputedStyle(e).backgroundColor),'rgba(39, 31, 26, 0.97)');
+  assert.equal(await page.locator('.herbal-auth__toolbar >div').evaluate(e=>getComputedStyle(e).backgroundColor),'rgb(48, 39, 31)');
+  assert.equal(await page.evaluate(()=>getComputedStyle(document.documentElement).filter),'none','Dark styles must not apply a filter to the document');
+  await page.screenshot({path:path.join(output,'desktop-dark.png'),fullPage:true});
+  await page.locator('.herbal-auth__toolbar button').last().click();await page.waitForFunction(()=>!document.documentElement.classList.contains('dark'));
+  await page.setViewportSize({width:390,height:844});await page.waitForTimeout(250);
+  assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth),true);
+  await page.screenshot({path:path.join(output,'mobile-login.png'),fullPage:true});
+  await user.fill('');await password.fill('');await page.getByRole('button',{name:'login',exact:true}).click();
+  await page.getByText('璇疯緭鍏ョ敤鎴峰悕',{exact:true}).first().waitFor();assert.equal(authPosts,0);
+  assert.deepEqual(errors,[]);
+  const result={passed:true,scope:'Real application/router/theme/login components; mocked backend and company APIs, demo account, no real authentication',checks:['dynamic company config','background loaded','autocomplete','keyboard password toggle','remember account','light theme variables','dark theme switching','mobile no overflow','required fields block backend'],tokens,screenshots:['desktop-login.png','desktop-dark.png','mobile-login.png']};
+  fs.writeFileSync(path.join(output,'result.json'),JSON.stringify(result,null,2));console.log(JSON.stringify(result));
+ } catch(error){console.error(JSON.stringify({message:error.message,errors}));throw error;}
+ finally{await browser.close();await server.close();}
+})();

--
Gitblit v1.9.3