enso/app/gui2/e2e/actions.ts
Adam Obuchowicz c69ba4ee70
Fix area select regression (#9197)
Fixes #9182

Now we are careful when to handle events - before or after updating intersected set.

Added general E2E and detailed unit tests for selecting.

Also discovered, that sometimes the test are running while nodes are not yet in right positions. Added an instruction ensuring the position is right.
2024-02-28 13:14:48 +00:00

36 lines
1.0 KiB
TypeScript

import { expect, type Page } from '@playwright/test'
import * as customExpect from './customExpect'
import * as locate from './locate'
import { graphNodeByBinding } from './locate'
// =================
// === goToGraph ===
// =================
/** Perform a successful login. */
export async function goToGraph(page: Page) {
await page.goto('/')
await expect(page.locator('.App')).toBeVisible()
// Wait until nodes are loaded.
await customExpect.toExist(locate.graphNode(page))
// Wait for position initialization
await expect(locate.graphNode(page).first()).toHaveCSS(
'transform',
'matrix(1, 0, 0, 1, -16, -16)',
)
}
// =================
// === Drag Node ===
// =================
/// Move node defined by the given binding by the given x and y.
export async function dragNodeByBinding(page: Page, nodeBinding: string, x: number, y: number) {
const node = graphNodeByBinding(page, nodeBinding)
const grabHandle = await node.locator('.grab-handle')
await grabHandle.dragTo(grabHandle, {
targetPosition: { x, y },
force: true,
})
}