mirror of
https://github.com/enso-org/enso.git
synced 2024-12-21 17:41:32 +03:00
678270ac69
Adds e2e test for interactions with edges.
31 lines
921 B
TypeScript
31 lines
921 B
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))
|
|
}
|
|
|
|
// =================
|
|
// === 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,
|
|
})
|
|
}
|