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 'tree-leaf': props.node.leaf
} }
]" ]"
:data-testid="`tree-node-${node.key}`"
> >
<div class="node-content"> <div class="node-content">
<span class="node-label"> <span class="node-label">

View File

@@ -1,5 +1,9 @@
<template> <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"> <h2 class="mb-2 text-2xl font-bold">
{{ $t('g.about') }} {{ $t('g.about') }}
</h2> </h2>

View File

@@ -1,5 +1,10 @@
<template> <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" /> <TreeExplorerTreeNode :node="node" @item-dropped="handleItemDrop" />
</div> </div>
</template> </template>

View File

@@ -1,5 +1,10 @@
<template> <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"> <TreeExplorerTreeNode :node="node" @contextmenu="handleContextMenu">
<template #before-label> <template #before-label>
<Tag <Tag

View File

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