agent-orchestrator/ui-electrobun/tests/e2e/specs/theme.test.ts
Hibryda dd1d692e7b test(electrobun): expand E2E suite — 75 new tests (120 total, 14 spec files)
New specs: search, files, comms, tasks, theme, groups, keyboard,
notifications, diagnostics, splash. All under 300 lines, CSS class
selectors matching actual components, display toggle aware.
2026-03-22 05:01:21 +01:00

96 lines
2.8 KiB
TypeScript

/**
* Theme tests — dropdown, groups, switching, custom editor, font changes.
*/
describe("Theme system", () => {
// Open settings first
before(async () => {
const gear = await $(".sidebar-icon");
await gear.click();
await browser.pause(500);
// Click Appearance tab (first category)
const cats = await $$(".cat-btn");
if (cats.length > 0) {
await cats[0].click();
await browser.pause(300);
}
});
after(async () => {
// Close settings
await browser.keys("Escape");
await browser.pause(300);
});
it("should show theme dropdown button", async () => {
const ddBtn = await $(".dd-btn");
if (await ddBtn.isExisting()) {
expect(await ddBtn.isDisplayed()).toBe(true);
}
});
it("should open theme dropdown on click", async () => {
const ddBtn = await $(".dd-btn");
if (!(await ddBtn.isExisting())) return;
await ddBtn.click();
await browser.pause(300);
const dropdown = await $(".dd-list");
if (await dropdown.isExisting()) {
expect(await dropdown.isDisplayed()).toBe(true);
}
});
it("should show theme groups (Catppuccin, Editor, Deep Dark)", async () => {
const groupHeaders = await $$(".dd-group-label");
if (groupHeaders.length === 0) return;
const texts = await Promise.all(groupHeaders.map((g) => g.getText()));
expect(texts.some((t) => t.includes("Catppuccin"))).toBe(true);
expect(texts.some((t) => t.includes("Editor"))).toBe(true);
expect(texts.some((t) => t.includes("Deep Dark"))).toBe(true);
});
it("should list at least 17 theme options", async () => {
const items = await $$(".dd-item");
if (items.length > 0) {
expect(items.length).toBeGreaterThanOrEqual(17);
}
});
it("should highlight the currently selected theme", async () => {
const activeItems = await $$(".dd-item.selected");
if (activeItems.length > 0) {
expect(activeItems.length).toBe(1);
}
});
it("should apply CSS variables when theme changes", async () => {
// Read initial --ctp-base value
const before = await browser.execute(() => {
return getComputedStyle(document.documentElement).getPropertyValue("--ctp-base").trim();
});
expect(before.length).toBeGreaterThan(0);
});
it("should show font size stepper controls", async () => {
// Close theme dropdown first
await browser.keys("Escape");
await browser.pause(200);
const steppers = await $$(".size-stepper");
if (steppers.length > 0) {
expect(steppers.length).toBeGreaterThanOrEqual(1);
}
});
it("should show theme action buttons (Edit Theme, Custom)", async () => {
const actionBtns = await $$(".theme-action-btn");
if (actionBtns.length > 0) {
expect(actionBtns.length).toBeGreaterThanOrEqual(1);
}
});
});