Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,28 @@ function createHarness({ onRenameAutomation = () => {} } = {}) {
};
}

test("AutomationDetailPanel exposes stable lifecycle action selectors", () => {
const harness = createHarness();

let rendered = harness.render();
let actionButton = componentProps(rendered, harness.Button).find(
(button) => button["data-testid"] === "automation-action-button",
);
assert.ok(actionButton, "pause action button should render");
assert.equal(actionButton["data-automation-id"], "automation-alpha");
assert.equal(actionButton["data-automation-action"], "pause");

rendered = harness.render({
automation: { ...automation(), state: "paused" },
});
actionButton = componentProps(rendered, harness.Button).find(
(button) => button["data-testid"] === "automation-action-button",
);
assert.ok(actionButton, "resume action button should render");
assert.equal(actionButton["data-automation-id"], "automation-alpha");
assert.equal(actionButton["data-automation-action"], "resume");
});

test("AutomationDetailPanel deletes only after confirming the shared dialog", () => {
const deletions = [];
const harness = createHarness();
Expand All @@ -216,9 +238,10 @@ test("AutomationDetailPanel deletes only after confirming the shared dialog", ()
onDeleteAutomation: (automationId) => deletions.push(automationId),
});
const deleteButton = componentProps(rendered, harness.Button).find(
(button) => button["aria-label"] === "Delete: Daily status",
(button) => button["data-testid"] === "automation-delete-button",
);
assert.ok(deleteButton, "delete button should render");
assert.equal(deleteButton["data-automation-id"], "automation-alpha");

deleteButton.onClick();
assert.deepEqual(deletions, []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ export function AutomationDetailPanel({
type="button"
variant={canResume ? "primary" : "secondary"}
size="icon-sm"
data-testid="automation-action-button"
data-automation-id={automation.automation_id}
data-automation-action={canResume ? "resume" : "pause"}
aria-label={actionTitle}
title={actionTitle}
disabled={isMutating}
Expand All @@ -234,6 +237,8 @@ export function AutomationDetailPanel({
type="button"
variant="danger"
size="icon-sm"
data-testid="automation-delete-button"
data-automation-id={automation.automation_id}
aria-label={deleteTitle}
title={deleteTitle}
disabled={isMutating}
Expand Down Expand Up @@ -290,14 +295,19 @@ export function AutomationDetailPanel({
)}
</div>
</div>
<ConfirmDialog
open={deleteDialogOpen}
title={deleteTitle}
confirmLabel={t("common.delete")}
isConfirming={isMutating}
onConfirm={handleConfirmDelete}
onCancel={() => setDeleteDialogOpen(false)}
/>
<div
data-testid="automation-delete-dialog"
data-automation-id={automation.automation_id}
>
<ConfirmDialog
open={deleteDialogOpen}
title={deleteTitle}
confirmLabel={t("common.delete")}
isConfirming={isMutating}
onConfirm={handleConfirmDelete}
onCancel={() => setDeleteDialogOpen(false)}
/>
</div>
</Panel>
);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ entries.
### 6.6 Automations, routines & projects
| The user can… | Evidence |
|---|---|
| Create/rename/filter automations in the UI, retry failed runs, dismiss error toasts | `test_reborn_webui_v2_smoke.py` (automation tests), `test_reborn_webui_v2_automation_trace_outbound_api.py` (4) |
| Create an automation through chat; rename, pause, resume, reload, and delete it through the UI with persisted API state; filter automations, retry failed runs, and dismiss error toasts | `test_reborn_webui_v2_smoke.py::test_reborn_v2_automation_lifecycle_persists_from_ui`, other automation tests in that file, `test_reborn_webui_v2_automation_trace_outbound_api.py` (4) |
| Create event-triggered routines, have them fire on match, respect cooldown, pause/resume | `test_routine_event_batch.py` (8) |
| Run a full-job routine end-to-end with tools, trigger it manually, see failures in the UI | `test_routine_full_job.py` (3) |
| Have routines run with injected OAuth credentials | `test_routine_oauth_credential_injection.py` (3) |
Expand Down
10 changes: 10 additions & 0 deletions tests/e2e/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,16 @@ async def dismiss_native_dialog(dialog) -> None:
"automation_name_button_for": (
"[data-testid='automation-name-button'][data-automation-id='{id}']"
),
"automation_action_for": (
"[data-testid='automation-action-button'][data-automation-id='{id}']"
),
"automation_delete_for": (
"[data-testid='automation-delete-button'][data-automation-id='{id}']"
),
"automation_delete_dialog_for": (
"[data-testid='automation-delete-dialog'][data-automation-id='{id}'] "
"[role='dialog']"
),
"automation_filter_for": (
"[data-testid='automation-filter'][data-filter='{filter}']"
),
Expand Down
Loading
Loading