mirror of
https://github.com/enso-org/enso.git
synced 2025-01-02 18:34:04 +03:00
b7a8909818
- Improved performance by batching simulatenous node edits, including metadata updates when dragging many selected nodes together. - Updated Vue to new version, allowing us to use `defineModel`. - Fixed #9161 - Unified all handling of auto-blur by making `useAutoBlur` cheap to register - all logic goes through a single window event handler. - Combined all `ResizeObserver`s into one. - Fixed the behaviour of repeated toast messages. Now only the latest compilation status is visible at any given time, and the errors disappear once compilation passes. - Actually fixed broken interaction of node and visualization widths. There no longer is a style feedback loop and the visible node backdrop width no longer jumps or randomly fails to update.
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import { type Page } from '@playwright/test'
|
|
import { expect } 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 expect(locate.graphNode(page)).toExist()
|
|
// Wait for position initialization
|
|
await expectNodePositionsInitialized(page, 64)
|
|
}
|
|
|
|
export async function expectNodePositionsInitialized(page: Page, yPos: number) {
|
|
// TODO: The yPos should not need to be a variable. Instead, first automatically positioned nodes
|
|
// should always have constant known position. This is a bug caused by incorrect layout after
|
|
// entering a function. To be fixed with #9255
|
|
await expect(locate.graphNode(page).first()).toHaveCSS(
|
|
'transform',
|
|
`matrix(1, 0, 0, 1, -16, ${yPos})`,
|
|
)
|
|
}
|
|
|
|
export async function exitFunction(page: Page, x = 300, y = 300) {
|
|
await page.mouse.dblclick(x, y, { delay: 10 })
|
|
}
|
|
|
|
// =================
|
|
// === 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,
|
|
})
|
|
}
|