Skip to content

Commit 7f9b8ef

Browse files
test(workflows): verify UTC and Central Time schedule round trips
Update the stale E2E contract after new cron schedules gained an explicit timezone. Scope browser timezone per case; verify local defaults, interval transitions, YAML and saved reopen in UTC and America/Chicago. Independent correctness and simplification review approved; pinned Biome and whitespace checks passed. GitHub rerun pending. Signed-off-by: Shane Hamilton <[email protected]>
1 parent ccd24d5 commit 7f9b8ef

1 file changed

Lines changed: 109 additions & 66 deletions

File tree

‎desktop/tests/e2e/workflow-local-controls.spec.ts‎

Lines changed: 109 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -199,73 +199,116 @@ test("inserts template variables with keyboard control and restores the caret",
199199
await expect(textarea).toBeFocused();
200200
});
201201

202-
test("round-trips schedule presets and saves a custom UTC cron", async ({
203-
page,
204-
}) => {
205-
const name = `schedule_controls_${Date.now()}`;
206-
const dialog = await openCreateWorkflow(page, name);
207-
await selectTrigger(page, dialog, "Schedule");
208-
209-
await expect(dialog.getByRole("radio", { name: "Daily" })).toBeChecked();
210-
await expect(dialog.getByLabel("Run time (UTC)")).toHaveValue("09:00");
211-
212-
await dialog.getByText("Every 15 minutes", { exact: true }).click();
213-
await dialog.getByRole("tab", { name: "YAML" }).click();
214-
const yamlEditor = dialog.getByRole("textbox", { name: "Workflow YAML" });
215-
let definition = parseYaml(await yamlEditor.inputValue());
216-
expect(definition.trigger).toEqual({ on: "schedule", interval: "15m" });
217-
218-
await dialog.getByRole("tab", { name: "Form" }).click();
219-
await openTriggerInspector(dialog);
220-
await expect(
221-
dialog.getByRole("radio", { name: "Every 15 minutes" }),
222-
).toBeChecked();
223-
224-
await dialog.getByText("Monthly", { exact: true }).click();
225-
await dialog.getByLabel("Day of month").selectOption("31");
226-
await expect(
227-
dialog.getByText("This schedule won’t run in some months."),
228-
).toBeVisible();
229-
230-
await dialog.getByText("Custom cron", { exact: true }).click();
231-
await dialog.getByRole("textbox", { name: "Minute", exact: true }).fill("5");
232-
await dialog.getByRole("textbox", { name: "Hour", exact: true }).fill("*/2");
233-
await dialog.getByRole("textbox", { name: "Day", exact: true }).fill("*");
234-
await dialog.getByRole("textbox", { name: "Month", exact: true }).fill("*");
235-
await dialog
236-
.getByRole("textbox", { name: "Weekday", exact: true })
237-
.fill("2-4");
238-
await expect(dialog.getByText(/UTC · Paste all 5 fields/)).toBeVisible();
239-
240-
await dialog.getByRole("tab", { name: "YAML" }).click();
241-
definition = parseYaml(await yamlEditor.inputValue());
242-
expect(definition.trigger).toEqual({
243-
on: "schedule",
244-
cron: "5 */2 * * 2-4",
202+
for (const timezoneCase of [
203+
{ optionLabel: "UTC", timezoneId: "UTC", timezoneLabel: "UTC" },
204+
{
205+
optionLabel: "Local time (America/Chicago)",
206+
timezoneId: "America/Chicago",
207+
timezoneLabel: "Central Time",
208+
},
209+
] as const) {
210+
test.describe(`schedule controls in ${timezoneCase.timezoneId}`, () => {
211+
test.use({ timezoneId: timezoneCase.timezoneId });
212+
213+
test("round-trips schedule presets and retains the local cron timezone", async ({
214+
page,
215+
}) => {
216+
const name = `schedule_controls_${timezoneCase.timezoneId.replace("/", "_")}_${Date.now()}`;
217+
const dialog = await openCreateWorkflow(page, name);
218+
await selectTrigger(page, dialog, "Schedule");
219+
220+
await expect(dialog.getByRole("radio", { name: "Daily" })).toBeChecked();
221+
await expect(
222+
dialog.getByLabel(`Run time (${timezoneCase.timezoneLabel})`),
223+
).toHaveValue("09:00");
224+
const timezoneSelect = dialog.getByLabel("Time zone");
225+
await expect(timezoneSelect).toHaveValue(timezoneCase.timezoneId);
226+
await expect(timezoneSelect.locator("option:checked")).toHaveText(
227+
timezoneCase.optionLabel,
228+
);
229+
230+
await dialog.getByText("Every 15 minutes", { exact: true }).click();
231+
await expect(dialog.getByLabel("Time zone")).toHaveCount(0);
232+
await dialog.getByRole("tab", { name: "YAML" }).click();
233+
const yamlEditor = dialog.getByRole("textbox", {
234+
name: "Workflow YAML",
235+
});
236+
let definition = parseYaml(await yamlEditor.inputValue());
237+
expect(definition.trigger).toEqual({ on: "schedule", interval: "15m" });
238+
239+
await dialog.getByRole("tab", { name: "Form" }).click();
240+
await openTriggerInspector(dialog);
241+
await expect(
242+
dialog.getByRole("radio", { name: "Every 15 minutes" }),
243+
).toBeChecked();
244+
245+
await dialog.getByText("Monthly", { exact: true }).click();
246+
await expect(dialog.getByLabel("Time zone")).toHaveValue(
247+
timezoneCase.timezoneId,
248+
);
249+
await dialog.getByLabel("Day of month").selectOption("31");
250+
await expect(
251+
dialog.getByText("This schedule won’t run in some months."),
252+
).toBeVisible();
253+
254+
await dialog.getByText("Custom cron", { exact: true }).click();
255+
await dialog
256+
.getByRole("textbox", { name: "Minute", exact: true })
257+
.fill("5");
258+
await dialog
259+
.getByRole("textbox", { name: "Hour", exact: true })
260+
.fill("*/2");
261+
await dialog.getByRole("textbox", { name: "Day", exact: true }).fill("*");
262+
await dialog
263+
.getByRole("textbox", { name: "Month", exact: true })
264+
.fill("*");
265+
await dialog
266+
.getByRole("textbox", { name: "Weekday", exact: true })
267+
.fill("2-4");
268+
await expect(
269+
dialog.getByText(`${timezoneCase.timezoneLabel} · Paste all 5 fields`),
270+
).toBeVisible();
271+
272+
await dialog.getByRole("tab", { name: "YAML" }).click();
273+
definition = parseYaml(await yamlEditor.inputValue());
274+
expect(definition.trigger).toEqual({
275+
on: "schedule",
276+
cron: "5 */2 * * 2-4",
277+
timezone: timezoneCase.timezoneId,
278+
});
279+
await dialog.getByRole("tab", { name: "Form" }).click();
280+
await openTriggerInspector(dialog);
281+
await expect(
282+
dialog.getByRole("radio", { name: "Custom cron" }),
283+
).toBeChecked();
284+
await expect(
285+
dialog.getByRole("textbox", { name: "Weekday", exact: true }),
286+
).toHaveValue("2-4");
287+
288+
await addMessageStep(page, dialog);
289+
await createEnabled(page, dialog);
290+
const reopened = await reopenWorkflow(page, name);
291+
await openTriggerInspector(reopened);
292+
await expect(reopened.getByLabel("Time zone")).toHaveValue(
293+
timezoneCase.timezoneId,
294+
);
295+
await expect(
296+
reopened.getByRole("radio", { name: "Custom cron" }),
297+
).toBeChecked();
298+
await expect(
299+
reopened.getByRole("textbox", { name: "Minute", exact: true }),
300+
).toHaveValue("5");
301+
await expect(
302+
reopened.getByRole("textbox", { name: "Weekday", exact: true }),
303+
).toHaveValue("2-4");
304+
await expect(
305+
reopened.getByText(
306+
`${timezoneCase.timezoneLabel} · Paste all 5 fields`,
307+
),
308+
).toBeVisible();
309+
});
245310
});
246-
await dialog.getByRole("tab", { name: "Form" }).click();
247-
await openTriggerInspector(dialog);
248-
await expect(
249-
dialog.getByRole("radio", { name: "Custom cron" }),
250-
).toBeChecked();
251-
await expect(
252-
dialog.getByRole("textbox", { name: "Weekday", exact: true }),
253-
).toHaveValue("2-4");
254-
255-
await addMessageStep(page, dialog);
256-
await createEnabled(page, dialog);
257-
const reopened = await reopenWorkflow(page, name);
258-
await openTriggerInspector(reopened);
259-
await expect(
260-
reopened.getByRole("radio", { name: "Custom cron" }),
261-
).toBeChecked();
262-
await expect(
263-
reopened.getByRole("textbox", { name: "Minute", exact: true }),
264-
).toHaveValue("5");
265-
await expect(
266-
reopened.getByRole("textbox", { name: "Weekday", exact: true }),
267-
).toHaveValue("2-4");
268-
});
311+
}
269312

270313
test("round-trips and reopens structured message-text conditions", async ({
271314
page,

0 commit comments

Comments
 (0)