Skip to content

Commit 906994e

Browse files
committed
Merge branch 'develop' into wip/vitvakatu/visualization-fixes
2 parents 3dcbcec + e59b422 commit 906994e

File tree

200 files changed

+4404
-2879
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+4404
-2879
lines changed

app/gui2/e2e/collapsingAndEntering.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ test('Entering nodes', async ({ page }) => {
1111
await actions.goToGraph(page)
1212
await mockCollapsedFunctionInfo(page, 'final', 'func1')
1313
await expectInsideMain(page)
14-
await expect(locate.navBreadcrumb(page)).toHaveText(['main'])
14+
await expect(locate.navBreadcrumb(page)).toHaveText(['Mock Project'])
1515

1616
await locate.graphNodeByBinding(page, 'final').dblclick()
1717
await mockCollapsedFunctionInfo(page, 'f2', 'func2')
1818
await expectInsideFunc1(page)
19-
await expect(locate.navBreadcrumb(page)).toHaveText(['main', 'func1'])
19+
await expect(locate.navBreadcrumb(page)).toHaveText(['Mock Project', 'func1'])
2020

2121
await locate.graphNodeByBinding(page, 'f2').dblclick()
2222
await expectInsideFunc2(page)
23-
await expect(locate.navBreadcrumb(page)).toHaveText(['main', 'func1', 'func2'])
23+
await expect(locate.navBreadcrumb(page)).toHaveText(['Mock Project', 'func1', 'func2'])
2424
})
2525

