2024-03-06 18:34:07 +03:00
|
|
|
import { test, type Page } from '@playwright/test'
|
2024-01-18 16:45:18 +03:00
|
|
|
import os from 'os'
|
|
|
|
import * as actions from './actions'
|
2024-03-06 18:34:07 +03:00
|
|
|
import { expect } from './customExpect'
|
2024-01-18 16:45:18 +03:00
|
|
|
import { mockCollapsedFunctionInfo } from './expressionUpdates'
|
|
|
|
import * as locate from './locate'
|
|
|
|
|
2024-03-25 19:05:20 +03:00
|
|
|
const MAIN_FILE_NODES = 11
|
|
|
|
|
2024-01-18 16:45:18 +03:00
|
|
|
const COLLAPSE_SHORTCUT = os.platform() === 'darwin' ? 'Meta+G' : 'Control+G'
|
|
|
|
|
|
|
|
test('Entering nodes', async ({ page }) => {
|
|
|
|
await actions.goToGraph(page)
|
|
|
|
await mockCollapsedFunctionInfo(page, 'final', 'func1')
|
|
|
|
await expectInsideMain(page)
|
2024-02-23 16:48:33 +03:00
|
|
|
await expect(locate.navBreadcrumb(page)).toHaveText(['Mock Project'])
|
2024-01-18 16:45:18 +03:00
|
|
|
|
|
|
|
await locate.graphNodeByBinding(page, 'final').dblclick()
|
|
|
|
await mockCollapsedFunctionInfo(page, 'f2', 'func2')
|
|
|
|
await expectInsideFunc1(page)
|
2024-02-23 16:48:33 +03:00
|
|
|
await expect(locate.navBreadcrumb(page)).toHaveText(['Mock Project', 'func1'])
|
2024-01-18 16:45:18 +03:00
|
|
|
|
|
|
|
await locate.graphNodeByBinding(page, 'f2').dblclick()
|
|
|
|
await expectInsideFunc2(page)
|
2024-02-23 16:48:33 +03:00
|
|
|
await expect(locate.navBreadcrumb(page)).toHaveText(['Mock Project', 'func1', 'func2'])
|
2024-01-18 16:45:18 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
test('Leaving entered nodes', async ({ page }) => {
|
|
|
|
await actions.goToGraph(page)
|
|
|
|
await enterToFunc2(page)
|
|
|
|
|
2024-03-06 18:34:07 +03:00
|
|
|
await actions.exitFunction(page)
|
2024-01-18 16:45:18 +03:00
|
|
|
await expectInsideFunc1(page)
|
|
|
|
|
2024-03-06 18:34:07 +03:00
|
|
|
await actions.exitFunction(page)
|
2024-01-18 16:45:18 +03:00
|
|
|
await expectInsideMain(page)
|
|
|
|
})
|
|
|
|
|
|
|
|
test('Using breadcrumbs to navigate', async ({ page }) => {
|
|
|
|
await actions.goToGraph(page)
|
|
|
|
await enterToFunc2(page)
|
2024-03-06 18:34:07 +03:00
|
|
|
await actions.exitFunction(page)
|
Fix interfering click handlers (#9127)
Fixes one failure in #8942 which caught a real issue: clicks at various panels were triggering many handlers at once, often unexpectedly - for example quick clicking at breadcrumbs (and automatic tests always click fast) we could also trigger getting out the current node.
Therefore, I added `stopPropagation` for all mouse events on "panel" level + where I think the event should be considered "handled" and no longer bother anyone. Also, to unify things, most actions are for `click` event.
Additionally I spotted and fixed some issues:
* When "clicking-off" Component Browser, it creates new node only if anything was actually typed in (no more dangling `operatorX.` nodes)
* Filtering now works for operators
* When, after opening CB with source node, user starts typing operator, we replace dot with space
* Fixed our shortcut handler, so it works properly with `click` event.
* Fixed problems with defocusing input in CB when clicking at links.
# Important Notes
I removed `PointerMain` binding for deselectAll, because it was triggered every time did the area selection.
2024-02-22 18:18:28 +03:00
|
|
|
await expectInsideFunc1(page)
|
2024-03-06 18:34:07 +03:00
|
|
|
await actions.exitFunction(page)
|
Fix interfering click handlers (#9127)
Fixes one failure in #8942 which caught a real issue: clicks at various panels were triggering many handlers at once, often unexpectedly - for example quick clicking at breadcrumbs (and automatic tests always click fast) we could also trigger getting out the current node.
Therefore, I added `stopPropagation` for all mouse events on "panel" level + where I think the event should be considered "handled" and no longer bother anyone. Also, to unify things, most actions are for `click` event.
Additionally I spotted and fixed some issues:
* When "clicking-off" Component Browser, it creates new node only if anything was actually typed in (no more dangling `operatorX.` nodes)
* Filtering now works for operators
* When, after opening CB with source node, user starts typing operator, we replace dot with space
* Fixed our shortcut handler, so it works properly with `click` event.
* Fixed problems with defocusing input in CB when clicking at links.
# Important Notes
I removed `PointerMain` binding for deselectAll, because it was triggered every time did the area selection.
2024-02-22 18:18:28 +03:00
|
|
|
await expectInsideMain(page)
|
2024-01-18 16:45:18 +03:00
|
|
|
// Breadcrumbs still have all the crumbs, but the last two are dimmed.
|
2024-02-23 16:48:33 +03:00
|
|
|
await expect(locate.navBreadcrumb(page)).toHaveText(['Mock Project', 'func1', 'func2'])
|
2024-01-18 16:45:18 +03:00
|
|
|
await expect(locate.navBreadcrumb(page, (f) => f.class('inactive'))).toHaveText([
|
|
|
|
'func1',
|
|
|
|
'func2',
|
|
|
|
])
|
|
|
|
|
2024-01-29 13:53:44 +03:00
|
|
|
await locate.navBreadcrumb(page).filter({ hasText: 'func2' }).click()
|
|
|
|
await expectInsideFunc2(page)
|
|
|
|
|
2024-02-23 16:48:33 +03:00
|
|
|
await locate.navBreadcrumb(page).filter({ hasText: 'Mock Project' }).click()
|
2024-01-29 13:53:44 +03:00
|
|
|
await expectInsideMain(page)
|
|
|
|
|
|
|
|
await locate.navBreadcrumb(page).filter({ hasText: 'func1' }).click()
|
|
|
|
await expectInsideFunc1(page)
|
2024-01-18 16:45:18 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
test('Collapsing nodes', async ({ page }) => {
|
|
|
|
await actions.goToGraph(page)
|
2024-01-26 20:18:27 +03:00
|
|
|
const initialNodesCount = await locate.graphNode(page).count()
|
2024-01-18 16:45:18 +03:00
|
|
|
await mockCollapsedFunctionInfo(page, 'final', 'func1')
|
|
|
|
|
Fix interfering click handlers (#9127)
Fixes one failure in #8942 which caught a real issue: clicks at various panels were triggering many handlers at once, often unexpectedly - for example quick clicking at breadcrumbs (and automatic tests always click fast) we could also trigger getting out the current node.
Therefore, I added `stopPropagation` for all mouse events on "panel" level + where I think the event should be considered "handled" and no longer bother anyone. Also, to unify things, most actions are for `click` event.
Additionally I spotted and fixed some issues:
* When "clicking-off" Component Browser, it creates new node only if anything was actually typed in (no more dangling `operatorX.` nodes)
* Filtering now works for operators
* When, after opening CB with source node, user starts typing operator, we replace dot with space
* Fixed our shortcut handler, so it works properly with `click` event.
* Fixed problems with defocusing input in CB when clicking at links.
# Important Notes
I removed `PointerMain` binding for deselectAll, because it was triggered every time did the area selection.
2024-02-22 18:18:28 +03:00
|
|
|
// Widgets may "steal" clicks, so we always click at icon.
|
|
|
|
await locate
|
2024-03-08 22:00:39 +03:00
|
|
|
.graphNodeByBinding(page, 'prod')
|
Fix interfering click handlers (#9127)
Fixes one failure in #8942 which caught a real issue: clicks at various panels were triggering many handlers at once, often unexpectedly - for example quick clicking at breadcrumbs (and automatic tests always click fast) we could also trigger getting out the current node.
Therefore, I added `stopPropagation` for all mouse events on "panel" level + where I think the event should be considered "handled" and no longer bother anyone. Also, to unify things, most actions are for `click` event.
Additionally I spotted and fixed some issues:
* When "clicking-off" Component Browser, it creates new node only if anything was actually typed in (no more dangling `operatorX.` nodes)
* Filtering now works for operators
* When, after opening CB with source node, user starts typing operator, we replace dot with space
* Fixed our shortcut handler, so it works properly with `click` event.
* Fixed problems with defocusing input in CB when clicking at links.
# Important Notes
I removed `PointerMain` binding for deselectAll, because it was triggered every time did the area selection.
2024-02-22 18:18:28 +03:00
|
|
|
.locator('.icon')
|
|
|
|
.click({ modifiers: ['Shift'] })
|
|
|
|
await locate
|
|
|
|
.graphNodeByBinding(page, 'sum')
|
|
|
|
.locator('.icon')
|
|
|
|
.click({ modifiers: ['Shift'] })
|
|
|
|
await locate
|
2024-03-08 22:00:39 +03:00
|
|
|
.graphNodeByBinding(page, 'ten')
|
Fix interfering click handlers (#9127)
Fixes one failure in #8942 which caught a real issue: clicks at various panels were triggering many handlers at once, often unexpectedly - for example quick clicking at breadcrumbs (and automatic tests always click fast) we could also trigger getting out the current node.
Therefore, I added `stopPropagation` for all mouse events on "panel" level + where I think the event should be considered "handled" and no longer bother anyone. Also, to unify things, most actions are for `click` event.
Additionally I spotted and fixed some issues:
* When "clicking-off" Component Browser, it creates new node only if anything was actually typed in (no more dangling `operatorX.` nodes)
* Filtering now works for operators
* When, after opening CB with source node, user starts typing operator, we replace dot with space
* Fixed our shortcut handler, so it works properly with `click` event.
* Fixed problems with defocusing input in CB when clicking at links.
# Important Notes
I removed `PointerMain` binding for deselectAll, because it was triggered every time did the area selection.
2024-02-22 18:18:28 +03:00
|
|
|
.locator('.icon')
|
|
|
|
.click({ modifiers: ['Shift'] })
|
2024-01-18 16:45:18 +03:00
|
|
|
|
|
|
|
await page.keyboard.press(COLLAPSE_SHORTCUT)
|
2024-01-26 20:18:27 +03:00
|
|
|
await expect(locate.graphNode(page)).toHaveCount(initialNodesCount - 2)
|
2024-01-18 16:45:18 +03:00
|
|
|
const collapsedNode = locate.graphNodeByBinding(page, 'prod')
|
|
|
|
await expect(collapsedNode.locator('.WidgetToken')).toHaveText(['Main', '.', 'collapsed', 'five'])
|
|
|
|
await mockCollapsedFunctionInfo(page, 'prod', 'collapsed')
|
|
|
|
|
|
|
|
await collapsedNode.dblclick()
|
|
|
|
await expect(locate.graphNode(page)).toHaveCount(4)
|
2024-03-06 18:34:07 +03:00
|
|
|
await expect(locate.graphNodeByBinding(page, 'ten')).toExist()
|
|
|
|
await expect(locate.graphNodeByBinding(page, 'sum')).toExist()
|
|
|
|
await expect(locate.graphNodeByBinding(page, 'prod')).toExist()
|
2024-01-18 16:45:18 +03:00
|
|
|
|
2024-03-05 10:06:11 +03:00
|
|
|
await locate
|
Fix interfering click handlers (#9127)
Fixes one failure in #8942 which caught a real issue: clicks at various panels were triggering many handlers at once, often unexpectedly - for example quick clicking at breadcrumbs (and automatic tests always click fast) we could also trigger getting out the current node.
Therefore, I added `stopPropagation` for all mouse events on "panel" level + where I think the event should be considered "handled" and no longer bother anyone. Also, to unify things, most actions are for `click` event.
Additionally I spotted and fixed some issues:
* When "clicking-off" Component Browser, it creates new node only if anything was actually typed in (no more dangling `operatorX.` nodes)
* Filtering now works for operators
* When, after opening CB with source node, user starts typing operator, we replace dot with space
* Fixed our shortcut handler, so it works properly with `click` event.
* Fixed problems with defocusing input in CB when clicking at links.
# Important Notes
I removed `PointerMain` binding for deselectAll, because it was triggered every time did the area selection.
2024-02-22 18:18:28 +03:00
|
|
|
.graphNodeByBinding(page, 'ten')
|
|
|
|
.locator('.icon')
|
|
|
|
.click({ modifiers: ['Shift'] })
|
2024-01-18 16:45:18 +03:00
|
|
|
// Wait till node is selected.
|
|
|
|
await expect(locate.graphNodeByBinding(page, 'ten').and(page.locator('.selected'))).toHaveCount(1)
|
|
|
|
await page.keyboard.press(COLLAPSE_SHORTCUT)
|
|
|
|
await expect(locate.graphNode(page)).toHaveCount(4)
|
|
|
|
|
|
|
|
const secondCollapsedNode = locate.graphNodeByBinding(page, 'ten')
|
|
|
|
await expect(secondCollapsedNode.locator('.WidgetToken')).toHaveText(['Main', '.', 'collapsed1'])
|
|
|
|
await mockCollapsedFunctionInfo(page, 'ten', 'collapsed1')
|
2024-02-06 12:43:38 +03:00
|
|
|
await secondCollapsedNode.dblclick()
|
2024-01-18 16:45:18 +03:00
|
|
|
await expect(locate.graphNode(page)).toHaveCount(2)
|
2024-03-06 18:34:07 +03:00
|
|
|
await expect(locate.graphNodeByBinding(page, 'ten')).toExist()
|
2024-01-18 16:45:18 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
async function expectInsideMain(page: Page) {
|
2024-03-06 18:34:07 +03:00
|
|
|
await actions.expectNodePositionsInitialized(page, 64)
|
2024-03-25 19:05:20 +03:00
|
|
|
await expect(locate.graphNode(page)).toHaveCount(MAIN_FILE_NODES)
|
2024-03-06 18:34:07 +03:00
|
|
|
await expect(locate.graphNodeByBinding(page, 'five')).toExist()
|
|
|
|
await expect(locate.graphNodeByBinding(page, 'ten')).toExist()
|
|
|
|
await expect(locate.graphNodeByBinding(page, 'sum')).toExist()
|
|
|
|
await expect(locate.graphNodeByBinding(page, 'prod')).toExist()
|
|
|
|
await expect(locate.graphNodeByBinding(page, 'final')).toExist()
|
|
|
|
await expect(locate.graphNodeByBinding(page, 'list')).toExist()
|
|
|
|
await expect(locate.graphNodeByBinding(page, 'data')).toExist()
|
|
|
|
await expect(locate.graphNodeByBinding(page, 'aggregated')).toExist()
|
|
|
|
await expect(locate.graphNodeByBinding(page, 'filtered')).toExist()
|
2024-01-18 16:45:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
async function expectInsideFunc1(page: Page) {
|
2024-03-06 18:34:07 +03:00
|
|
|
await actions.expectNodePositionsInitialized(page, 192)
|
2024-01-18 16:45:18 +03:00
|
|
|
await expect(locate.graphNode(page)).toHaveCount(3)
|
2024-03-06 18:34:07 +03:00
|
|
|
await expect(locate.graphNodeByBinding(page, 'f2')).toExist()
|
|
|
|
await expect(locate.graphNodeByBinding(page, 'result')).toExist()
|
2024-01-18 16:45:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
async function expectInsideFunc2(page: Page) {
|
2024-03-06 18:34:07 +03:00
|
|
|
await actions.expectNodePositionsInitialized(page, 128)
|
2024-01-18 16:45:18 +03:00
|
|
|
await expect(locate.graphNode(page)).toHaveCount(2)
|
2024-03-06 18:34:07 +03:00
|
|
|
await expect(locate.graphNodeByBinding(page, 'r')).toExist()
|
2024-01-18 16:45:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
async function enterToFunc2(page: Page) {
|
|
|
|
await mockCollapsedFunctionInfo(page, 'final', 'func1')
|
|
|
|
await locate.graphNodeByBinding(page, 'final').dblclick()
|
Fix interfering click handlers (#9127)
Fixes one failure in #8942 which caught a real issue: clicks at various panels were triggering many handlers at once, often unexpectedly - for example quick clicking at breadcrumbs (and automatic tests always click fast) we could also trigger getting out the current node.
Therefore, I added `stopPropagation` for all mouse events on "panel" level + where I think the event should be considered "handled" and no longer bother anyone. Also, to unify things, most actions are for `click` event.
Additionally I spotted and fixed some issues:
* When "clicking-off" Component Browser, it creates new node only if anything was actually typed in (no more dangling `operatorX.` nodes)
* Filtering now works for operators
* When, after opening CB with source node, user starts typing operator, we replace dot with space
* Fixed our shortcut handler, so it works properly with `click` event.
* Fixed problems with defocusing input in CB when clicking at links.
# Important Notes
I removed `PointerMain` binding for deselectAll, because it was triggered every time did the area selection.
2024-02-22 18:18:28 +03:00
|
|
|
await expectInsideFunc1(page)
|
2024-01-18 16:45:18 +03:00
|
|
|
await mockCollapsedFunctionInfo(page, 'f2', 'func2')
|
|
|
|
await locate.graphNodeByBinding(page, 'f2').dblclick()
|
Fix interfering click handlers (#9127)
Fixes one failure in #8942 which caught a real issue: clicks at various panels were triggering many handlers at once, often unexpectedly - for example quick clicking at breadcrumbs (and automatic tests always click fast) we could also trigger getting out the current node.
Therefore, I added `stopPropagation` for all mouse events on "panel" level + where I think the event should be considered "handled" and no longer bother anyone. Also, to unify things, most actions are for `click` event.
Additionally I spotted and fixed some issues:
* When "clicking-off" Component Browser, it creates new node only if anything was actually typed in (no more dangling `operatorX.` nodes)
* Filtering now works for operators
* When, after opening CB with source node, user starts typing operator, we replace dot with space
* Fixed our shortcut handler, so it works properly with `click` event.
* Fixed problems with defocusing input in CB when clicking at links.
# Important Notes
I removed `PointerMain` binding for deselectAll, because it was triggered every time did the area selection.
2024-02-22 18:18:28 +03:00
|
|
|
await expectInsideFunc2(page)
|
2024-01-18 16:45:18 +03:00
|
|
|
}
|