feat: add portable role-based question bank assistant

This commit is contained in:
薇星幻海
2026-10-10 03:39:43 +08:00
parent e265983170
commit 0ea302bbab
18 changed files with 4659 additions and 330 deletions
+3 -3
View File
@@ -121,7 +121,7 @@ function parseCSV(text) {
document.querySelector('app-examtest').innerHTML = new DOMParser().parseFromString(html, 'text/html').querySelector('app-examtest').innerHTML;
}, { url: practiceURL('缺答案练习'), html: fixture('缺答案练习', { missingAnswer: true }) });
await page.waitForTimeout(2600); assert.equal(downloads.length, beforeMissing);
assert((await page.locator('#yian-question-bank-exporter').innerText()).includes('缺少 1 个答案'));
assert((await page.locator('#yian-question-assistant .page-status').innerText()).includes('缺少 1 个网页答案'));
const manual = page.waitForEvent('download'); await page.getByRole('button', { name: '导出 CSV', exact: true }).click();
assert((await manual).suggestedFilename().includes('_不完整'));
const missing = await page.evaluate(() => QuestionBankCore.extract(document));
@@ -134,9 +134,9 @@ function parseCSV(text) {
}, { url: practiceURL('缺题练习'), html: fixture('缺题练习', { cardCount: 4 }) });
const beforeCount = downloads.length;
await page.waitForTimeout(2600); assert.equal(downloads.length, beforeCount);
assert((await page.locator('#yian-question-bank-exporter').innerText()).includes('3 / 4'));
assert((await page.locator('#yian-question-assistant .page-status').innerText()).includes('3 / 4'));
await page.evaluate(() => history.pushState({}, '', location.href.replace('flag=exercise', 'flag=exam')));
await page.waitForTimeout(1100); assert.equal(await page.locator('#yian-question-bank-exporter').count(), 0);
await page.waitForTimeout(1100); assert(await page.getByRole('button', { name: '导出 CSV', exact: true }).isDisabled());
assert.equal(await page.evaluate(() => window.answerClicks), 0);
console.log('PASS 缺题等待、考试页面不触发、不改变答题状态');