fix: open inbox artifacts by type
This commit is contained in:
@@ -144,6 +144,8 @@ 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 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', 'Разложить')
|
||||
await waitForSelector(cdp, '.modal input[type="text"]')
|
||||
await setInputValue(cdp, '.modal input[type="text"]', 'Smoke')
|
||||
@@ -155,6 +157,10 @@ async function runReadyScenario(cdp, url) {
|
||||
await emitDroppedFiles(cdp, ['/tmp/smoke-drop-folder'])
|
||||
await assertText(cdp, 'smoke-drop-folder', 'inbox: dropped folder captured')
|
||||
await assertText(cdp, 'Перетаскивание', 'inbox: dropped source visible')
|
||||
await clickInboxItemButton(cdp, 'smoke-drop-folder', 'Открыть')
|
||||
await assertEval(cdp, `document.querySelector('.tab.active')?.innerText.includes('Файлы')`, 'inbox: open folder switches to files tab')
|
||||
await assertText(cdp, 'captured-folder-file.txt', 'inbox: open folder shows captured folder contents')
|
||||
await clickText(cdp, '.nav-item', 'Неразобранное')
|
||||
await dispatchPasteImage(cdp, 'pasted-smoke.png', 'image/png', 'c21va2UtaW1hZ2U=')
|
||||
await assertText(cdp, 'pasted-smoke.png', 'inbox: clipboard image captured')
|
||||
await assertText(cdp, 'Изображение', 'inbox: clipboard image kind visible')
|
||||
@@ -167,12 +173,17 @@ async function runReadyScenario(cdp, url) {
|
||||
await clickText(cdp, '.modal-actions .btn', 'Разложить')
|
||||
await waitForGone(cdp, '.modal-overlay')
|
||||
await assertEval(cdp, `!document.querySelector('.inbox-screen')?.innerText.includes('smoke-drop-folder')`, 'inbox: assigned item leaves inbox')
|
||||
await clickInboxItemButton(cdp, 'pasted-smoke.png', 'Открыть')
|
||||
await waitForSelector(cdp, '.preview-image')
|
||||
await assertText(cdp, 'pasted-smoke.png', 'inbox: open image shows preview')
|
||||
await click(cdp, '.action-btn-close')
|
||||
await clickInboxItemButton(cdp, 'pasted-smoke.png', 'Удалить')
|
||||
await clickText(cdp, '.overlay .btn', 'Удалить')
|
||||
await assertEval(cdp, `!document.querySelector('.inbox-screen')?.innerText.includes('pasted-smoke.png')`, 'inbox: deleted item leaves inbox')
|
||||
await screenshot(cdp, 'inbox.png')
|
||||
await clickText(cdp, '.inbox-item', 'Inbox Smoke Item')
|
||||
await assertText(cdp, 'Inbox Smoke Item', 'inbox: item opens from list')
|
||||
await clickText(cdp, '.note-editor-actions .btn', 'Закрыть')
|
||||
|
||||
await clickText(cdp, '.nav-item', 'Корзина')
|
||||
await assertText(cdp, 'Trash Smoke Folder', 'trash: deleted node visible')
|
||||
@@ -739,6 +750,7 @@ function wailsMockSource() {
|
||||
links: {
|
||||
'node-project': [],
|
||||
},
|
||||
openedUrls: [],
|
||||
};
|
||||
|
||||
const fileNodeDetails = {
|
||||
@@ -904,6 +916,11 @@ function wailsMockSource() {
|
||||
const title = String(sourcePath || '').split('/').filter(Boolean).pop() || 'Dropped file';
|
||||
const kind = title.includes('folder') ? 'folder' : 'file';
|
||||
const node = { id: 'node-capture-path-' + Date.now(), title, type: kind === 'folder' ? 'folder' : 'file', section: '', captureInbox: true, captureKind: kind, sourceKind: kind, captureSource: source || 'drop', captureStatus: 'unresolved', createdAt: now, capturedAt: now, has_children: false, children: [], ...ctx };
|
||||
if (kind === 'folder') {
|
||||
state.files[node.id] = [{ id: 'captured-folder-file', nodeId: 'captured-folder-file', fileId: 'captured-folder-file', name: 'captured-folder-file.txt', type: 'file', size: 42, createdAt: now }];
|
||||
} else {
|
||||
state.files[node.id] = [{ id: node.id, nodeId: node.id, fileId: node.id, name: title, type: 'file', size: 42, createdAt: now }];
|
||||
}
|
||||
state.nodes.push(node);
|
||||
return clone(inboxDTO(node));
|
||||
},
|
||||
@@ -911,6 +928,7 @@ function wailsMockSource() {
|
||||
CaptureFileDataWithContext: async (filename, _dataBase64, source, contextJSON) => {
|
||||
const ctx = parseCaptureContext(contextJSON);
|
||||
const node = { id: 'node-capture-data-' + Date.now(), title: filename, type: 'file', section: '', captureInbox: true, captureKind: filename.endsWith('.png') ? 'image' : 'file', sourceKind: filename.endsWith('.png') ? 'image' : 'file', captureSource: source || 'paste', captureStatus: 'unresolved', createdAt: now, capturedAt: now, has_children: false, children: [], ...ctx };
|
||||
state.files[node.id] = [{ id: node.id, nodeId: node.id, fileId: node.id, name: filename, type: 'file', size: 32, mime: filename.endsWith('.png') ? 'image/png' : 'text/plain', createdAt: now }];
|
||||
state.nodes.push(node);
|
||||
return clone(inboxDTO(node));
|
||||
},
|
||||
@@ -966,6 +984,7 @@ function wailsMockSource() {
|
||||
return true;
|
||||
},
|
||||
OpenLink: async () => true,
|
||||
OpenURL: async (url) => { state.openedUrls.push(url); return true },
|
||||
ListTrash: async () => clone({
|
||||
trashPath: '/tmp/verstak-smoke-vault/.verstak/trash',
|
||||
nodes: [{ id: 'node-trash', title: 'Trash Smoke Folder', type: 'folder', fsPath: 'Trash Smoke Folder', deletedAt: now }],
|
||||
@@ -1032,7 +1051,7 @@ function wailsMockSource() {
|
||||
AddPathLink: async () => true,
|
||||
DeleteFileOrFolder: async () => true,
|
||||
OpenFile: async () => true,
|
||||
GetFileBase64: async () => '',
|
||||
GetFileBase64: async () => 'data:image/png;base64,c21va2UtaW1hZ2U=',
|
||||
ReadFileText: async () => 'Smoke file content',
|
||||
|
||||
ListActions: async (nodeId) => clone(state.actions[nodeId] || []),
|
||||
|
||||
Reference in New Issue
Block a user