+
{
+ const BRANCHED_FIXTURE = 'Canvas-node-groups-branched-fixture.json';
+ const BRANCHED_GROUP_TITLE = 'Branched group';
+
+ test.beforeEach(async ({ n8n, setupRequirements }) => {
+ await setupRequirements(requirements);
+ await n8n.start.fromImportedWorkflow(BRANCHED_FIXTURE);
+ await n8n.canvas.clickZoomToFitButton();
+ await n8n.canvas.deselectAll();
+ });
+
+ test('shows an output port selector for a group with multiple leaves', async ({ n8n }) => {
+ await n8n.canvas.logsPanel.open();
+ await n8n.canvas.clickExecuteWorkflowButton();
+
+ const groupRow = n8n.canvas.logsPanel.getGroupLogEntryByName(BRANCHED_GROUP_TITLE);
+ await expect(groupRow).toBeVisible();
+ await groupRow.click();
+
+ // Single root (a) → no input port selector.
+ // Two leaves (c, d) → one output port selector.
+ await expect(n8n.canvas.logsPanel.getGroupPortSelects()).toHaveCount(1);
+ });
+
+ test('switching output port changes the visible leaf member', async ({ n8n }) => {
+ await n8n.canvas.logsPanel.open();
+ await n8n.canvas.clickExecuteWorkflowButton();
+
+ const groupRow = n8n.canvas.logsPanel.getGroupLogEntryByName(BRANCHED_GROUP_TITLE);
+ await groupRow.click();
+
+ const portSelect = n8n.canvas.logsPanel.getGroupPortSelects();
+ await expect(portSelect).toHaveCount(1);
+
+ // Open the output port selector and switch to the second leaf (d)
+ await portSelect.click();
+
+ const options = n8n.page.getByTestId('logs-group-port-option');
+ await expect(options).toHaveCount(2);
+ await options.nth(1).click();
+
+ // The output pane now shows node d's output data
+ await expect(n8n.canvas.logsPanel.outputPanel.get().getByText('d')).toBeVisible();
+ });
+ },
+);
diff --git a/packages/testing/playwright/workflows/Canvas-node-groups-branched-fixture.json b/packages/testing/playwright/workflows/Canvas-node-groups-branched-fixture.json
new file mode 100644
index 00000000000..5a4a6056ede
--- /dev/null
+++ b/packages/testing/playwright/workflows/Canvas-node-groups-branched-fixture.json
@@ -0,0 +1,87 @@
+{
+ "nodes": [
+ {
+ "parameters": {},
+ "type": "n8n-nodes-base.manualTrigger",
+ "typeVersion": 1,
+ "position": [32, 144],
+ "id": "f1c5b6a8-1f5b-4a92-9bb2-3e6e8a8a0001",
+ "name": "When clicking ‘Execute workflow’"
+ },
+ {
+ "parameters": {
+ "category": "randomData",
+ "randomDataCount": 1
+ },
+ "type": "n8n-nodes-base.debugHelper",
+ "typeVersion": 1,
+ "position": [272, 144],
+ "id": "5809aa61-863c-4086-a5e2-deb824f7bc00",
+ "name": "DebugHelper"
+ },
+ {
+ "parameters": {},
+ "type": "n8n-nodes-base.noOp",
+ "typeVersion": 1,
+ "position": [560, 128],
+ "id": "5f47ab06-70a3-4cab-9ff7-3071da5809f2",
+ "name": "a"
+ },
+ {
+ "parameters": {},
+ "type": "n8n-nodes-base.noOp",
+ "typeVersion": 1,
+ "position": [768, 128],
+ "id": "563d1de9-efda-4b91-bf23-a85d55b4dc08",
+ "name": "b"
+ },
+ {
+ "parameters": {},
+ "type": "n8n-nodes-base.noOp",
+ "typeVersion": 1,
+ "position": [1024, 0],
+ "id": "26b484e0-461b-4f21-bb20-abbe9695e441",
+ "name": "c"
+ },
+ {
+ "parameters": {},
+ "type": "n8n-nodes-base.noOp",
+ "typeVersion": 1,
+ "position": [1024, 224],
+ "id": "6e1a8a52-482a-4860-8301-b7bf7a3c46fb",
+ "name": "d"
+ }
+ ],
+ "connections": {
+ "When clicking ‘Execute workflow’": {
+ "main": [[{ "node": "DebugHelper", "type": "main", "index": 0 }]]
+ },
+ "DebugHelper": {
+ "main": [[{ "node": "a", "type": "main", "index": 0 }]]
+ },
+ "a": {
+ "main": [[{ "node": "b", "type": "main", "index": 0 }]]
+ },
+ "b": {
+ "main": [
+ [{ "node": "c", "type": "main", "index": 0 }, { "node": "d", "type": "main", "index": 0 }]
+ ]
+ }
+ },
+ "nodeGroups": [
+ {
+ "id": "229926ec-f89d-44a8-b46c-502538dabead",
+ "name": "Branched group",
+ "nodeIds": [
+ "5f47ab06-70a3-4cab-9ff7-3071da5809f2",
+ "563d1de9-efda-4b91-bf23-a85d55b4dc08",
+ "26b484e0-461b-4f21-bb20-abbe9695e441",
+ "6e1a8a52-482a-4860-8301-b7bf7a3c46fb"
+ ]
+ }
+ ],
+ "pinData": {},
+ "meta": {
+ "instanceId": "canvas-node-groups-branched-fixture"
+ }
+}