mirror of
https://github.com/enso-org/enso.git
synced 2024-12-21 12:51:37 +03:00
dcad48e66f
Introduce add-node button below circular menu or open visualization. https://github.com/enso-org/enso/assets/1047859/aa6cedba-ca7e-44c5-ab27-2f5d5f9421e8
61 lines
2.3 KiB
TypeScript
61 lines
2.3 KiB
TypeScript
import { test } from '@playwright/test'
|
|
import assert from 'assert'
|
|
import * as actions from './actions'
|
|
import { expect } from './customExpect'
|
|
import * as locate from './locate'
|
|
|
|
test('Selecting nodes by click', async ({ page }) => {
|
|
await actions.goToGraph(page)
|
|
const node1 = locate.graphNodeByBinding(page, 'five')
|
|
const node2 = locate.graphNodeByBinding(page, 'final')
|
|
await expect(node1).not.toBeSelected()
|
|
await expect(node2).not.toBeSelected()
|
|
|
|
await locate.graphNodeIcon(node1).click()
|
|
await expect(node1).toBeSelected()
|
|
await expect(node2).not.toBeSelected()
|
|
|
|
// Check that clicking an unselected node deselects replaces the previous selection.
|
|
await locate.graphNodeIcon(node2).click()
|
|
await expect(node1).not.toBeSelected()
|
|
await expect(node2).toBeSelected()
|
|
|
|
await page.waitForTimeout(300) // Avoid double clicks
|
|
await locate.graphNodeIcon(node1).click({ modifiers: ['Shift'] })
|
|
await expect(node1).toBeSelected()
|
|
await expect(node2).toBeSelected()
|
|
|
|
// Check that when two nodes are selected, clicking a selected node replaces the previous selection.
|
|
await locate.graphNodeIcon(node2).click()
|
|
await expect(node1).not.toBeSelected()
|
|
await expect(node2).toBeSelected()
|
|
|
|
// Check that clicking the background deselects all nodes.
|
|
await page.mouse.click(600, 200)
|
|
await expect(node1).not.toBeSelected()
|
|
await expect(node2).not.toBeSelected()
|
|
})
|
|
|
|
test('Selecting nodes by area drag', async ({ page }) => {
|
|
await actions.goToGraph(page)
|
|
const node1 = locate.graphNodeByBinding(page, 'five')
|
|
const node2 = locate.graphNodeByBinding(page, 'ten')
|
|
await expect(node1).not.toBeSelected()
|
|
await expect(node2).not.toBeSelected()
|
|
|
|
const node1BBox = await node1.locator('.selection').boundingBox()
|
|
const node2BBox = await node2.boundingBox()
|
|
assert(node1BBox)
|
|
assert(node2BBox)
|
|
await page.mouse.move(node1BBox.x - 50, node1BBox.y - 50)
|
|
await page.mouse.down()
|
|
await page.mouse.move(node1BBox.x - 49, node1BBox.y - 49)
|
|
await expect(page.locator('.SelectionBrush')).toBeVisible()
|
|
await page.mouse.move(node2BBox.x + node2BBox.width, node2BBox.y + node2BBox.height)
|
|
await expect(node1).toBeSelected()
|
|
await expect(node2).toBeSelected()
|
|
await page.mouse.up()
|
|
await expect(node1).toBeSelected()
|
|
await expect(node2).toBeSelected()
|
|
})
|