From 84301bd7b66fcfac4923574c99a1152ff2ef93fe Mon Sep 17 00:00:00 2001 From: Adam Obuchowicz Date: Wed, 20 Mar 2024 12:00:22 +0100 Subject: [PATCH] Fix Conditional ports tests. (#9495) Fixes #9459 Sometimes, especially on prod builds, the click handler quickly created CB before playwright made its actionability checks. --- app/gui2/e2e/edgeInteractions.spec.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/gui2/e2e/edgeInteractions.spec.ts b/app/gui2/e2e/edgeInteractions.spec.ts index 622268663ee..15d9fd15bfa 100644 --- a/app/gui2/e2e/edgeInteractions.spec.ts +++ b/app/gui2/e2e/edgeInteractions.spec.ts @@ -51,6 +51,8 @@ test('Connect an node to a port via dragging the edge', async ({ page }) => { }) // Click the target port in the `prod` node. const targetPort = page.locator('span').filter({ hasText: /^sum$/ }) + // We need `force: true` because edge connecting is handled in capture phase and may result + // in port change, what confuses playwright's actionability checks. await targetPort.click({ force: true, noWaitAfter: true }) await expect(graphNodeByBinding(page, 'prod')).toContainText('ten') @@ -71,7 +73,9 @@ test('Conditional ports: Disabled', async ({ page }) => { await page.mouse.click(outputPort.x, outputPort.y) await conditionalPort.hover() await expect(conditionalPort).not.toHaveClass(/isTarget/) - await conditionalPort.click() + // We need `force: true` because ComponentBrowser appears in event's capture phase, what + // confuses playwright's actionability checks. + await conditionalPort.click({ force: true }) await expect(locate.componentBrowser(page)).toExist() await page.keyboard.press('Escape') }) @@ -89,7 +93,8 @@ test('Conditional ports: Enabled', async ({ page }) => { await page.mouse.click(outputPort.x, outputPort.y) await conditionalPort.hover() await expect(conditionalPort).toHaveClass(/isTarget/) - await conditionalPort.click() + // We need to force port clicks; see comment in 'Connect an node to a port via dragging the edge' + await conditionalPort.click({ force: true }) await expect(node.locator('.WidgetToken')).toHaveText(['final']) await page.keyboard.up('Meta')