feat: simplify DSH tool navigation and remove account onboarding
This commit is contained in:
1 parent
96227eed2e
commit
f437df2a83
10 files changed
+109
-50
No files matched your search
@@ -14,25 +14,8 @@ async function wait(expression,timeout=15000) {
|
||||
while(Date.now()<end){if(await c.evaluate(expression))return;await new Promise(r=>setTimeout(r,100));}
|
||||
throw Error('UI condition timed out: '+expression);
|
||||
}
|
||||
async function dismissOnboarding() {
|
||||
const end=Date.now()+12000;
|
||||
let quiet=Date.now();
|
||||
while(Date.now()<end) {
|
||||
const modal=await c.evaluate(`({preview:!![...document.querySelectorAll('button')].find(e=>e.textContent.trim()==='继续'),start:document.body.innerText.includes('开始使用')})`);
|
||||
if(modal.preview) {
|
||||
await c.click(`[...document.querySelectorAll('button')].find(e=>e.textContent.trim()==='继续')`);
|
||||
quiet=Date.now();
|
||||
}else if(modal.start) {
|
||||
await c.click(`[...document.querySelectorAll('button[aria-label="关闭"]')].at(-1)`);
|
||||
quiet=Date.now();
|
||||
}else if(Date.now()-quiet>1000) return;
|
||||
await new Promise(resolve=>setTimeout(resolve,150));
|
||||
}
|
||||
throw Error('The native onboarding dialog could not be dismissed');
|
||||
}
|
||||
try {
|
||||
await wait(`!!document.querySelector('svg[class*="fish"]')`,45000);
|
||||
await dismissOnboarding();
|
||||
for(let attempt=0;attempt<10 && !await c.evaluate(`document.body.innerText.includes('DSH助手')`);attempt++) {
|
||||
if(await c.evaluate(`!!document.querySelector('button[aria-label="打开侧边栏"]')`))
|
||||
await c.click(`document.querySelector('button[aria-label="打开侧边栏"]')`);
|
||||
@@ -41,6 +24,19 @@ try {
|
||||
await wait(`document.body.innerText.includes('DSH助手')`);
|
||||
await wait(`!!document.querySelector('[data-testid="dx-task-panel"]')`);
|
||||
report.checks.push('official frontend and native right dock loaded');
|
||||
assert.equal(await c.evaluate(`!!document.querySelector('[role="dialog"],[data-desktop-onboarding]')`),false,'Fresh launch must not show account or product onboarding');
|
||||
const accountEntries=`[...document.querySelectorAll('button,a')].filter(e=>/^(登录|登入|注册|账户|账号|充值|开始使用|Sign in|Log in|Account)$/.test(e.textContent.trim()))`;
|
||||
assert.equal(await c.evaluate(`${accountEntries}.length`),0);
|
||||
report.checks.push('fresh profile opens without login, account or product onboarding');
|
||||
await c.click(`document.querySelector('[data-testid="dx-tool-settings"]')`);
|
||||
await wait(`!!document.querySelector('[data-testid="dx-tool-settings-panel"]')`);
|
||||
assert.equal(await c.evaluate(`${accountEntries}.length`),0);
|
||||
report.checks.push('one click opens native tool settings with DSH capabilities and no account entry');
|
||||
await c.screenshot(path.join(output,'dsh-tool-settings.png'));
|
||||
await c.call('Input.dispatchKeyEvent',{type:'keyDown',key:'Escape',code:'Escape'});
|
||||
await c.call('Input.dispatchKeyEvent',{type:'keyUp',key:'Escape',code:'Escape'});
|
||||
await wait(`!document.querySelector('[data-testid="dx-tool-settings-panel"]')`);
|
||||
await c.screenshot(path.join(output,'dsh-tool-home.png'));
|
||||
const context=await c.evaluate(`fetch('/dx/context').then(r=>r.json())`);
|
||||
assert.ok(context.task_id,'Select a task in the task center before running this test.');
|
||||
report.checks.push('current task received from task center');
|
||||
|
||||
Reference in new issue
Block a user