@@ -30,9 +30,9 @@ test.describe("[command-palette] presets and actions", () => {
3030 await expect ( presetsSection . locator ( ".range-preset" ) ) . toHaveCount ( 5 ) ;
3131 } ) ;
3232
33- test ( "renders the theme toggle action button " , async ( { page } ) => {
33+ test ( "renders all four action buttons " , async ( { page } ) => {
3434 const actionsSection = page . locator ( ".section" ) . filter ( { hasText : i18n . section_actions } ) ;
35- await expect ( actionsSection . locator ( ".range-preset" ) ) . toHaveCount ( 1 ) ;
35+ await expect ( actionsSection . locator ( ".range-preset" ) ) . toHaveCount ( 4 ) ;
3636 } ) ;
3737
3838 test ( "clicking a preset adds a chip and hides the presets section" , async ( { page } ) => {
@@ -66,7 +66,8 @@ test.describe("[command-palette] presets and actions", () => {
6666 const expectedTheme = initialTheme === "dark" ? "light" : "dark" ;
6767
6868 const actionsSection = page . locator ( ".section" ) . filter ( { hasText : i18n . section_actions } ) ;
69- await actionsSection . locator ( ".range-preset" ) . click ( ) ;
69+ const toggleLabel = i18n [ `action_toggle_theme_to_${ expectedTheme } ` ] ;
70+ await actionsSection . locator ( ".range-preset" ) . filter ( { hasText : toggleLabel } ) . click ( ) ;
7071
7172 await expect ( page . locator ( ".backdrop" ) ) . not . toBeVisible ( ) ;
7273 const newTheme = await page . evaluate ( ( ) => window . settings . config . theme ) ;
@@ -89,6 +90,66 @@ test.describe("[command-palette] presets and actions", () => {
8990
9091 await expect ( page . locator ( ".backdrop" ) ) . not . toBeVisible ( ) ;
9192 } ) ;
93+
94+ test ( "actions section remains visible after a filter chip is applied" , async ( { page } ) => {
95+ await page . locator ( ".range-preset" ) . filter ( { hasText : i18n . preset_deprecated } ) . click ( ) ;
96+
97+ await expect ( page . locator ( ".section" ) . filter ( { hasText : i18n . section_actions } ) ) . toBeVisible ( ) ;
98+ } ) ;
99+
100+ test ( "clicking reset view closes the palette" , async ( { page } ) => {
101+ const actionsSection = page . locator ( ".section" ) . filter ( { hasText : i18n . section_actions } ) ;
102+ await actionsSection . locator ( ".range-preset" ) . filter ( { hasText : i18n . action_reset_view } ) . click ( ) ;
103+
104+ await expect ( page . locator ( ".backdrop" ) ) . not . toBeVisible ( ) ;
105+ } ) ;
106+
107+ test ( "Alt+R triggers reset view and closes the palette" , async ( { page } ) => {
108+ await page . keyboard . press ( "Alt+r" ) ;
109+
110+ await expect ( page . locator ( ".backdrop" ) ) . not . toBeVisible ( ) ;
111+ } ) ;
112+
113+ test ( "clicking copy packages closes the palette and writes specs to clipboard" , async ( { page } ) => {
114+ await page . context ( ) . grantPermissions ( [ "clipboard-read" , "clipboard-write" ] ) ;
115+
116+ const actionsSection = page . locator ( ".section" ) . filter ( { hasText : i18n . section_actions } ) ;
117+ await actionsSection . locator ( ".range-preset" ) . filter ( { hasText : i18n . action_copy_packages } ) . click ( ) ;
118+
119+ await expect ( page . locator ( ".backdrop" ) ) . not . toBeVisible ( ) ;
120+
121+ const clipboardText = await page . evaluate ( ( ) => navigator . clipboard . readText ( ) ) ;
122+ expect ( clipboardText . length ) . toBeGreaterThan ( 0 ) ;
123+ expect ( clipboardText ) . toContain ( "@" ) ;
124+ } ) ;
125+
126+ test ( "Alt+C triggers copy packages and closes the palette" , async ( { page } ) => {
127+ await page . context ( ) . grantPermissions ( [ "clipboard-read" , "clipboard-write" ] ) ;
128+ await page . keyboard . press ( "Alt+c" ) ;
129+
130+ await expect ( page . locator ( ".backdrop" ) ) . not . toBeVisible ( ) ;
131+ } ) ;
132+
133+ test ( "clicking export payload closes the palette and triggers a download" , async ( { page } ) => {
134+ const actionsSection = page . locator ( ".section" ) . filter ( { hasText : i18n . section_actions } ) ;
135+ const [ download ] = await Promise . all ( [
136+ page . waitForEvent ( "download" ) ,
137+ actionsSection . locator ( ".range-preset" ) . filter ( { hasText : i18n . action_export_payload } ) . click ( )
138+ ] ) ;
139+
140+ await expect ( page . locator ( ".backdrop" ) ) . not . toBeVisible ( ) ;
141+ expect ( download . suggestedFilename ( ) ) . toBe ( "nsecure-result.json" ) ;
142+ } ) ;
143+
144+ test ( "Alt+E triggers export payload and closes the palette" , async ( { page } ) => {
145+ const [ download ] = await Promise . all ( [
146+ page . waitForEvent ( "download" ) ,
147+ page . keyboard . press ( "Alt+e" )
148+ ] ) ;
149+
150+ await expect ( page . locator ( ".backdrop" ) ) . not . toBeVisible ( ) ;
151+ expect ( download . suggestedFilename ( ) ) . toBe ( "nsecure-result.json" ) ;
152+ } ) ;
92153} ) ;
93154
94155test . describe ( "[command-palette] ignore flags and warnings" , ( ) => {
0 commit comments