Skip to content

Commit ca360b8

Browse files
travkin79Copilot
andcommitted
Probe both chat renderers via -Dprobe.renderer launch property
Both the browser-based (HTML) and the seasoned StyledText renderers ship behind the useBrowserBasedChatRenderer preference, so both need probe coverage. Select the renderer per launch instead of hardcoding it. - ProbeRunner: read -Dprobe.renderer (browser | styledtext) and set USE_BROWSER_BASED_CHAT_RENDERER accordingly. Default styledtext matches the production default, so plain runs still exercise the SWT widget tree. - chat-send-receive-001.json: restored to the strong StyledText widget-tree assertions (user-turn, copilot-turn, model-info-label) for the default renderer. - chat-send-receive-browser-001.json (new): browser-renderer variant that asserts the Browser widget exists, then uses sleep + screenshot because the HTML DOM is opaque to SWTBot widget locators. - REFERENCE.md: document the -Dprobe.renderer property and the two-probe workflow for covering both renderers. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 569e5fa commit ca360b8

3 files changed

Lines changed: 75 additions & 0 deletions

File tree

.github/skills/ui-action/REFERENCE.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,29 @@ The module-only shortcut can fail dependency resolution or reuse stale bundles,
3434
especially after source edits. If widget markers or other code changes appear to
3535
be ignored, run the root `clean verify` command.
3636

37+
### Selecting the chat renderer
38+
39+
The plugin ships two chat renderers behind the `useBrowserBasedChatRenderer`
40+
preference, and probes can target either one via the `-Dprobe.renderer` launch
41+
property (read once by `ProbeRunner` before the ChatView opens):
42+
43+
- omit it, or pass `-Dprobe.renderer=styledtext`, to run against the seasoned
44+
StyledText renderer (the production default). These probes assert the SWT
45+
widget tree (`user-turn`, `copilot-turn`, `model-info-label`).
46+
- pass `-Dprobe.renderer=browser` to run against the browser-based (HTML)
47+
renderer. Its conversation content lives in an SWT `Browser` DOM that is opaque
48+
to SWTBot widget locators, so those probes assert the `Browser` widget exists
49+
and fall back to `sleep` + `screenshot` for visual verification.
50+
51+
Because the renderer is chosen per launch, cover both by running the two probes:
52+
53+
```bash
54+
# StyledText renderer (default)
55+
./mvnw clean verify -Dprobe.script=probe-scripts/chat-send-receive-001.json
56+
# Browser renderer
57+
./mvnw clean verify -Dprobe.script=probe-scripts/chat-send-receive-browser-001.json -Dprobe.renderer=browser
58+
```
59+
3760
Platform notes:
3861

3962
- Linux headless: prefix the command with `xvfb-run -a`.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[
2+
{ "action": "waitForIdle" },
3+
{ "action": "screenshot", "id": "01-startup" },
4+
5+
{ "action": "showView", "idRef": "com.microsoft.copilot.eclipse.ui.chat.ChatView" },
6+
{ "action": "waitForIdle" },
7+
{ "action": "screenshot", "id": "02-chat-open" },
8+
9+
{ "action": "assertExists",
10+
"locator": { "by": "viewId", "id": "com.microsoft.copilot.eclipse.ui.chat.ChatView" } },
11+
12+
{ "action": "waitFor",
13+
"locator": { "by": "widgetClass", "value": "Browser" },
14+
"timeoutSec": 30 },
15+
16+
{ "action": "waitFor",
17+
"locator": { "by": "styledText" },
18+
"timeoutSec": 30 },
19+
20+
{ "action": "click", "locator": { "by": "styledText" } },
21+
{ "action": "clearElement", "locator": { "by": "styledText" } },
22+
{ "action": "typeIn", "locator": { "by": "styledText" }, "text": "hello" },
23+
{ "action": "screenshot", "id": "03-typed" },
24+
25+
{ "action": "dumpUi", "id": "03b-pre-model-poll" },
26+
{ "action": "screenshot", "id": "03c-pre-model-poll" },
27+
28+
{ "action": "waitForMethod",
29+
"locator": { "by": "widgetId", "value": "model-picker" },
30+
"method": "getSelectedItemId",
31+
"timeoutSec": 60 },
32+
33+
{ "action": "waitFor",
34+
"locator": { "by": "buttonWithTooltip", "tooltip": "Send" },
35+
"timeoutSec": 30 },
36+
{ "action": "click", "locator": { "by": "buttonWithTooltip", "tooltip": "Send" } },
37+
38+
{ "action": "sleep", "timeoutSec": 5 },
39+
{ "action": "screenshot", "id": "04-user-message-sent" },
40+
41+
{ "action": "sleep", "timeoutSec": 90 },
42+
{ "action": "screenshot", "id": "05-agent-response" },
43+
{ "action": "dumpUi", "id": "06-final" }
44+
]

com.microsoft.copilot.eclipse.swtbot.test/src/com/microsoft/copilot/eclipse/swtbot/test/probe/ProbeRunner.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
@RunWith(SWTBotJunit4ClassRunner.class)
4949
public class ProbeRunner {
5050
private static final String SYSPROP = "probe.script";
51+
private static final String RENDERER_SYSPROP = "probe.renderer";
5152
private static final Path RESULTS_DIR = Paths.get("target", "probe-results");
5253
private static final String UI_BUNDLE_ID = "com.microsoft.copilot.eclipse.ui";
5354

@@ -77,6 +78,13 @@ private static void suppressNuisancePreferences() {
7778
prefs.putBoolean(Constants.AUTO_SHOW_WHAT_IS_NEW, false);
7879
prefs.put(Constants.LAST_USED_COPILOT_PLUGIN_VERSION, currentUiBundleMajorMinor());
7980
prefs.putBoolean(Constants.SUPPRESS_TERMINAL_DEPENDENCY_DIALOG, true);
81+
// Select the chat renderer per launch so the same probe flow can be run against both
82+
// renderers: pass -Dprobe.renderer=browser for the browser-based (HTML) renderer, or
83+
// omit it (or -Dprobe.renderer=styledtext) for the seasoned StyledText renderer. The
84+
// default matches production (StyledText), so plain runs exercise the SWT widget tree.
85+
boolean useBrowserRenderer =
86+
"browser".equalsIgnoreCase(System.getProperty(RENDERER_SYSPROP, "styledtext"));
87+
prefs.putBoolean(Constants.USE_BROWSER_BASED_CHAT_RENDERER, useBrowserRenderer);
8088
prefs.flush();
8189
} catch (BackingStoreException | RuntimeException e) {
8290
System.err.println("[ProbeRunner] Failed to preset nuisance-dialog preferences: " + e);

0 commit comments

Comments
 (0)