Skip to content

Commit 9b1c4bb

Browse files
fix(ui): theme Web Awesome popup surfaces (#132383)
Worked on by: - @steipete Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: steipete <[email protected]>
1 parent 0e56984 commit 9b1c4bb

4 files changed

Lines changed: 110 additions & 1 deletion

File tree

‎ui/src/e2e/activity-session-feed.capture.e2e.test.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@ import { mkdir } from "node:fs/promises";
22
import path from "node:path";
33
import { expect, it } from "vitest";
44
import {
5+
controlUiBundledGatewayUrl,
56
controlUiSessionUrl,
67
installMockGateway,
78
waitForControlUiRoute,
89
} from "../test-helpers/control-ui-e2e.ts";
910
import { createControlUiE2eSuite } from "./control-ui-e2e-suite.test-support.ts";
11+
import { readThemedPopupPaint } from "./popup-theme.test-support.ts";
1012

1113
const suite = createControlUiE2eSuite({
1214
name: "Control UI session activity feed capture",
1315
startServerBeforeBrowser: true,
1416
});
1517

1618
const outputDir = path.resolve(process.cwd(), ".artifacts/control-ui-e2e/session-activity-feed");
19+
const proofPhase = process.env.OPENCLAW_MENU_THEME_PROOF_PHASE;
1720

1821
suite.define(() => {
1922
it("captures online, global activity, and person-filtered activity surfaces", async () => {
@@ -342,6 +345,18 @@ suite.define(() => {
342345
path: path.join(outputDir, "04-sidebar-online-user-expanded-dark.png"),
343346
});
344347

348+
await page.evaluate(
349+
({ gatewayUrl }) => {
350+
localStorage.setItem(
351+
`openclaw.control.settings.v1:${gatewayUrl}`,
352+
JSON.stringify({ gatewayUrl, theme: "dash", themeMode: "dark" }),
353+
);
354+
},
355+
{ gatewayUrl: controlUiBundledGatewayUrl(suite.server.baseUrl) },
356+
);
357+
await page.reload();
358+
await expect.poll(() => page.locator("html").getAttribute("data-theme")).toBe("dash");
359+
345360
await page.evaluate(() => {
346361
const app = document.querySelector("openclaw-app") as HTMLElement & {
347362
runtime?: { context: { navigate: (routeId: string) => void } };
@@ -368,6 +383,15 @@ suite.define(() => {
368383
.count(),
369384
)
370385
.toBe(3);
386+
const peoplePopover = activityPage.locator("wa-popover.activity-feed__people-popover");
387+
const peoplePaint = await readThemedPopupPaint(peoplePopover, "body");
388+
if (proofPhase) {
389+
await page.screenshot({
390+
animations: "disabled",
391+
path: path.join(outputDir, `05-people-menu-${proofPhase}.png`),
392+
});
393+
}
394+
expect(peoplePaint.actual).toEqual(peoplePaint.expected);
371395
await page.keyboard.press("Escape");
372396
const activityFeed = activityPage.locator(".activity-feed");
373397
const activitySession = (key: string) =>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import type { Locator } from "playwright";
2+
3+
type PopupPaint = {
4+
background: string;
5+
border: string;
6+
shadow: string;
7+
};
8+
9+
export async function readThemedPopupPaint(
10+
host: Locator,
11+
partName: "body" | "submenu",
12+
): Promise<{ actual: PopupPaint; expected: PopupPaint }> {
13+
return host.evaluate((element, popupPart) => {
14+
const surface = element.shadowRoot?.querySelector<HTMLElement>(`[part~="${popupPart}"]`);
15+
if (!surface) {
16+
throw new Error(`Web Awesome ${popupPart} surface did not render`);
17+
}
18+
const probe = document.createElement("span");
19+
probe.style.cssText =
20+
"position:fixed;background:var(--popover);border:1px solid var(--overlay-border);box-shadow:var(--overlay-shadow)";
21+
document.body.append(probe);
22+
const actual = getComputedStyle(surface);
23+
const expected = getComputedStyle(probe);
24+
const result = {
25+
actual: {
26+
background: actual.backgroundColor,
27+
border: actual.borderTopColor,
28+
shadow: actual.boxShadow,
29+
},
30+
expected: {
31+
background: expected.backgroundColor,
32+
border: expected.borderTopColor,
33+
shadow: expected.boxShadow,
34+
},
35+
};
36+
probe.remove();
37+
return result;
38+
}, partName);
39+
}

‎ui/src/e2e/session-owner-assignment.e2e.test.ts‎

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@ import path from "node:path";
33
import type { Page } from "playwright";
44
import { expect as expectBrowser } from "playwright/test";
55
import { expect, it } from "vitest";
6-
import { controlUiSessionUrl, installMockGateway } from "../test-helpers/control-ui-e2e.ts";
6+
import {
7+
controlUiBundledGatewayUrl,
8+
controlUiSessionUrl,
9+
installMockGateway,
10+
} from "../test-helpers/control-ui-e2e.ts";
711
import { createControlUiE2eSuite } from "./control-ui-e2e-suite.test-support.ts";
12+
import { readThemedPopupPaint } from "./popup-theme.test-support.ts";
813

914
const suite = createControlUiE2eSuite({
1015
name: "Control UI session owner assignment mocked Gateway E2E",
@@ -90,6 +95,45 @@ async function chooseAssignToMe(page: Page): Promise<void> {
9095
}
9196

9297
suite.define(() => {
98+
it("themes the assignee submenu with the active palette", async () => {
99+
await suite.withPage(
100+
{
101+
colorScheme: "dark",
102+
locale: "en-US",
103+
serviceWorkers: "block",
104+
viewport: { height: 900, width: 1280 },
105+
},
106+
async ({ page }) => {
107+
await page.addInitScript(
108+
({ gatewayUrl }) => {
109+
localStorage.setItem(
110+
`openclaw.control.settings.v1:${gatewayUrl}`,
111+
JSON.stringify({ gatewayUrl, theme: "dash", themeMode: "dark" }),
112+
);
113+
},
114+
{ gatewayUrl: controlUiBundledGatewayUrl(suite.server.baseUrl) },
115+
);
116+
await installOwnerGateway(page);
117+
await expect.poll(() => page.locator("html").getAttribute("data-theme")).toBe("dash");
118+
119+
const row = page.locator(`[data-session-key="${sessionKey}"]`);
120+
await row.hover();
121+
await row
122+
.getByRole("button", { name: "Open session menu: Owner outcome", exact: true })
123+
.click();
124+
const assignTo = page.getByRole("menuitem", { name: "Assign to…", exact: true });
125+
await assignTo.hover();
126+
await assignTo
127+
.locator('wa-dropdown-item[slot="submenu"][value="assign-owner:human:profile-ada"]')
128+
.waitFor();
129+
130+
const paint = await readThemedPopupPaint(assignTo, "submenu");
131+
await captureProof(page, "assignee-submenu");
132+
expect(paint.actual).toEqual(paint.expected);
133+
},
134+
);
135+
});
136+
93137
it("keeps a rejected header owner assignment visible", async () => {
94138
await suite.withPage(
95139
{

‎ui/src/styles/base.css‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,8 +878,10 @@ wa-dropdown-item[type="checkbox"] {
878878
/* Web Awesome owns these popup panels in shadow DOM, so shared tokens enter
879879
through exported parts; feature styles continue to own content geometry. */
880880
wa-dropdown::part(menu),
881+
wa-dropdown-item::part(submenu),
881882
wa-popover::part(body),
882883
wa-select::part(listbox) {
884+
background: var(--popover);
883885
border-color: var(--overlay-border);
884886
box-shadow: var(--overlay-shadow);
885887
}

0 commit comments

Comments
 (0)