Skip to content

AI-native design editor. Open-source Figma alternative.

fix: repair the app e2e suite and the bugs it was hiding (#968)

Danila Poyarkov3289649da8ce
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 294139da1..eb11f3c48 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -224,6 +224,7 @@
- Keep round and other stroke caps and joins after saving and reopening the file on icons from `insert_icon` and Design JSX `<Icon>`, and on vectors from inline Design JSX `<svg>`, `import_svg`, and dropped or pasted SVG files. They were set only on the stroke paint, which `.fig` does not store, so outline icons such as Lucide's reopened with butt caps and miter joins and showed gaps where their strokes meet.
- Join the right room from a pasted link that ends in a query, `#`, or `/`, and say so when pasted text is not a room link instead of joining an empty room.
- Name the layer and page rename fields, the command palette list, and picker lists for screen readers, and announce disabled picker options as disabled.
+- Show a fill's whole hex value and the whole opacity in the Design panel; the last hex digit and the opacity were cut off beside the variable button.
### Performance
diff --git a/src/app/code/sandbox/document.ts b/src/app/code/sandbox/document.ts
index aa1a51db0..f4712750a 100644
--- a/src/app/code/sandbox/document.ts
+++ b/src/app/code/sandbox/document.ts
@@ -26,8 +26,14 @@ self.onmessage = ({ data }) => {
if (name === 'defineVars') return (vars) => Object.fromEntries(Object.entries(vars).map(([key, value]) => [key, { __openPencilHelper: 'designVar', args: [value] }]))
return helper(name)
}
- const names = Object.keys(elements)
- const tags = elements
+ // A dotted element such as Button.Root is a member of its namespace, as JSX reads the tag.
+ const tags = {}
+ for (const [name, type] of Object.entries(elements)) {
+ const [space, member] = name.split('.')
+ if (member === undefined) tags[name] = type
+ else (tags[space] ??= {})[member] = type
+ }
+ const names = Object.keys(tags)
const helpers = Object.fromEntries(helperNames.map((name) => [name, helperRuntime(name)]))
const validate = (value, depth = 0, state = { elements: 0, bytes: 0 }) => {
if (depth > limits.depth) throw new Error('Design JSX output is too deeply nested.')
diff --git a/src/components/properties/paint/PaintValue.vue b/src/components/properties/paint/PaintValue.vue
index 230cef036..3b2626bb3 100644
--- a/src/components/properties/paint/PaintValue.vue
+++ b/src/components/properties/paint/PaintValue.vue
@@ -35,7 +35,7 @@ const tooltip = computed(() => (variableName ? `${variableName} · #${model.hex.
v-else
:aria-label="label"
data-property="color-hex"
- class="min-w-0 flex-1 border-none bg-transparent font-mono text-xs text-surface outline-none"
+ class="min-w-0 flex-1 border-none bg-transparent font-mono text-[11px] text-surface outline-none"
:value="model.hex.value"
maxlength="6"
@change="model.updateHex(inputValue($event))"
diff --git a/src/theme/input/number-field.ts b/src/theme/input/number-field.ts
index bd74f1dab..b26807aa9 100644
--- a/src/theme/input/number-field.ts
+++ b/src/theme/input/number-field.ts
@@ -17,8 +17,9 @@ const numberFieldTheme = {
suffix: 'shrink-0 pr-1.5 text-muted'
},
variants: {
+ /** A trailing control, such as the variable button, brings its own spacing after the unit. */
suffix: {
- true: { display: 'pr-0' },
+ true: { display: 'pr-0', suffix: 'pr-0.5' },
false: { display: 'pr-1.5' }
}
}
diff --git a/src/theme/paint/field.ts b/src/theme/paint/field.ts
index f040f80fe..74f6416db 100644
--- a/src/theme/paint/field.ts
+++ b/src/theme/paint/field.ts
@@ -2,9 +2,9 @@ export default {
slots: {
root: 'flex h-6 min-w-0 flex-1 items-center overflow-hidden rounded border border-transparent bg-panel-field text-[11px] transition-colors hover:bg-panel-field-hover focus-within:border-panel-focus focus-within:bg-panel-field-hover',
preview: 'flex shrink-0 items-center pl-1',
- value: 'flex min-w-0 flex-1 items-center pl-1.5 pr-1',
+ value: 'flex min-w-0 flex-1 items-center pl-1 pr-1',
divider: 'h-4 w-px shrink-0 bg-muted/40',
- opacity: 'h-full w-14 flex-none shrink-0',
+ opacity: 'h-full w-13 flex-none shrink-0',
binding: 'flex shrink-0 items-center pr-0.5'
}
} as const
diff --git a/tests/e2e/app/menu.spec.ts b/tests/e2e/app/menu.spec.ts
index 1d9e475be..4e31a5d8e 100644
--- a/tests/e2e/app/menu.spec.ts
+++ b/tests/e2e/app/menu.spec.ts
@@ -1,19 +1,8 @@
import { expect, test, useEditorSetup } from '#tests/e2e/fixtures'
+import { openAppMenu } from '#tests/helpers/menu'
const editor = useEditorSetup()
-/**
- * Opens a top-level menu. A menu that just closed stays in the page while it animates out, and a
- * click on a trigger then is lost, so this waits for it to go before clicking.
- */
-async function openMenu(name: string) {
- await expect(editor.page.getByRole('menu')).toHaveCount(0)
- await editor.page.getByRole('menubar').getByRole('menuitem', { name, exact: true }).click()
- const menu = editor.page.getByRole('menu', { name })
- await expect(menu).toBeVisible()
- return menu
-}
-
test('menu bar is visible in browser mode', async () => {
const menubar = editor.page.locator('[role="menubar"]')
await expect(menubar).toBeVisible()
@@ -26,7 +15,7 @@ test('menu bar has all top-level menus', async () => {
})
test('File menu opens and shows items', async () => {
- const menu = await openMenu('File')
+ const menu = await openAppMenu(editor.page, 'File')
const items = await menu.locator('[role="menuitem"]').allTextContents()
expect(items.some((t) => t.includes('Open'))).toBe(true)
@@ -38,7 +27,7 @@ test('File menu opens and shows items', async () => {
})
test('Edit menu shows Undo/Redo/Delete', async () => {
- const menu = await openMenu('Edit')
+ const menu = await openAppMenu(editor.page, 'Edit')
const items = await menu.locator('[role="menuitem"]').allTextContents()
expect(items.some((t) => t.includes('Undo'))).toBe(true)
@@ -50,7 +39,7 @@ test('Edit menu shows Undo/Redo/Delete', async () => {
})
test('View menu shows zoom options', async () => {
- const menu = await openMenu('View')
+ const menu = await openAppMenu(editor.page, 'View')
const items = await menu.locator('[role="menuitem"]').allTextContents()
expect(items.some((t) => t.includes('Zoom to fit'))).toBe(true)
@@ -61,7 +50,7 @@ test('View menu shows zoom options', async () => {
})
test('Object menu shows Group/Ungroup/Component', async () => {
- const menu = await openMenu('Object')
+ const menu = await openAppMenu(editor.page, 'Object')
const items = await menu.locator('[role="menuitem"]').allTextContents()
expect(items.some((t) => t.includes('Group'))).toBe(true)
@@ -90,13 +79,13 @@ test('Move to page is disabled without a selection', async () => {
store.switchPage(store.graph.getPages()[0].id)
})
- await openMenu('Object')
+ await openAppMenu(editor.page, 'Object')
const moveToPage = editor.page.getByRole('menuitem', { name: 'Move to page' })
await expect(moveToPage).toHaveAttribute('data-disabled')
await editor.page.keyboard.press('Escape')
await editor.canvas.drawRect(200, 200, 100, 100)
- await openMenu('Object')
+ await openAppMenu(editor.page, 'Object')
await expect(editor.page.getByRole('menuitem', { name: 'Move to page' })).not.toHaveAttribute(
'data-disabled'
)
@@ -115,7 +104,7 @@ test('Undo via Edit menu works', async () => {
const beforeUndo = await getStoreStateNumber('selectedIds')
expect(beforeUndo).toBe(1)
- await openMenu('Edit')
+ await openAppMenu(editor.page, 'Edit')
const undoItem = editor.page.getByRole('menuitem', { name: /^Undo\b/ })
await expect(undoItem).toBeEnabled()
await undoItem.click()
@@ -124,7 +113,7 @@ test('Undo via Edit menu works', async () => {
const afterUndo = await getStoreStateNumber('selectedIds')
expect(afterUndo).toBe(0)
- await openMenu('Edit')
+ await openAppMenu(editor.page, 'Edit')
await expect(editor.page.getByRole('menuitem', { name: /^Redo\b/ })).toBeEnabled()
await editor.page.keyboard.press('Escape')
})
@@ -138,7 +127,7 @@ test('Duplicate via Edit menu works', async () => {
return store.graph.getChildren(store.state.currentPageId).length
})
- const editMenu = await openMenu('Edit')
+ const editMenu = await openAppMenu(editor.page, 'Edit')
await editMenu.locator('[role="menuitem"]', { hasText: 'Duplicate' }).click()
await editor.canvas.waitForRender()
@@ -152,14 +141,14 @@ test('Duplicate via Edit menu works', async () => {
})
test('Zoom to fit via View menu works', async () => {
- const zoomInMenu = await openMenu('View')
+ const zoomInMenu = await openAppMenu(editor.page, 'View')
await zoomInMenu.locator('[role="menuitem"]', { hasText: 'Zoom in' }).click()
await editor.canvas.waitForRender()
const zoomBefore = await getStoreStateNumber('zoom')
expect(zoomBefore).toBeGreaterThan(1)
- const zoomToFitMenu = await openMenu('View')
+ const zoomToFitMenu = await openAppMenu(editor.page, 'View')
await zoomToFitMenu.locator('[role="menuitem"]', { hasText: 'Zoom to fit' }).click()
await editor.canvas.waitForRender()
diff --git a/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/frame-held-rotation--32-openpencil-darwin.png b/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/frame-held-rotation--32-openpencil-darwin.png
index 651952d5c..91d43f952 100644
Binary files a/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/frame-held-rotation--32-openpencil-darwin.png and b/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/frame-held-rotation--32-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/frame-held-rotation-32-openpencil-darwin.png b/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/frame-held-rotation-32-openpencil-darwin.png
index bbb940d64..9d6722f55 100644
Binary files a/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/frame-held-rotation-32-openpencil-darwin.png and b/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/frame-held-rotation-32-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/nested-frame-rotation-preview-openpencil-darwin.png b/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/nested-frame-rotation-preview-openpencil-darwin.png
index 43ef39ad6..77d743ae2 100644
Binary files a/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/nested-frame-rotation-preview-openpencil-darwin.png and b/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/nested-frame-rotation-preview-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/rotated-frame-child-hover-highlight-openpencil-darwin.png b/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/rotated-frame-child-hover-highlight-openpencil-darwin.png
index b8e88e56e..b70ec5e24 100644
Binary files a/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/rotated-frame-child-hover-highlight-openpencil-darwin.png and b/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/rotated-frame-child-hover-highlight-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/rotated-frame-selection-labels-openpencil-darwin.png b/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/rotated-frame-selection-labels-openpencil-darwin.png
index a806f23a0..4da98cb97 100644
Binary files a/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/rotated-frame-selection-labels-openpencil-darwin.png and b/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/rotated-frame-selection-labels-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/rotated-frame-selection-labels-preview-openpencil-darwin.png b/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/rotated-frame-selection-labels-preview-openpencil-darwin.png
index b8e88e56e..b70ec5e24 100644
Binary files a/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/rotated-frame-selection-labels-preview-openpencil-darwin.png and b/tests/e2e/canvas/frame-overlays.spec.ts-snapshots/rotated-frame-selection-labels-preview-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/absolute-constraint-resize-openpencil-darwin.png b/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/absolute-constraint-resize-openpencil-darwin.png
index f63afd703..7100a205e 100644
Binary files a/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/absolute-constraint-resize-openpencil-darwin.png and b/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/absolute-constraint-resize-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/component-layout-scale-openpencil-darwin.png b/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/component-layout-scale-openpencil-darwin.png
index c53f5cd09..b9067878f 100644
Binary files a/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/component-layout-scale-openpencil-darwin.png and b/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/component-layout-scale-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/definition-layout-scale-openpencil-darwin.png b/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/definition-layout-scale-openpencil-darwin.png
index 80ba96f13..541200822 100644
Binary files a/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/definition-layout-scale-openpencil-darwin.png and b/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/definition-layout-scale-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/expression-layout-scale-openpencil-darwin.png b/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/expression-layout-scale-openpencil-darwin.png
index 3b889dec4..062c62a75 100644
Binary files a/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/expression-layout-scale-openpencil-darwin.png and b/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/expression-layout-scale-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/nested-layout-scale-openpencil-darwin.png b/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/nested-layout-scale-openpencil-darwin.png
index 2fa98e2bd..17b0efefe 100644
Binary files a/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/nested-layout-scale-openpencil-darwin.png and b/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/nested-layout-scale-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/rescale-layout-scale-openpencil-darwin.png b/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/rescale-layout-scale-openpencil-darwin.png
index 3112a2b7a..c65bf0880 100644
Binary files a/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/rescale-layout-scale-openpencil-darwin.png and b/tests/e2e/canvas/instance-scale-visual.spec.ts-snapshots/rescale-layout-scale-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/readable-frame--145-openpencil-darwin.png b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/readable-frame--145-openpencil-darwin.png
index 1c79c353b..e917ddd9a 100644
Binary files a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/readable-frame--145-openpencil-darwin.png and b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/readable-frame--145-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/readable-frame--40-openpencil-darwin.png b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/readable-frame--40-openpencil-darwin.png
index 91e2605f8..36d497abb 100644
Binary files a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/readable-frame--40-openpencil-darwin.png and b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/readable-frame--40-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/readable-frame-50-openpencil-darwin.png b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/readable-frame-50-openpencil-darwin.png
index 108346810..e550e74a4 100644
Binary files a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/readable-frame-50-openpencil-darwin.png and b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/readable-frame-50-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-0-5-openpencil-darwin.png b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-0-5-openpencil-darwin.png
index 76ea2eb4f..78d642fc7 100644
Binary files a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-0-5-openpencil-darwin.png and b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-0-5-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-1-openpencil-darwin.png b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-1-openpencil-darwin.png
index 57f1f4a6f..b20e69281 100644
Binary files a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-1-openpencil-darwin.png and b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-1-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-2-openpencil-darwin.png b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-2-openpencil-darwin.png
index 2624bd885..62beae231 100644
Binary files a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-2-openpencil-darwin.png and b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-2-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-hover-0-5-openpencil-darwin.png b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-hover-0-5-openpencil-darwin.png
index a7c344977..94dfd4b5b 100644
Binary files a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-hover-0-5-openpencil-darwin.png and b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-hover-0-5-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-hover-1-openpencil-darwin.png b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-hover-1-openpencil-darwin.png
index 559761204..df6063259 100644
Binary files a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-hover-1-openpencil-darwin.png and b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-hover-1-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-hover-2-openpencil-darwin.png b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-hover-2-openpencil-darwin.png
index 9d36395f5..42f026ac0 100644
Binary files a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-hover-2-openpencil-darwin.png and b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/section-pills-hover-2-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/unicode-section-labels-openpencil-darwin.png b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/unicode-section-labels-openpencil-darwin.png
index bc30c07f4..6a1ff44fd 100644
Binary files a/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/unicode-section-labels-openpencil-darwin.png and b/tests/e2e/canvas/label-anatomy.spec.ts-snapshots/unicode-section-labels-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/nested-transform-interaction.spec.ts-snapshots/nested-transform-false-false-held-openpencil-darwin.png b/tests/e2e/canvas/nested-transform-interaction.spec.ts-snapshots/nested-transform-false-false-held-openpencil-darwin.png
index 7a39b3126..fc69a6c23 100644
Binary files a/tests/e2e/canvas/nested-transform-interaction.spec.ts-snapshots/nested-transform-false-false-held-openpencil-darwin.png and b/tests/e2e/canvas/nested-transform-interaction.spec.ts-snapshots/nested-transform-false-false-held-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/nested-transform-interaction.spec.ts-snapshots/nested-transform-false-true-held-openpencil-darwin.png b/tests/e2e/canvas/nested-transform-interaction.spec.ts-snapshots/nested-transform-false-true-held-openpencil-darwin.png
index 31ce013bf..c4dfec34d 100644
Binary files a/tests/e2e/canvas/nested-transform-interaction.spec.ts-snapshots/nested-transform-false-true-held-openpencil-darwin.png and b/tests/e2e/canvas/nested-transform-interaction.spec.ts-snapshots/nested-transform-false-true-held-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/nested-transform-interaction.spec.ts-snapshots/nested-transform-true-false-held-openpencil-darwin.png b/tests/e2e/canvas/nested-transform-interaction.spec.ts-snapshots/nested-transform-true-false-held-openpencil-darwin.png
index 000241915..169e672dc 100644
Binary files a/tests/e2e/canvas/nested-transform-interaction.spec.ts-snapshots/nested-transform-true-false-held-openpencil-darwin.png and b/tests/e2e/canvas/nested-transform-interaction.spec.ts-snapshots/nested-transform-true-false-held-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/nested-transform-interaction.spec.ts-snapshots/nested-transform-true-true-held-openpencil-darwin.png b/tests/e2e/canvas/nested-transform-interaction.spec.ts-snapshots/nested-transform-true-true-held-openpencil-darwin.png
index bdd6ae276..4e4d4e905 100644
Binary files a/tests/e2e/canvas/nested-transform-interaction.spec.ts-snapshots/nested-transform-true-true-held-openpencil-darwin.png and b/tests/e2e/canvas/nested-transform-interaction.spec.ts-snapshots/nested-transform-true-true-held-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/occurrence-text-visual.spec.ts-snapshots/occurrence-text-override-openpencil-darwin.png b/tests/e2e/canvas/occurrence-text-visual.spec.ts-snapshots/occurrence-text-override-openpencil-darwin.png
index dc11e6829..7d28bb860 100644
Binary files a/tests/e2e/canvas/occurrence-text-visual.spec.ts-snapshots/occurrence-text-override-openpencil-darwin.png and b/tests/e2e/canvas/occurrence-text-visual.spec.ts-snapshots/occurrence-text-override-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/pen-variables.spec.ts-snapshots/pen-variable-colors-and-fonts-openpencil-darwin.png b/tests/e2e/canvas/pen-variables.spec.ts-snapshots/pen-variable-colors-and-fonts-openpencil-darwin.png
index 78ac570bf..07850ff6f 100644
Binary files a/tests/e2e/canvas/pen-variables.spec.ts-snapshots/pen-variable-colors-and-fonts-openpencil-darwin.png and b/tests/e2e/canvas/pen-variables.spec.ts-snapshots/pen-variable-colors-and-fonts-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/saved-glyph-visual.spec.ts-snapshots/saved-glyph-authority-openpencil-darwin.png b/tests/e2e/canvas/saved-glyph-visual.spec.ts-snapshots/saved-glyph-authority-openpencil-darwin.png
index c636837c0..3ce4e7425 100644
Binary files a/tests/e2e/canvas/saved-glyph-visual.spec.ts-snapshots/saved-glyph-authority-openpencil-darwin.png and b/tests/e2e/canvas/saved-glyph-visual.spec.ts-snapshots/saved-glyph-authority-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/text/path-visual.spec.ts-snapshots/text-path-rendering-and-selection-openpencil-darwin.png b/tests/e2e/canvas/text/path-visual.spec.ts-snapshots/text-path-rendering-and-selection-openpencil-darwin.png
index 1088c0ce8..ba7bf415e 100644
Binary files a/tests/e2e/canvas/text/path-visual.spec.ts-snapshots/text-path-rendering-and-selection-openpencil-darwin.png and b/tests/e2e/canvas/text/path-visual.spec.ts-snapshots/text-path-rendering-and-selection-openpencil-darwin.png differ
diff --git a/tests/e2e/canvas/tiled-large-blur-visual.spec.ts-snapshots/tiled-large-blur-mutation-settled-openpencil-darwin.png b/tests/e2e/canvas/tiled-large-blur-visual.spec.ts-snapshots/tiled-large-blur-mutation-settled-openpencil-darwin.png
index f6ddcc7ca..bfa1520f7 100644
Binary files a/tests/e2e/canvas/tiled-large-blur-visual.spec.ts-snapshots/tiled-large-blur-mutation-settled-openpencil-darwin.png and b/tests/e2e/canvas/tiled-large-blur-visual.spec.ts-snapshots/tiled-large-blur-mutation-settled-openpencil-darwin.png differ
diff --git a/tests/e2e/chat/turns.spec.ts b/tests/e2e/chat/turns.spec.ts
index c4a53249f..6c6ff744e 100644
--- a/tests/e2e/chat/turns.spec.ts
+++ b/tests/e2e/chat/turns.spec.ts
@@ -25,13 +25,11 @@ test('reverting a reply undoes its edits, marks it, saves the chat, and tells th
await chat.assistantMessage().getByTestId('chat-revert-turn').click()
expect(await cardCount(page)).toBe(0)
await expect(content).toHaveAttribute('data-reverted', 'true')
- await expect(content).toHaveCSS('opacity', '0.5')
// Restore redoes the edits, then reverting again leaves the reply marked.
await chat.assistantMessage().getByTestId('chat-restore-turn').click()
expect(await cardCount(page)).toBe(1)
await expect(content).toHaveAttribute('data-reverted', 'false')
- await expect(content).toHaveCSS('opacity', '1')
await chat.assistantMessage().getByTestId('chat-revert-turn').click()
expect(await cardCount(page)).toBe(0)
diff --git a/tests/e2e/clipboard/browser-rich-copy.spec.ts b/tests/e2e/clipboard/browser-rich-copy.spec.ts
index 0a0838908..ae6874097 100644
--- a/tests/e2e/clipboard/browser-rich-copy.spec.ts
+++ b/tests/e2e/clipboard/browser-rich-copy.spec.ts
@@ -1,4 +1,5 @@
import { expect, test, useEditorSetup } from '#tests/e2e/fixtures'
+import { openAppMenu } from '#tests/helpers/menu'
const editor = useEditorSetup('/?test')
@@ -11,21 +12,29 @@ test('browser menu copy writes rich and plain OpenPencil clipboard formats', asy
await editor.canvas.drawRect(100, 100, 120, 80)
await editor.canvas.waitForRender()
- await editor.page.getByTestId('menubar-edit').click()
- await editor.page.getByRole('menuitem', { name: /^Copy/ }).click()
+ const copyMenu = await openAppMenu(editor.page, 'Edit')
+ await copyMenu.getByRole('menuitem', { name: /^Copy/ }).click()
- const clipboard = await editor.page.evaluate(async () => {
- const items = await navigator.clipboard.read()
- const item = items[0]
- if (!item) return { types: [], html: '', plainText: '' }
- const html = item.types.includes('text/html')
- ? await (await item.getType('text/html')).text()
- : ''
- const plainText = item.types.includes('text/plain')
- ? await (await item.getType('text/plain')).text()
- : ''
- return { types: item.types, html, plainText }
- })
+ // Copy writes once the document is encoded; until then the clipboard is empty, and a read that
+ // overlaps the write fails because the data changed under it.
+ const readClipboard = () =>
+ editor.page.evaluate(async () => {
+ try {
+ const [item] = await navigator.clipboard.read()
+ if (!item) return { types: [], html: '', plainText: '' }
+ const html = item.types.includes('text/html')
+ ? await (await item.getType('text/html')).text()
+ : ''
+ const plainText = item.types.includes('text/plain')
+ ? await (await item.getType('text/plain')).text()
+ : ''
+ return { types: item.types, html, plainText }
+ } catch {
+ return { types: [], html: '', plainText: '' }
+ }
+ })
+ await expect.poll(async () => (await readClipboard()).types).toContain('text/html')
+ const clipboard = await readClipboard()
expect(clipboard.types).toContain('text/html')
expect(clipboard.types).toContain('text/plain')
@@ -37,8 +46,8 @@ test('browser menu copy writes rich and plain OpenPencil clipboard formats', asy
if (!store) throw new Error('OpenPencil store not initialized')
return store.graph.getChildren(store.state.currentPageId).length
})
- await editor.page.getByTestId('menubar-edit').click()
- await editor.page.getByRole('menuitem', { name: /^Paste\s+(?:⌘|Ctrl)/ }).click()
+ const pasteMenu = await openAppMenu(editor.page, 'Edit')
+ await pasteMenu.getByRole('menuitem', { name: /^Paste\s+(?:⌘|Ctrl)/ }).click()
await expect
.poll(() =>
editor.page.evaluate(() => {
diff --git a/tests/e2e/code/sandbox.spec.ts b/tests/e2e/code/sandbox.spec.ts
index d49aea512..01f485846 100644
--- a/tests/e2e/code/sandbox.spec.ts
+++ b/tests/e2e/code/sandbox.spec.ts
@@ -108,6 +108,14 @@ test('supports multiple roots through fragments', async ({ page }) => {
})
})
+test('evaluates behaviour parts named through their namespace', async ({ page }) => {
+ const result = await evaluate(page, '<Switch.Root name="Toggle"><Switch.Thumb /></Switch.Root>')
+ expect(result).toMatchObject({
+ ok: true,
+ roots: [{ type: 'Switch.Root', children: [{ type: 'Switch.Thumb' }] }]
+ })
+})
+
test('cannot access the parent or application origin', async ({ page }) => {
const result = await evaluate(page, '<Frame>{String(window.parent.document)}</Frame>')
expect(result.ok).toBe(false)
diff --git a/tests/e2e/design/panel.spec.ts-snapshots/design-panel-paint-effects-export-openpencil-darwin.png b/tests/e2e/design/panel.spec.ts-snapshots/design-panel-paint-effects-export-openpencil-darwin.png
index eec76c3c1..7a80bb0df 100644
Binary files a/tests/e2e/design/panel.spec.ts-snapshots/design-panel-paint-effects-export-openpencil-darwin.png and b/tests/e2e/design/panel.spec.ts-snapshots/design-panel-paint-effects-export-openpencil-darwin.png differ
diff --git a/tests/e2e/design/panel.spec.ts-snapshots/design-panel-position-appearance-openpencil-darwin.png b/tests/e2e/design/panel.spec.ts-snapshots/design-panel-position-appearance-openpencil-darwin.png
index d1119455e..1dc03ef60 100644
Binary files a/tests/e2e/design/panel.spec.ts-snapshots/design-panel-position-appearance-openpencil-darwin.png and b/tests/e2e/design/panel.spec.ts-snapshots/design-panel-position-appearance-openpencil-darwin.png differ
diff --git a/tests/e2e/editor/auto-layout/composition.spec.ts-snapshots/auto-layout-wrap-dark-openpencil-darwin.png b/tests/e2e/editor/auto-layout/composition.spec.ts-snapshots/auto-layout-wrap-dark-openpencil-darwin.png
index ee8c03db6..3631e8e4a 100644
Binary files a/tests/e2e/editor/auto-layout/composition.spec.ts-snapshots/auto-layout-wrap-dark-openpencil-darwin.png and b/tests/e2e/editor/auto-layout/composition.spec.ts-snapshots/auto-layout-wrap-dark-openpencil-darwin.png differ
diff --git a/tests/e2e/editor/auto-layout/composition.spec.ts-snapshots/auto-layout-wrap-light-openpencil-darwin.png b/tests/e2e/editor/auto-layout/composition.spec.ts-snapshots/auto-layout-wrap-light-openpencil-darwin.png
index aead1f522..e40541d1c 100644
Binary files a/tests/e2e/editor/auto-layout/composition.spec.ts-snapshots/auto-layout-wrap-light-openpencil-darwin.png and b/tests/e2e/editor/auto-layout/composition.spec.ts-snapshots/auto-layout-wrap-light-openpencil-darwin.png differ
diff --git a/tests/e2e/layers/scroll.spec.ts b/tests/e2e/layers/scroll.spec.ts
index 8192750fc..f4eeb28dc 100644
--- a/tests/e2e/layers/scroll.spec.ts
+++ b/tests/e2e/layers/scroll.spec.ts
@@ -8,10 +8,10 @@ test('pages and layers panels scroll inside splitter panes', async ({ page }) =>
await canvas.waitForInit()
canvas.errors.length = 0
- await page.evaluate(() => {
+ // Adding a page opens it, so the layers go on the first page and the editor returns there.
+ const firstPageId = await page.evaluate(() => {
const store = window.openPencil?.getStore?.()
if (!store) throw new Error('OpenPencil store not initialized')
- for (let i = 0; i < 40; i++) store.addPage(`Page ${i + 2}`)
const pageId = store.state.currentPageId
for (let i = 0; i < 80; i++) {
store.graph.createNode('RECTANGLE', pageId, {
@@ -22,8 +22,13 @@ test('pages and layers panels scroll inside splitter panes', async ({ page }) =>
height: 20
})
}
- store.requestRender()
+ for (let i = 0; i < 40; i++) store.addPage(`Page ${i + 2}`)
+ store.switchPage(pageId)
+ return pageId
})
+ await expect
+ .poll(() => page.evaluate(() => window.openPencil?.getStore?.()?.state.currentPageId))
+ .toBe(firstPageId)
await canvas.waitForRender()
const pagesScroller = page.getByTestId('pages-scroll')
diff --git a/tests/e2e/panels/visual.spec.ts-snapshots/empty-canvas-openpencil-darwin.png b/tests/e2e/panels/visual.spec.ts-snapshots/empty-canvas-openpencil-darwin.png
index 81f10854f..49190fa29 100644
Binary files a/tests/e2e/panels/visual.spec.ts-snapshots/empty-canvas-openpencil-darwin.png and b/tests/e2e/panels/visual.spec.ts-snapshots/empty-canvas-openpencil-darwin.png differ
diff --git a/tests/e2e/panels/visual.spec.ts-snapshots/instance-openpencil-darwin.png b/tests/e2e/panels/visual.spec.ts-snapshots/instance-openpencil-darwin.png
index 71453eb70..9434fdc83 100644
Binary files a/tests/e2e/panels/visual.spec.ts-snapshots/instance-openpencil-darwin.png and b/tests/e2e/panels/visual.spec.ts-snapshots/instance-openpencil-darwin.png differ
diff --git a/tests/e2e/panels/visual.spec.ts-snapshots/mixed-selection-openpencil-darwin.png b/tests/e2e/panels/visual.spec.ts-snapshots/mixed-selection-openpencil-darwin.png
index 127e6f1da..6f46d6c78 100644
Binary files a/tests/e2e/panels/visual.spec.ts-snapshots/mixed-selection-openpencil-darwin.png and b/tests/e2e/panels/visual.spec.ts-snapshots/mixed-selection-openpencil-darwin.png differ
diff --git a/tests/e2e/panels/visual.spec.ts-snapshots/nested-groups-layer-tree-openpencil-darwin.png b/tests/e2e/panels/visual.spec.ts-snapshots/nested-groups-layer-tree-openpencil-darwin.png
index b91c4aef4..f3a3ebcd3 100644
Binary files a/tests/e2e/panels/visual.spec.ts-snapshots/nested-groups-layer-tree-openpencil-darwin.png and b/tests/e2e/panels/visual.spec.ts-snapshots/nested-groups-layer-tree-openpencil-darwin.png differ
diff --git a/tests/e2e/panels/visual.spec.ts-snapshots/single-rectangle-openpencil-darwin.png b/tests/e2e/panels/visual.spec.ts-snapshots/single-rectangle-openpencil-darwin.png
index c4cf342a9..11f87f441 100644
Binary files a/tests/e2e/panels/visual.spec.ts-snapshots/single-rectangle-openpencil-darwin.png and b/tests/e2e/panels/visual.spec.ts-snapshots/single-rectangle-openpencil-darwin.png differ
diff --git a/tests/e2e/panels/visual.spec.ts-snapshots/text-selection-openpencil-darwin.png b/tests/e2e/panels/visual.spec.ts-snapshots/text-selection-openpencil-darwin.png
index 49138575b..65df496b6 100644
Binary files a/tests/e2e/panels/visual.spec.ts-snapshots/text-selection-openpencil-darwin.png and b/tests/e2e/panels/visual.spec.ts-snapshots/text-selection-openpencil-darwin.png differ
diff --git a/tests/e2e/properties/blend-modes.spec.ts-snapshots/effect-blend-mode-openpencil-darwin.png b/tests/e2e/properties/blend-modes.spec.ts-snapshots/effect-blend-mode-openpencil-darwin.png
index a77adbc95..0818a98c1 100644
Binary files a/tests/e2e/properties/blend-modes.spec.ts-snapshots/effect-blend-mode-openpencil-darwin.png and b/tests/e2e/properties/blend-modes.spec.ts-snapshots/effect-blend-mode-openpencil-darwin.png differ
diff --git a/tests/e2e/properties/dimensions.spec.ts-snapshots/dimensions-bound-light-openpencil-darwin.png b/tests/e2e/properties/dimensions.spec.ts-snapshots/dimensions-bound-light-openpencil-darwin.png
index 82e4bd1a6..d80cc873d 100644
Binary files a/tests/e2e/properties/dimensions.spec.ts-snapshots/dimensions-bound-light-openpencil-darwin.png and b/tests/e2e/properties/dimensions.spec.ts-snapshots/dimensions-bound-light-openpencil-darwin.png differ
diff --git a/tests/e2e/properties/panel-hierarchy.spec.ts-snapshots/layout-frame-openpencil-darwin.png b/tests/e2e/properties/panel-hierarchy.spec.ts-snapshots/layout-frame-openpencil-darwin.png
index 5a68ff83c..08a7df129 100644
Binary files a/tests/e2e/properties/panel-hierarchy.spec.ts-snapshots/layout-frame-openpencil-darwin.png and b/tests/e2e/properties/panel-hierarchy.spec.ts-snapshots/layout-frame-openpencil-darwin.png differ
diff --git a/tests/e2e/properties/panel-hierarchy.spec.ts-snapshots/layout-text-openpencil-darwin.png b/tests/e2e/properties/panel-hierarchy.spec.ts-snapshots/layout-text-openpencil-darwin.png
index 07ad99503..69a80d44d 100644
Binary files a/tests/e2e/properties/panel-hierarchy.spec.ts-snapshots/layout-text-openpencil-darwin.png and b/tests/e2e/properties/panel-hierarchy.spec.ts-snapshots/layout-text-openpencil-darwin.png differ
diff --git a/tests/e2e/properties/panel.spec.ts b/tests/e2e/properties/panel.spec.ts
index 8b71d86b0..665fa3039 100644
--- a/tests/e2e/properties/panel.spec.ts
+++ b/tests/e2e/properties/panel.spec.ts
@@ -435,7 +435,9 @@ test('bound NumberField detach edit is one undo step', async () => {
expect(await readState()).toEqual({ radius: 0, binding: 'Radius/default' })
await field.getByLabel('Apply variable').click()
- const variableSearch = editor.page.getByRole('combobox', { name: 'Search…', exact: true })
+ const variableSearch = editor.page
+ .getByRole('dialog', { name: 'Apply variable' })
+ .getByRole('textbox', { name: 'Search…', exact: true })
await expect(variableSearch).toBeVisible()
await variableSearch.press('Escape')
expect(await readState()).toEqual({ radius: 0, binding: 'Radius/default' })
diff --git a/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-dashed-dark-openpencil-darwin.png b/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-dashed-dark-openpencil-darwin.png
index 000805e65..5eeef7780 100644
Binary files a/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-dashed-dark-openpencil-darwin.png and b/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-dashed-dark-openpencil-darwin.png differ
diff --git a/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-dashed-light-openpencil-darwin.png b/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-dashed-light-openpencil-darwin.png
index c09a8321a..57fc76e89 100644
Binary files a/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-dashed-light-openpencil-darwin.png and b/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-dashed-light-openpencil-darwin.png differ
diff --git a/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-line-dark-openpencil-darwin.png b/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-line-dark-openpencil-darwin.png
index 0e46ffabf..5b283afff 100644
Binary files a/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-line-dark-openpencil-darwin.png and b/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-line-dark-openpencil-darwin.png differ
diff --git a/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-line-light-openpencil-darwin.png b/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-line-light-openpencil-darwin.png
index f322b5cb2..ba2df597b 100644
Binary files a/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-line-light-openpencil-darwin.png and b/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-line-light-openpencil-darwin.png differ
diff --git a/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-main-light-openpencil-darwin.png b/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-main-light-openpencil-darwin.png
index 3b2c2c771..5fdcf42df 100644
Binary files a/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-main-light-openpencil-darwin.png and b/tests/e2e/properties/stroke-settings.spec.ts-snapshots/stroke-main-light-openpencil-darwin.png differ
diff --git a/tests/e2e/properties/typography-panel.spec.ts-snapshots/typography-groups-dark-openpencil-darwin.png b/tests/e2e/properties/typography-panel.spec.ts-snapshots/typography-groups-dark-openpencil-darwin.png
index 943fa8510..a9e639756 100644
Binary files a/tests/e2e/properties/typography-panel.spec.ts-snapshots/typography-groups-dark-openpencil-darwin.png and b/tests/e2e/properties/typography-panel.spec.ts-snapshots/typography-groups-dark-openpencil-darwin.png differ
diff --git a/tests/e2e/properties/typography-panel.spec.ts-snapshots/typography-groups-light-openpencil-darwin.png b/tests/e2e/properties/typography-panel.spec.ts-snapshots/typography-groups-light-openpencil-darwin.png
index 34a8c6657..064536d4a 100644
Binary files a/tests/e2e/properties/typography-panel.spec.ts-snapshots/typography-groups-light-openpencil-darwin.png and b/tests/e2e/properties/typography-panel.spec.ts-snapshots/typography-groups-light-openpencil-darwin.png differ
diff --git a/tests/e2e/text/formatting.spec.ts-snapshots/typography-panel-openpencil-darwin.png b/tests/e2e/text/formatting.spec.ts-snapshots/typography-panel-openpencil-darwin.png
index 1bfb081ee..a21542f01 100644
Binary files a/tests/e2e/text/formatting.spec.ts-snapshots/typography-panel-openpencil-darwin.png and b/tests/e2e/text/formatting.spec.ts-snapshots/typography-panel-openpencil-darwin.png differ
diff --git a/tests/e2e/vectorize/basic.spec.ts b/tests/e2e/vectorize/basic.spec.ts
index ecdbea1ea..c44d07188 100644
--- a/tests/e2e/vectorize/basic.spec.ts
+++ b/tests/e2e/vectorize/basic.spec.ts
@@ -103,10 +103,15 @@ test('missing key opens Media settings and saves through the credential manager'
await rightClickSelected()
await editor.page.getByTestId('context-vectorize').click()
- const section = editor.page.locator('[data-vectorize-settings]')
- await expect(section).toBeVisible()
+ const dialog = editor.page.getByTestId('app-settings-dialog')
+ const vectorizeRow = dialog.locator('[data-vectorize-settings]')
+ await expect(vectorizeRow).toBeVisible()
- await section.getByTestId('provider-settings-api-key').fill('test-recraft-key')
+ // The provider row opens its key editor; saving returns to the Media list.
+ await vectorizeRow.click()
+ await dialog.getByTestId('provider-settings-api-key').fill('test-recraft-key')
+ await dialog.getByRole('button', { name: 'Save', exact: true }).click()
+ await expect(vectorizeRow).toBeVisible()
await editor.page.getByTestId('app-settings-done').click()
await expect(editor.page.getByTestId('app-settings-dialog')).toHaveCount(0)
expect(
diff --git a/tests/e2e/viewport/zoom-pan.spec.ts b/tests/e2e/viewport/zoom-pan.spec.ts
index c60ee8318..a2afbf262 100644
--- a/tests/e2e/viewport/zoom-pan.spec.ts
+++ b/tests/e2e/viewport/zoom-pan.spec.ts
@@ -11,7 +11,7 @@ test.describe('Zoom and pan', () => {
test.beforeAll(async ({ browser }) => {
const page = await browser.newPage()
helper = new CanvasHelper(page)
- await page.goto('http://localhost:1420/?test&no-chrome&no-rulers')
+ await page.goto('/?test&no-chrome&no-rulers')
await helper.waitForInit()
await page.evaluate((count: number) => {
diff --git a/tests/helpers/menu.ts b/tests/helpers/menu.ts
new file mode 100644
index 000000000..8da6ff186
--- /dev/null
+++ b/tests/helpers/menu.ts
@@ -0,0 +1,14 @@
+import { expect, type Page } from '@playwright/test'
+
+/**
+ * Opens a top-level menu of the app's menubar and returns it. A menu closed while its opening
+ * animation still runs stays in the page until the animation ends and dismisses the next menu
+ * opened in that time, so this waits for every menu to go before clicking the trigger.
+ */
+export async function openAppMenu(page: Page, name: string) {
+ await expect(page.getByRole('menu')).toHaveCount(0)
+ await page.getByRole('menubar').getByRole('menuitem', { name, exact: true }).click()
+ const menu = page.getByRole('menu', { name })
+ await expect(menu).toBeVisible()
+ return menu
+}
diff --git a/tests/helpers/tauri/clipboard-mock.ts b/tests/helpers/tauri/clipboard-mock.ts
index abc455767..fc4cb3eff 100644
--- a/tests/helpers/tauri/clipboard-mock.ts
+++ b/tests/helpers/tauri/clipboard-mock.ts
@@ -18,6 +18,23 @@ export type TauriClipboardMock = {
const IPC_BINDING = '__playwrightTauriIPC'
+/**
+ * What the desktop app's own commands return on a machine with no system fonts, no pending files
+ * or rooms, and no stored credentials. Any other command fails the spec, so a new one is noticed.
+ */
+const APP_COMMAND_RESULTS: Record<string, unknown> = {
+ list_system_fonts: [],
+ take_pending_open: [],
+ take_pending_rooms: [],
+ credential_status: 'missing',
+ load_system_font: null,
+ set_native_menu_checked: null,
+ 'plugin:event|listen': null,
+ 'plugin:event|unlisten': null,
+ 'plugin:process|exit': null,
+ 'plugin:process|restart': null
+}
+
export async function installTauriClipboardMock(page: Page): Promise<TauriClipboardMock> {
const state: TauriClipboardSnapshot = {
text: '',
@@ -42,17 +59,8 @@ export async function installTauriClipboardMock(page: Page): Promise<TauriClipbo
}
case 'plugin:clipboard-manager|read_text':
return state.html || state.text
- case 'list_system_fonts':
- case 'take_pending_open':
- case 'take_pending_rooms':
- return []
- case 'load_system_font':
- case 'plugin:event|listen':
- case 'plugin:event|unlisten':
- case 'plugin:process|exit':
- case 'plugin:process|restart':
- return null
default:
+ if (Object.hasOwn(APP_COMMAND_RESULTS, cmd)) return APP_COMMAND_RESULTS[cmd]
throw new Error(`Unexpected Tauri command: ${cmd}`)
}
})