fix: hide explorer action for inbox links
This commit is contained in:
@@ -144,6 +144,7 @@ async function runReadyScenario(cdp, url) {
|
||||
await clickText(cdp, '.inbox-header .btn', 'Вставить из буфера')
|
||||
await assertText(cdp, 'example.test', 'inbox: clipboard URL captured')
|
||||
await assertText(cdp, 'Ссылка', 'inbox: clipboard URL kind visible')
|
||||
await assertInboxItemButtonAbsent(cdp, 'example.test', 'Показать в проводнике', 'inbox: link has no explorer action')
|
||||
await clickInboxItemButton(cdp, 'example.test', 'Открыть')
|
||||
await assertEval(cdp, `window.__VERSTAK_GUI_SMOKE__.state.openedUrls.includes('https://example.test/from-clipboard')`, 'inbox: open URL launches external URL')
|
||||
await clickInboxItemButton(cdp, 'example.test', 'Разложить')
|
||||
@@ -485,6 +486,19 @@ async function clickInboxItemButton(cdp, title, buttonText) {
|
||||
await sleep(250)
|
||||
}
|
||||
|
||||
async function assertInboxItemButtonAbsent(cdp, title, buttonText, label) {
|
||||
await assertEval(cdp, `
|
||||
(() => {
|
||||
const norm = (value) => (value || '').replace(/\\s+/g, ' ').trim();
|
||||
const row = [...document.querySelectorAll('.inbox-item')]
|
||||
.find((node) => norm(node.innerText || node.textContent).includes(${JSON.stringify(title)}));
|
||||
if (!row) return false;
|
||||
return ![...row.querySelectorAll('button')]
|
||||
.some((node) => norm(node.innerText || node.textContent).includes(${JSON.stringify(buttonText)}));
|
||||
})()
|
||||
`, label)
|
||||
}
|
||||
|
||||
async function evalValue(cdp, expression) {
|
||||
const result = await cdp.send('Runtime.evaluate', {
|
||||
expression,
|
||||
|
||||
Reference in New Issue
Block a user