Skip to content

Commit c878e20

Browse files
authored
fix(ui): suggest Asia/Shanghai for cron schedules
Preserve @finallylly original PR #65936; move its one-line IANA timezone suggestion to the current cron UI owner and cover the actual rendered Chromium datalist.
1 parent d3df91b commit c878e20

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

‎ui/src/e2e/cron-filters.e2e.test.ts‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,40 @@ describeControlUiE2e("Control UI cron mocked Gateway E2E", () => {
139139
await server?.close();
140140
});
141141

142+
it("suggests Asia/Shanghai in the rendered cron timezone selector", async () => {
143+
const context = await browser.newContext({
144+
locale: "en-US",
145+
serviceWorkers: "block",
146+
viewport: { height: 900, width: 1_280 },
147+
});
148+
const page = await context.newPage();
149+
await installMockGateway(page, {
150+
methodResponses: {
151+
"cron.list": cronListResponse([]),
152+
"cron.runs": cronRunsResponse([]),
153+
"cron.status": { enabled: true, jobs: 0, nextWakeAtMs: null },
154+
},
155+
});
156+
157+
try {
158+
const response = await page.goto(`${server.baseUrl}cron`);
159+
expect(response?.status()).toBe(200);
160+
await page.locator('[data-test-id="cron-new-task"]').click();
161+
await page.locator('[data-test-id="cron-schedule-kind-cron"]').click();
162+
163+
const timezone = page.locator("#cron-cron-tz");
164+
await timezone.waitFor({ state: "visible" });
165+
expect(await timezone.getAttribute("list")).toBe("cron-tz-suggestions");
166+
expect(
167+
await page
168+
.locator("#cron-tz-suggestions option")
169+
.evaluateAll((options) => options.map((option) => option.getAttribute("value"))),
170+
).toContain("Asia/Shanghai");
171+
} finally {
172+
await context.close();
173+
}
174+
});
175+
142176
it("sends cron job table filters through the Gateway and renders the filtered page", async () => {
143177
const everyOk = cronJob(
144178
"digest-every-ok",

‎ui/src/pages/cron/form-suggestions.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const TIMEZONE_SUGGESTIONS = [
1818
"America/New_York",
1919
"Europe/London",
2020
"Europe/Berlin",
21+
"Asia/Shanghai",
2122
"Asia/Tokyo",
2223
];
2324

0 commit comments

Comments
 (0)