2626
test('Leaving entered nodes', async ({ page }) => {
@@ -42,7 +42,7 @@ test('Using breadcrumbs to navigate', async ({ page }) => {
4242
await page.mouse.dblclick(100, 100)
4343
await expectInsideMain(page)
4444
// Breadcrumbs still have all the crumbs, but the last two are dimmed.
45-
await expect(locate.navBreadcrumb(page)).toHaveText(['main', 'func1', 'func2'])
45+
await expect(locate.navBreadcrumb(page)).toHaveText(['Mock Project', 'func1', 'func2'])
4646
await expect(locate.navBreadcrumb(page, (f) => f.class('inactive'))).toHaveText([
4747
'func1',
4848
'func2',
@@ -51,7 +51,7 @@ test('Using breadcrumbs to navigate', async ({ page }) => {
5151
await locate.navBreadcrumb(page).filter({ hasText: 'func2' }).click()
5252
await expectInsideFunc2(page)
5353

54-
await locate.navBreadcrumb(page).filter({ hasText: 'main' }).click()
54+
await locate.navBreadcrumb(page).filter({ hasText: 'Mock Project' }).click()
5555
await expectInsideMain(page)
5656

5757
await locate.navBreadcrumb(page).filter({ hasText: 'func1' }).click()

app/gui2/e2e/componentBrowser.spec.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import * as actions from './actions'
55
import * as customExpect from './customExpect'
66
import * as locate from './locate'
77

8-
const ACCEPT_SUGGESTION_SHORTCUT = os.platform() === 'darwin' ? 'Meta+Enter' : 'Control+Enter'
8+
const CONTROL_KEY = os.platform() === 'darwin' ? 'Meta' : 'Control'
9+
const ACCEPT_SUGGESTION_SHORTCUT = `${CONTROL_KEY}+Enter`
910

1011
async function deselectAllNodes(page: Page) {
1112
await page.keyboard.press('Escape')
@@ -148,3 +149,36 @@ test('Filtering list', async ({ page }) => {
148149
const highlighted = locate.componentBrowserEntry(page).locator('.component-label-segment.match')
149150
await expect(highlighted).toHaveText(['re', '_te'])
150151
})
152+
153+
test('Editing existing nodes', async ({ page }) => {
154+
await actions.goToGraph(page)
155+
const node = locate.graphNodeByBinding(page, 'data')
156+
const ADDED_PATH = '"/home/enso/Input.txt"'
157+
158+
// Start node editing
159+
await locate.graphNodeIcon(node).click({ modifiers: [CONTROL_KEY] })
160+
await expect(locate.componentBrowser(page)).toBeVisible()
161+
const input = locate.componentBrowserInput(page).locator('input')
162+
await expect(input).toHaveValue('Data.read')
163+
164+
// Add argument and accept
165+
await page.keyboard.press('End')
166+
await input.pressSequentially(` ${ADDED_PATH}`)
167+
await expect(input).toHaveValue(`Data.read ${ADDED_PATH}`)
168+
await page.keyboard.press('Enter')
169+
await expect(locate.componentBrowser(page)).not.toBeVisible()
170+
await expect(node.locator('.WidgetToken')).toHaveText(['Data', '.', 'read'])
171+
await expect(node.locator('.WidgetText input')).toHaveValue(ADDED_PATH)
172+
173+
// Edit again, using "edit" button
174+
await locate.graphNodeIcon(node).click()
175+
await node.getByTestId('edit-button').click()
176+
await expect(locate.componentBrowser(page)).toBeVisible()
177+
await expect(input).toHaveValue(`Data.read ${ADDED_PATH}`)
178+
for (let i = 0; i < ADDED_PATH.length; ++i) await page.keyboard.press('Backspace')
179+
await expect(input).toHaveValue('Data.read ')
180+
await page.keyboard.press('Enter')
181+
await expect(locate.componentBrowser(page)).not.toBeVisible()
182+
await expect(node.locator('.WidgetToken')).toHaveText(['Data', '.', 'read'])
183+
await expect(node.locator('.WidgetText')).not.toBeVisible()
184+
})

app/gui2/e2e/locate.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,23 @@ export function exitFullscreenButton(page: Locator | Page) {
113113

114114
export const toggleFullscreenButton = or(enterFullscreenButton, exitFullscreenButton)
115115

116+
// === Nodes ===
117+
118+
declare const nodeLocatorBrand: unique symbol
119+
type Node = Locator & { [nodeLocatorBrand]: never }
120+
121+
export function graphNode(page: Page | Locator): Node {
122+
return page.locator('.GraphNode') as Node
123+
}
124+
export function graphNodeByBinding(page: Locator | Page, binding: string): Node {
125+
return graphNode(page).filter({
126+
has: page.locator('.binding').and(page.getByText(binding)),
127+
}) as Node
128+
}
129+
export function graphNodeIcon(node: Node) {
130+
return node.locator('.icon')
131+
}
132+
116133
// === Data locators ===
117134

118135
type SanitizeClassName<T extends string> = T extends `${infer A}.${infer B}`
@@ -128,10 +145,6 @@ function componentLocator<T extends string>(className: SanitizeClassName<T>) {
128145
}
129146

130147
export const graphEditor = componentLocator('GraphEditor')
131-
export const graphNode = componentLocator('GraphNode')
132-
export function graphNodeByBinding(page: Locator | Page, binding: string) {
133-
return graphNode(page).filter({ has: page.locator('.binding').and(page.getByText(binding)) })
134-
}
135148
// @ts-expect-error
136149
export const anyVisualization = componentLocator('GraphVisualization > *')
137150
export const circularMenu = componentLocator('CircularMenu')

app/gui2/scripts/generateIconMetadata.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ console.info('Writing icon name type to "./src/util/iconName.ts"...')
1111
await fs.writeFile(
1212
'./src/util/iconName.ts',
1313
`\
14-
// Generated by \`scripts/generateIcons.js\`.
15-
// Please run \`npm run generate\` to regenerate this file whenever \`icons.svg\` is changed.
14+
// Generated by \`scripts/generateIconMetadata.js\`.
15+
// Please run \`npm run generate-metadata\` to regenerate this file whenever \`icons.svg\` is changed.
1616
import iconNames from '@/util/iconList.json'
1717
1818
export type Icon =

app/gui2/src/assets/icons.svg

Lines changed: 38 additions & 0 deletions
Loading

app/gui2/src/components/CircularMenu.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ const emit = defineEmits<{
3131
:modelValue="props.isVisualizationVisible"
3232
@update:modelValue="emit('update:isVisualizationVisible', $event)"
3333
/>
34-
<SvgIcon name="edit" class="icon-container button slot6" @click.stop="emit('startEditing')" />
34+
<SvgIcon
35+
name="edit"
36+
class="icon-container button slot6"
37+
data-testid="edit-button"
38+
@click.stop="emit('startEditing')"
39+
/>
3540
<ToggleIcon
3641
:icon="props.isOutputContextEnabledGlobally ? 'no_auto_replay' : 'auto_replay'"
3742
class="icon-container button slot7"

app/gui2/src/components/ComponentBrowser.vue

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,7 @@ const handler = componentBrowserBindings.handler({
419419
:style="{ color: componentColor(item.component) }"
420420
/>
421421
<span>
422-
<span
423-
v-if="!item.component.matchedRanges || item.component.matchedAlias"
424-
v-text="item.component.label"
425-
></span>
422+
<span v-if="!item.component.matchedRanges" v-text="item.component.label"></span>
426423
<span
427424
v-for="range in allRanges(
428425
item.component.matchedRanges,
@@ -450,10 +447,7 @@ const handler = componentBrowserBindings.handler({
450447
>
451448
<SvgIcon :name="item.component.icon" />
452449
<span>
453-
<span
454-
v-if="!item.component.matchedRanges || item.component.matchedAlias"
455-
v-text="item.component.label"
456-
></span>
450+
<span v-if="!item.component.matchedRanges" v-text="item.component.label"></span>
457451
<span
458452
v-for="range in allRanges(
459453
item.component.matchedRanges,

0 commit comments

Comments
 (0)