From 24d54e4db532df239ebf8caec1054147db89678c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Almeida?= Date: Wed, 23 Sep 2026 09:47:46 +0000 Subject: [PATCH] test: De-flake NDV run selector linking across input and output (#39087) Co-authored-by: Claude Opus 4.8 --- .../playwright/pages/NodeDetailsViewPage.ts | 20 ++++++++++--------- .../editor/ndv/ndv-data-display.spec.ts | 16 +++++++-------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/packages/testing/playwright/pages/NodeDetailsViewPage.ts b/packages/testing/playwright/pages/NodeDetailsViewPage.ts index 76ea314f9d3..8029f3524bb 100644 --- a/packages/testing/playwright/pages/NodeDetailsViewPage.ts +++ b/packages/testing/playwright/pages/NodeDetailsViewPage.ts @@ -550,24 +550,26 @@ export class NodeDetailsViewPage extends BasePage { const selector = this.inputPanel.getRunSelector(); await selector.click(); await this.getVisiblePopoverOption(value).click(); - await expect(this.inputPanel.getRunSelectorInput()).toHaveValue(containsValue(value)); + await this.expectInputRunSelectorValue(value); } async changeOutputRunSelector(value: string) { const selector = this.outputPanel.getRunSelector(); await selector.click(); await this.getVisiblePopoverOption(value).click(); + await this.expectOutputRunSelectorValue(value); + } + + // Run-selector updates can land asynchronously (notably cross-panel via + // run-linking), so assert with a retrying matcher rather than reading once. + async expectInputRunSelectorValue(value: string) { + await expect(this.inputPanel.getRunSelectorInput()).toHaveValue(containsValue(value)); + } + + async expectOutputRunSelectorValue(value: string) { await expect(this.outputPanel.getRunSelectorInput()).toHaveValue(containsValue(value)); } - async getInputRunSelectorValue() { - return await this.inputPanel.getRunSelectorInput().inputValue(); - } - - async getOutputRunSelectorValue() { - return await this.outputPanel.getRunSelectorInput().inputValue(); - } - getExecuteNodeButton() { return this.container.getByTestId('node-execute-button'); } diff --git a/packages/testing/playwright/tests/e2e/workflows/editor/ndv/ndv-data-display.spec.ts b/packages/testing/playwright/tests/e2e/workflows/editor/ndv/ndv-data-display.spec.ts index 9c935b9256f..04134e07e19 100644 --- a/packages/testing/playwright/tests/e2e/workflows/editor/ndv/ndv-data-display.spec.ts +++ b/packages/testing/playwright/tests/e2e/workflows/editor/ndv/ndv-data-display.spec.ts @@ -167,35 +167,35 @@ test.describe( await n8n.ndv.ensureOutputRunLinking(true); await n8n.ndv.inputPanel.getTbodyCell(0, 0).click(); - expect(await n8n.ndv.getInputRunSelectorValue()).toContain('2 of 2 (6 items)'); - expect(await n8n.ndv.getOutputRunSelectorValue()).toContain('2 of 2 (6 items)'); + await n8n.ndv.expectInputRunSelectorValue('2 of 2 (6 items)'); + await n8n.ndv.expectOutputRunSelectorValue('2 of 2 (6 items)'); await n8n.ndv.changeOutputRunSelector('1 of 2 (6 items)'); - expect(await n8n.ndv.getInputRunSelectorValue()).toContain('1 of 2 (6 items)'); + await n8n.ndv.expectInputRunSelectorValue('1 of 2 (6 items)'); await expect(n8n.ndv.inputPanel.getTbodyCell(0, 0)).toHaveText('1111'); await expect(n8n.ndv.outputPanel.getTbodyCell(0, 0)).toHaveText('1111'); await n8n.ndv.inputPanel.getTbodyCell(0, 0).click(); await n8n.ndv.changeInputRunSelector('2 of 2 (6 items)'); - expect(await n8n.ndv.getOutputRunSelectorValue()).toContain('2 of 2 (6 items)'); + await n8n.ndv.expectOutputRunSelectorValue('2 of 2 (6 items)'); await n8n.ndv.outputPanel.getLinkRun().click(); await n8n.ndv.inputPanel.getTbodyCell(0, 0).click(); await n8n.ndv.changeOutputRunSelector('1 of 2 (6 items)'); - expect(await n8n.ndv.getInputRunSelectorValue()).toContain('2 of 2 (6 items)'); + await n8n.ndv.expectInputRunSelectorValue('2 of 2 (6 items)'); await n8n.ndv.outputPanel.getLinkRun().click(); await n8n.ndv.inputPanel.getTbodyCell(0, 0).click(); - expect(await n8n.ndv.getInputRunSelectorValue()).toContain('1 of 2 (6 items)'); + await n8n.ndv.expectInputRunSelectorValue('1 of 2 (6 items)'); await n8n.ndv.inputPanel.toggleInputRunLinking(); await n8n.ndv.inputPanel.getTbodyCell(0, 0).click(); await n8n.ndv.changeInputRunSelector('2 of 2 (6 items)'); - expect(await n8n.ndv.getOutputRunSelectorValue()).toContain('1 of 2 (6 items)'); + await n8n.ndv.expectOutputRunSelectorValue('1 of 2 (6 items)'); await n8n.ndv.inputPanel.toggleInputRunLinking(); await n8n.ndv.inputPanel.getTbodyCell(0, 0).click(); - expect(await n8n.ndv.getOutputRunSelectorValue()).toContain('2 of 2 (6 items)'); + await n8n.ndv.expectOutputRunSelectorValue('2 of 2 (6 items)'); }); });