diff --git a/routes/ai-home/stage.tsx b/routes/ai-home/stage.tsx index 29caeb378..a9da8a0e0 100644 --- a/routes/ai-home/stage.tsx +++ b/routes/ai-home/stage.tsx @@ -970,7 +970,7 @@ function AISettingsPage() { <> { void handleChange( { diff --git a/tests/e2e/specs/admin/settings.spec.js b/tests/e2e/specs/admin/settings.spec.js index e755e6bcc..f8454a4f0 100644 --- a/tests/e2e/specs/admin/settings.spec.js +++ b/tests/e2e/specs/admin/settings.spec.js @@ -104,7 +104,9 @@ test.describe( 'Plugin settings', () => { await disableExperiments( admin, page ); // Ensure global AI setting is disabled. - await expect( page.getByLabel( 'Enable AI' ) ).not.toBeChecked(); + await expect( + page.getByLabel( 'AI features enabled' ) + ).not.toBeChecked(); // Ensure feature toggles are disabled when AI is disabled. await expect( @@ -119,7 +121,7 @@ test.describe( 'Plugin settings', () => { await enableExperiments( admin, page ); // Ensure global AI setting is enabled. - await expect( page.getByLabel( 'Enable AI' ) ).toBeChecked(); + await expect( page.getByLabel( 'AI features enabled' ) ).toBeChecked(); // Ensure we see the editor experiments section. await expect( @@ -132,6 +134,26 @@ test.describe( 'Plugin settings', () => { ).toBeVisible(); } ); + test( 'Global AI toggle reads as a master switch, not an aggregate (#600)', async ( { + admin, + page, + } ) => { + await enableExperiments( admin, page ); + + // The control is labeled as a state ("AI features enabled"), not the + // imperative "Enable AI" that implied an aggregate/all-on meaning. + const masterToggle = page.getByLabel( 'AI features enabled' ); + await expect( masterToggle ).toBeVisible(); + await expect( masterToggle ).toBeChecked(); + + // Turning a single feature off must not change the master toggle: it is + // a master switch, not a summary of individual feature states. This is + // the regression guard for the misleading solid-on toggle (#600). + await disableExperiment( admin, page, 'Title Generation' ); + await expect( masterToggle ).toBeChecked(); + await expect( page.getByLabel( 'Title Generation' ) ).not.toBeChecked(); + } ); + test( 'Inline settings retain pending edits when another toggle auto-saves', async ( { admin, page, diff --git a/tests/e2e/utils/helpers.ts b/tests/e2e/utils/helpers.ts index 54495632d..c7934bb05 100644 --- a/tests/e2e/utils/helpers.ts +++ b/tests/e2e/utils/helpers.ts @@ -164,7 +164,7 @@ export const disableExperiments = async ( admin: Admin, page: Page ) => { await visitSettingsPage( admin ); // Wait for page to fully load before finding the global toggle. - const globalToggle = page.getByLabel( 'Enable AI' ); + const globalToggle = page.getByLabel( 'AI features enabled' ); await expect( globalToggle ).toBeVisible( { timeout: 10000 } ); await expect( globalToggle ).toBeEnabled( { timeout: 10000 } ); @@ -190,7 +190,7 @@ export const enableExperiments = async ( admin: Admin, page: Page ) => { await visitSettingsPage( admin ); // Wait for page to fully load before finding the global toggle. - const globalToggle = page.getByLabel( 'Enable AI' ); + const globalToggle = page.getByLabel( 'AI features enabled' ); await expect( globalToggle ).toBeVisible( { timeout: 10000 } ); await expect( globalToggle ).toBeEnabled( { timeout: 10000 } );