feat: simplify panel shortcut to Alt+Q
This commit is contained in:
@@ -63,13 +63,13 @@ test('全网址:HTTP、HTTPS、内网地址、本地文件及iframe快捷键',
|
||||
await page.goto(url);
|
||||
await page.locator('#huayi-qb-root').waitFor({ state: 'attached' });
|
||||
assert.equal(await page.locator('#qb-panel').isVisible(), false);
|
||||
await page.keyboard.press('Alt+Shift+Q');
|
||||
await page.keyboard.press('Alt+Q');
|
||||
assert.equal(await page.locator('#qb-panel').isVisible(), true);
|
||||
await page.locator('#qb-search').fill('全网页核验题');
|
||||
await page.locator('#qb-search').press('Enter');
|
||||
assert.match(await page.locator('#qb-results').innerText(), /正确内容/);
|
||||
assert.equal(await page.evaluate(() => window.fetch === window.__originalFetch), true, '普通页面不观察业务请求');
|
||||
await page.keyboard.press('Alt+Shift+Q');
|
||||
await page.keyboard.press('Alt+Q');
|
||||
assert.equal(await page.locator('#qb-panel').isVisible(), false);
|
||||
} finally { await page.close(); }
|
||||
});
|
||||
@@ -79,10 +79,12 @@ test('全网址:HTTP、HTTPS、内网地址、本地文件及iframe快捷键',
|
||||
try {
|
||||
await page.goto('https://public.example.test/blocks-document');
|
||||
await page.locator('#huayi-qb-root').waitFor({ state: 'attached' });
|
||||
await page.keyboard.press('Alt+Shift+Q');
|
||||
await page.keyboard.press('Alt+Q');
|
||||
assert.equal(await page.locator('#qb-panel').isVisible(), true);
|
||||
await page.evaluate(() => window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Q', altKey: true, shiftKey: true })));
|
||||
await page.evaluate(() => window.dispatchEvent(new KeyboardEvent('keydown', { key: 'q', altKey: true })));
|
||||
assert.equal(await page.locator('#qb-panel').isVisible(), false);
|
||||
await page.keyboard.press('Alt+Shift+Q');
|
||||
assert.equal(await page.locator('#qb-panel').isVisible(), true, '旧快捷键仍可使用');
|
||||
} finally { await page.close(); }
|
||||
});
|
||||
await t.test('跨域及嵌套iframe中按快捷键,控制顶层唯一面板且子页不启动存储或采集', async () => {
|
||||
@@ -98,9 +100,9 @@ test('全网址:HTTP、HTTPS、内网地址、本地文件及iframe快捷键',
|
||||
assert.equal(await frame.evaluate(() => window.__globalMenus.length), 0);
|
||||
assert.equal(await frame.evaluate(() => window.fetch === window.__originalFetch), true);
|
||||
}
|
||||
await child.locator('#frame-input').press('Alt+Shift+Q');
|
||||
await child.locator('#frame-input').press('Alt+Q');
|
||||
await page.locator('#qb-panel').waitFor({ state: 'visible' });
|
||||
await nested.locator('#frame-input').press('Alt+Shift+Q');
|
||||
await nested.locator('#frame-input').press('Alt+Q');
|
||||
await page.locator('#qb-panel').waitFor({ state: 'hidden' });
|
||||
assert.equal(await page.locator('#huayi-qb-root').count(), 1);
|
||||
} finally { await page.close(); }
|
||||
|
||||
Reference in New Issue
Block a user