mirror of
https://github.com/enso-org/enso.git
synced 2024-12-22 16:11:45 +03:00
343a644051
- Synchronize Y.Js clients by AST (implements #8237). - Before committing an edit, insert any parentheses-nodes needed for the concrete syntax to reflect tree structure (fixes #8884). - Move `externalId` and all node metadata into a Y.Map owned by each `Ast`. This allows including metadata changes in an edit, enables Y.Js merging of changes to different metadata fields, and will enable the use of Y.Js objects in metadata. (Implements #8804.) ### Important Notes - Metadata is now set and retrieved through accessors on the `Ast` objects. - Since some metadata edits need to take effect in real time (e.g. node dragging), new lower-overhead APIs (`commitDirect`, `skipTreeRepair`) are provided for careful use in certain cases. - The client is now bundled as ESM. - The build script cleans up git-untracked generated files in an outdated location, which fixes lint errors related to `src/generated` that may occur when switching branches.
70 lines
3.4 KiB
TypeScript
70 lines
3.4 KiB
TypeScript
import { expect, test, type Page } from '@playwright/test'
|
|
import * as actions from './actions'
|
|
import * as locate from './locate'
|
|
|
|
async function edgesFromNodeWithBinding(page: Page, binding: string) {
|
|
const node = locate.graphNodeByBinding(page, binding).first()
|
|
const nodeId = await node.getAttribute('data-node-id')
|
|
return page.locator(`[data-source-node-id="${nodeId}"]`)
|
|
}
|
|
async function edgesToNodeWithBinding(page: Page, binding: string) {
|
|
const node = locate.graphNodeByBinding(page, binding).first()
|
|
const nodeId = await node.getAttribute('data-node-id')
|
|
return page.locator(`[data-target-node-id="${nodeId}"]`)
|
|
}
|
|
|
|
// For each outgoing edge we expect two elements: an element for io and an element for the rendered edge itself.
|
|
const EDGE_PARTS = 2
|
|
|
|
test('Existence of edges between nodes', async ({ page }) => {
|
|
await actions.goToGraph(page)
|
|
|
|
await expect(await edgesFromNodeWithBinding(page, 'aggregated')).toHaveCount(0)
|
|
await expect(await edgesFromNodeWithBinding(page, 'filtered')).toHaveCount(0)
|
|
await expect(await edgesFromNodeWithBinding(page, 'data')).toHaveCount(2 * EDGE_PARTS)
|
|
await expect(await edgesFromNodeWithBinding(page, 'list')).toHaveCount(0)
|
|
await expect(await edgesFromNodeWithBinding(page, 'final')).toHaveCount(0)
|
|
await expect(await edgesFromNodeWithBinding(page, 'prod')).toHaveCount(EDGE_PARTS)
|
|
await expect(await edgesFromNodeWithBinding(page, 'sum')).toHaveCount(EDGE_PARTS)
|
|
await expect(await edgesFromNodeWithBinding(page, 'ten')).toHaveCount(EDGE_PARTS)
|
|
await expect(await edgesFromNodeWithBinding(page, 'five')).toHaveCount(EDGE_PARTS)
|
|
|
|
await expect(await edgesToNodeWithBinding(page, 'aggregated')).toHaveCount(EDGE_PARTS)
|
|
await expect(await edgesToNodeWithBinding(page, 'filtered')).toHaveCount(EDGE_PARTS)
|
|
await expect(await edgesToNodeWithBinding(page, 'data')).toHaveCount(0)
|
|
await expect(await edgesToNodeWithBinding(page, 'list')).toHaveCount(0)
|
|
await expect(await edgesToNodeWithBinding(page, 'final')).toHaveCount(EDGE_PARTS)
|
|
await expect(await edgesToNodeWithBinding(page, 'prod')).toHaveCount(EDGE_PARTS)
|
|
await expect(await edgesToNodeWithBinding(page, 'sum')).toHaveCount(2 * EDGE_PARTS)
|
|
await expect(await edgesToNodeWithBinding(page, 'ten')).toHaveCount(0)
|
|
await expect(await edgesToNodeWithBinding(page, 'five')).toHaveCount(0)
|
|
})
|
|
|
|
test('Hover behaviour of edges', async ({ page }) => {
|
|
await actions.goToGraph(page)
|
|
|
|
const edgeElements = await edgesFromNodeWithBinding(page, 'ten')
|
|
await expect(edgeElements).toHaveCount(EDGE_PARTS)
|
|
|
|
const targetEdge = edgeElements.first()
|
|
await expect(targetEdge).toHaveClass('edge io')
|
|
// It is not currently possible to interact with edges in the default node layout.
|
|
// See: https://github.com/enso-org/enso/issues/8938
|
|
/*
|
|
// Hover over edge to the right of node with binding `ten`.
|
|
await targetEdge.hover({
|
|
position: { x: 60, y: 45 }, // source node
|
|
})
|
|
// Expect an extra edge for the split rendering.
|
|
const hoveredEdgeElements = await edgesFromNodeWithBinding(page, 'ten')
|
|
await expect(hoveredEdgeElements).toHaveCount(2 * EDGE_PARTS)
|
|
|
|
// Expect the top edge part to be dimmed
|
|
const topEdge = page.locator('path:nth-child(4)')
|
|
await expect(topEdge).toHaveClass('edge visible dimmed')
|
|
// Expect the bottom edge part not to be dimmed
|
|
const bottomEdge = page.locator('path:nth-child(6)')
|
|
await expect(bottomEdge).toHaveClass('edge visible')
|
|
*/
|
|
})
|