feat: add data-testid to dialog components for stable test selectors

- Add data-testid='settings-dialog' to settings container

- Add data-testid='about-panel' to AboutPanel

- Add data-testid='settings-tab-{key}' to all sidebar navigation items

Amp-Thread-ID: https://ampcode.com/threads/T-019c1359-48cc-7676-abc8-2de8c57b52cf
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Alexander Brown
2026-01-31 01:22:12 -08:00
parent bbe9267f4a
commit 31c643d29e
5 changed files with 30 additions and 7 deletions

View File

@@ -9,6 +9,7 @@
'tree-leaf': props.node.leaf
}
]"
:data-testid="`tree-node-${node.key}`"
>
<div class="node-content">
<span class="node-label">

View File

@@ -1,5 +1,9 @@
<template>
<PanelTemplate value="About" class="about-container">
<PanelTemplate
value="About"
class="about-container"
data-testid="about-panel"
>
<h2 class="mb-2 text-2xl font-bold">
{{ $t('g.about') }}
</h2>

View File

@@ -1,5 +1,10 @@
<template>
<div ref="container" class="node-lib-node-container">
<div
ref="container"
class="node-lib-node-container"
data-testid="node-tree-folder"
:data-folder-name="node.label"
>
<TreeExplorerTreeNode :node="node" @item-dropped="handleItemDrop" />
</div>
</template>

View File

@@ -1,5 +1,10 @@
<template>
<div ref="container" class="node-lib-node-container">
<div
ref="container"
class="node-lib-node-container"
data-testid="node-tree-leaf"
:data-node-name="nodeDef.display_name"
>
<TreeExplorerTreeNode :node="node" @contextmenu="handleContextMenu">
<template #before-label>
<Tag

View File

@@ -1,5 +1,6 @@
<template>
<div
data-testid="settings-dialog"
:class="
teamWorkspacesEnabled
? 'flex h-full w-full overflow-auto flex-col md:flex-row'
@@ -50,10 +51,17 @@
<template v-else #optiongroup>
<Divider class="my-0" />
</template>
<!-- Workspace mode: custom workspace item -->
<template v-if="teamWorkspacesEnabled" #option="{ option }">
<WorkspaceSidebarItem v-if="option.key === 'workspace'" />
<span v-else>{{ option.translatedLabel }}</span>
<!-- Custom option template with data-testid for stable test selectors -->
<template #option="{ option }">
<span
:data-testid="`settings-tab-${option.key}`"
class="settings-tab-option"
>
<WorkspaceSidebarItem
v-if="teamWorkspacesEnabled && option.key === 'workspace'"
/>
<template v-else>{{ option.translatedLabel }}</template>
</span>
</template>
</Listbox>
</ScrollPanel>