Skip to content

Commit

Permalink
Make background clicks less flaky (#10069)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
farmaazon committed May 24, 2024
1 parent 084be27 commit 0f6b29c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/gui2/e2e/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 } })
}

// =================
Expand Down
4 changes: 2 additions & 2 deletions app/gui2/e2e/componentBrowser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
})
Expand Down
2 changes: 1 addition & 1 deletion app/gui2/e2e/selectingNodes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 0f6b29c

Please sign in to comment.