feat: edit and delete worklog entries
This commit is contained in:
@@ -169,6 +169,18 @@ async function runReadyScenario(cdp, url) {
|
||||
await clickText(cdp, '.modal-worklog .btn', 'Сохранить')
|
||||
await waitForGone(cdp, '.modal-worklog')
|
||||
await assertText(cdp, 'GUI smoke worklog', 'worklog: created entry appears')
|
||||
await clickText(cdp, '.worklog-entry', 'GUI smoke worklog')
|
||||
await clickText(cdp, '.worklog-entry-actions .btn', 'Редактировать запись')
|
||||
await waitForSelector(cdp, '.modal-worklog')
|
||||
await setInputValue(cdp, '.modal-worklog input[type="text"]', 'GUI smoke worklog edited')
|
||||
await setInputValue(cdp, '.modal-worklog input[type="number"]', '25')
|
||||
await clickText(cdp, '.modal-worklog .btn', 'Сохранить')
|
||||
await waitForGone(cdp, '.modal-worklog')
|
||||
await assertText(cdp, 'GUI smoke worklog edited', 'worklog: edited entry appears')
|
||||
await clickText(cdp, '.worklog-entry', 'GUI smoke worklog edited')
|
||||
await clickText(cdp, '.worklog-entry-actions .btn', 'Удалить запись')
|
||||
await clickText(cdp, '.overlay .btn', 'Удалить')
|
||||
await assertEval(cdp, `!document.body.innerText.includes('GUI smoke worklog edited')`, 'worklog: deleted entry disappears')
|
||||
|
||||
await clickText(cdp, '.tab', 'Активность')
|
||||
await assertText(cdp, 'Smoke activity', 'activity: per-node activity visible')
|
||||
@@ -729,6 +741,23 @@ function wailsMockSource() {
|
||||
state.worklog[nodeId] = [...(state.worklog[nodeId] || []), entry];
|
||||
return clone(entry);
|
||||
},
|
||||
UpdateWorklogEntry: async (id, summary, details, date, minutes, approximate, billable) => {
|
||||
for (const nodeId of Object.keys(state.worklog)) {
|
||||
const idx = state.worklog[nodeId].findIndex((entry) => entry.id === id);
|
||||
if (idx >= 0) {
|
||||
const updated = { ...state.worklog[nodeId][idx], summary, details, date, minutes, approximate, billable, updatedAt: now };
|
||||
state.worklog[nodeId][idx] = updated;
|
||||
return clone(updated);
|
||||
}
|
||||
}
|
||||
throw new Error('worklog entry not found');
|
||||
},
|
||||
DeleteWorklogEntry: async (id) => {
|
||||
for (const nodeId of Object.keys(state.worklog)) {
|
||||
state.worklog[nodeId] = state.worklog[nodeId].filter((entry) => entry.id !== id);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
GetSuggestions: async () => [{
|
||||
nodeId: 'node-project',
|
||||
nodeTitle: 'Smoke Project',
|
||||
|
||||
Reference in New Issue
Block a user