Workaround for failing test (#9498)

One of our tests had transient failures, which were very tricky to track - it seems that not every `mouse.move` action actually emits 'pointerleave' action, on which we rely when hiding node menu.

I played with different configurations, and this one looks quite reliable (100 runs of tests in a row passed, at least). But I still don't understand what is happening there, and the investigation will be in scope of #9478
This commit is contained in:
Adam Obuchowicz 2024-03-20 14:36:33 +01:00 committed by GitHub
parent 84301bd7b6
commit a02cfa4906
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -270,14 +270,16 @@ test('Component browser handling of overridden record-mode', async ({ page }) =>
const ADDED_PATH = '"/home/enso/Input.txt"'
const recordModeToggle = node.getByTestId('overrideRecordingButton')
const recordModeIndicator = node.getByTestId('recordingOverriddenButton')
const MENU_UNHOVER_CLOSE_DELAY = 300
// Enable record mode for the node.
await locate.graphNodeIcon(node).hover()
await expect(recordModeToggle).not.toHaveClass(/recording-overridden/)
await recordModeToggle.click()
await page.mouse.move(100, 80)
await page.waitForTimeout(MENU_UNHOVER_CLOSE_DELAY)
// TODO[ao]: The simple move near top-left corner not always works i.e. not always
// `pointerleave` event is emitted. Investigated in https://github.com/enso-org/enso/issues/9478
// once fixed, remember to change the second `await page.mouse.move(700, 1200, { steps: 20 })`
// line below.
await page.mouse.move(700, 1200, { steps: 20 })
await expect(recordModeIndicator).toBeVisible()
await locate.graphNodeIcon(node).hover()
await expect(recordModeToggle).toHaveClass(/recording-overridden/)
@ -291,7 +293,8 @@ test('Component browser handling of overridden record-mode', async ({ page }) =>
await input.pressSequentially(` ${ADDED_PATH}`)
await page.keyboard.press('Enter')
await expect(locate.componentBrowser(page)).not.toBeVisible()
await page.mouse.move(100, 80)
// See TODO above.
await page.mouse.move(700, 1200, { steps: 20 })
await expect(recordModeIndicator).toBeVisible()
// Ensure after editing the node, editing still doesn't display the override expression.
await locate.graphNodeIcon(node).click({ modifiers: [CONTROL_KEY] })