Make background clicks less flaky (#10069)

We had some false test failures: https://github.com/enso-org/enso/actions/runs/9178969067/job/25240028635

The problem was the connection, which, while not being completely broken, still wasn't updated to proper position, thus taking clicks meant for the background. Now, I use proper locator click, so the test should wait for click spot being clear.

Also added locator-based clicks where I felt it's proper.
This commit is contained in:
Adam Obuchowicz 2024-05-24 15:28:51 +02:00 committed by GitHub
parent 084be279c5
commit 0f6b29c88f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -33,7 +33,7 @@ export async function expectNodePositionsInitialized(page: Page, yPos: number) {
}
export async function exitFunction(page: Page, x = 300, y = 300) {
await page.mouse.dblclick(x, y, { delay: 10 })
await locate.graphEditor(page).dblclick({ position: { x, y } })
}
// =================

View File

@ -56,7 +56,7 @@ test('Different ways of opening Component Browser', async ({ page }) => {
// Dragging out an edge
const outputPort = await locate.outputPortCoordinates(locate.graphNodeByBinding(page, 'final'))
await page.mouse.click(outputPort.x, outputPort.y)
await page.mouse.click(100, 500)
await locate.graphEditor(page).click({ position: { x: 100, y: 500 } })
await expectAndCancelBrowser(page, '', 'final')
// Double-clicking port
// TODO[ao] Without timeout, even the first click would be treated as double due to previous
@ -111,7 +111,7 @@ test('Graph Editor pans to Component Browser', async ({ page }) => {
await expect(locate.graphNodeByBinding(page, 'five')).toBeInViewport()
const outputPort = await locate.outputPortCoordinates(locate.graphNodeByBinding(page, 'final'))
await page.mouse.click(outputPort.x, outputPort.y)
await page.mouse.click(100, 1700)
await locate.graphEditor(page).click({ position: { x: 100, y: 1700 } })
await expect(locate.graphNodeByBinding(page, 'five')).not.toBeInViewport()
await expectAndCancelBrowser(page, '', 'final')
})

View File

@ -37,7 +37,7 @@ test('Selecting nodes by click', async ({ page }) => {
await expect(selectionMenu).not.toBeVisible()
// Check that clicking the background deselects all nodes.
await page.mouse.click(600, 200)
await locate.graphEditor(page).click({ position: { x: 600, y: 200 } })
await expect(node1).not.toBeSelected()
await expect(node2).not.toBeSelected()
await expect(selectionMenu).not.toBeVisible()