Fix Conditional ports tests. (#9495)

Fixes #9459

Sometimes, especially on prod builds, the click handler quickly created CB before playwright made its actionability checks.
This commit is contained in:
Adam Obuchowicz 2024-03-20 12:00:22 +01:00 committed by GitHub
parent 2f0d99a1cb
commit 84301bd7b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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')