feat(web): close settings navigation and page lifecycle

This commit is contained in:
abaishu0730 committed 2026-10-19 12:41:51 +08:00
1 parent 539b33cd42
commit 37b4a156c9
19 files changed
+182 -101

No files matched your search

+5 -5
View File
@@ -9,16 +9,16 @@ test('compact navigation groups settings, retains deep links and role boundaries
for(const role of ['admin','viewer']){
const context=await browser.newContext({viewport:{width:1440,height:1000}}),page=await context.newPage();page.on('pageerror',e=>errors.push(e.message));
await page.goto(base+'/#system-settings');await page.getByLabel('账号',{exact:true}).fill(role);await page.getByLabel('密码',{exact:true}).fill(password);await page.getByRole('button',{name:'登录',exact:true}).click();
await page.getByRole('heading',{name:'系统设置',exact:true}).waitFor();assert.equal(await page.locator('#sidebar-menu [data-view]').count(),6);
assert.equal(await page.locator('#content a[href="#users"]').count(),role==='admin'?1:0);
await page.getByRole('heading',{name:'BPM 连接',exact:true}).first().waitFor();assert.equal(await page.locator('#sidebar-menu [data-view]').count(),6);
assert.equal(await page.locator('#settings-tabs a[href="#users"]').count(),role==='admin'?1:0);
await page.getByRole('link',{name:'业务设置',exact:true}).click();await page.getByRole('link',{name:'发送计划',exact:true}).click();await page.locator('#schedule-form').waitFor();
assert.equal(await page.locator('#sidebar-menu [aria-current="page"]').getAttribute('href'),'#business-settings');
await page.getByRole('link',{name:'返回业务设置',exact:true}).click();await page.getByRole('heading',{name:'业务设置',exact:true}).waitFor();
await page.getByRole('link',{name:'分类通知规则',exact:true}).first().click();await page.getByRole('heading',{name:'分类通知规则',exact:true}).waitFor();
await page.goto(base+'/#users');await page.getByRole('heading',{name:role==='admin'?'团队账号':'工作总览',exact:true}).first().waitFor();
await page.goto(base+'/#calendar');await page.getByRole('heading',{name:'业务日历',exact:true}).waitFor();assert.equal(await page.locator('#sidebar-menu [aria-current="page"]').getAttribute('href'),'#business-settings');
await page.goto(base+'/#system-settings');await page.setViewportSize({width:390,height:844});await page.getByRole('button',{name:'展开菜单',exact:true}).click();
await page.locator('#sidebar-menu').getByRole('link',{name:'业务设置',exact:true}).click();await page.getByRole('heading',{name:'业务设置',exact:true}).waitFor();
assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth),true);assert.equal(await page.locator('#sidebar-menu').evaluate(el=>el.classList.contains('show')),false);assert.equal(await page.getByRole('button',{name:'展开菜单',exact:true}).getAttribute('aria-expanded'),'false');
await page.locator('#sidebar-menu').getByRole('link',{name:'业务设置',exact:true}).click();await page.getByRole('heading',{name:'分类通知规则',exact:true}).waitFor();
await page.waitForFunction(()=>!document.querySelector('#sidebar-menu').classList.contains('collapsing'));assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth),true);assert.equal(await page.locator('#sidebar-menu').evaluate(el=>el.classList.contains('show')),false);assert.equal(await page.getByRole('button',{name:'展开菜单',exact:true}).getAttribute('aria-expanded'),'false');
await context.close();
}
assert.deepEqual(errors,[]);