@@ -42,6 +42,90 @@ test.describe('Config Settings', () => {
4242 await expect ( configSettingsPage . saveBtn ) . toBeVisible ( )
4343 await expect ( configSettingsPage . page . getByRole ( 'heading' , { name : / P r i c i n g / i } ) ) . toBeVisible ( )
4444 } )
45+
46+ test ( 'should navigate to MCP settings' , async ( { configSettingsPage } ) => {
47+ await configSettingsPage . goto ( 'mcp-gateway' )
48+ await expect ( configSettingsPage . page . getByTestId ( 'mcp-settings-view' ) ) . toBeVisible ( )
49+ await expect ( configSettingsPage . page . getByLabel ( 'Max Agent Depth' ) ) . toBeVisible ( )
50+ await expect ( configSettingsPage . page . getByLabel ( 'Tool Execution Timeout (seconds)' ) ) . toBeVisible ( )
51+ } )
52+ } )
53+
54+ test . describe ( 'MCP Settings' , ( ) => {
55+ test ( 'should display MCP settings form' , async ( { configSettingsPage } ) => {
56+ await configSettingsPage . goto ( 'mcp-gateway' )
57+
58+ await expect ( configSettingsPage . page . getByTestId ( 'mcp-settings-view' ) ) . toBeVisible ( )
59+ await expect ( configSettingsPage . page . locator ( '#mcp-agent-depth' ) ) . toBeVisible ( )
60+ await expect ( configSettingsPage . page . locator ( '#mcp-tool-execution-timeout' ) ) . toBeVisible ( )
61+ await expect ( configSettingsPage . page . locator ( '#mcp-binding-level' ) ) . toBeVisible ( )
62+ } )
63+
64+ test ( 'should have save button disabled when no changes' , async ( { configSettingsPage } ) => {
65+ await configSettingsPage . goto ( 'mcp-gateway' )
66+
67+ const saveBtn = configSettingsPage . page . getByTestId ( 'mcp-settings-save-btn' )
68+ await expect ( saveBtn ) . toBeVisible ( )
69+ await expect ( saveBtn ) . toBeDisabled ( )
70+ } )
71+ } )
72+
73+ test . describe ( 'Pricing Config' , ( ) => {
74+ let originalPricingUrl : string
75+
76+ test . beforeEach ( async ( { configSettingsPage } ) => {
77+ await configSettingsPage . goto ( 'pricing-config' )
78+ originalPricingUrl = await configSettingsPage . pricingDatasheetUrlInput . inputValue ( )
79+ } )
80+
81+ test . afterEach ( async ( { configSettingsPage } ) => {
82+ await configSettingsPage . goto ( 'pricing-config' )
83+ await configSettingsPage . setPricingDatasheetUrl ( originalPricingUrl )
84+ const isSaveEnabled = await configSettingsPage . pricingSaveBtn . isDisabled ( ) . then ( ( d ) => ! d )
85+ if ( isSaveEnabled ) {
86+ await configSettingsPage . savePricingConfig ( )
87+ await configSettingsPage . dismissToasts ( )
88+ }
89+ } )
90+
91+ test ( 'should display pricing config view' , async ( { configSettingsPage } ) => {
92+ await expect ( configSettingsPage . pricingConfigView ) . toBeVisible ( )
93+ await expect ( configSettingsPage . pricingDatasheetUrlInput ) . toBeVisible ( )
94+ await expect ( configSettingsPage . pricingForceSyncBtn ) . toBeVisible ( )
95+ await expect ( configSettingsPage . pricingSaveBtn ) . toBeVisible ( )
96+ } )
97+
98+ test ( 'should set and save datasheet URL' , async ( { configSettingsPage } ) => {
99+ const testUrl = 'https://example.com/pricing.json'
100+ await configSettingsPage . setPricingDatasheetUrl ( testUrl )
101+
102+ const isSaveEnabled = await configSettingsPage . pricingSaveBtn . isDisabled ( ) . then ( ( d ) => ! d )
103+ if ( ! isSaveEnabled ) {
104+ test . skip ( true , 'Save button disabled (no changes detected or RBAC)' )
105+ return
106+ }
107+
108+ await configSettingsPage . savePricingConfig ( )
109+ await configSettingsPage . dismissToasts ( )
110+ } )
111+
112+ test ( 'should trigger force sync' , async ( { configSettingsPage } ) => {
113+ const isForceSyncEnabled = await configSettingsPage . pricingForceSyncBtn . isDisabled ( ) . then ( ( d ) => ! d )
114+ if ( ! isForceSyncEnabled ) {
115+ test . skip ( true , 'Force sync button disabled (RBAC or no datasheet URL)' )
116+ return
117+ }
118+
119+ await configSettingsPage . triggerForceSync ( )
120+ await configSettingsPage . dismissToasts ( )
121+ } )
122+
123+ test ( 'should validate URL format' , async ( { configSettingsPage } ) => {
124+ await configSettingsPage . pricingDatasheetUrlInput . fill ( 'invalid-url-no-http' )
125+ await configSettingsPage . pricingSaveBtn . click ( )
126+
127+ await expect ( configSettingsPage . page . getByText ( / U R L m u s t s t a r t w i t h h t t p | v a l i d U R L / i) ) . toBeVisible ( )
128+ } )
45129 } )
46130
47131 test . describe ( 'Client Settings' , ( ) => {
@@ -67,6 +151,15 @@ test.describe('Config Settings', () => {
67151 await expect ( configSettingsPage . disableDBPingsSwitch ) . toBeVisible ( )
68152 } )
69153
154+ test ( 'should display async job result TTL input when available' , async ( { configSettingsPage } ) => {
155+ const isVisible = await configSettingsPage . asyncJobResultTtlInput . isVisible ( ) . catch ( ( ) => false )
156+ if ( isVisible ) {
157+ await expect ( configSettingsPage . asyncJobResultTtlInput ) . toBeVisible ( )
158+ } else {
159+ test . skip ( true , 'Async job result TTL not available' )
160+ }
161+ } )
162+
70163 test ( 'should toggle drop excess requests' , async ( { configSettingsPage } ) => {
71164 const initialState = await configSettingsPage . getSwitchState ( configSettingsPage . dropExcessRequestsSwitch )
72165
@@ -164,6 +257,15 @@ test.describe('Config Settings', () => {
164257 await expect ( configSettingsPage . page . getByText ( / L o g R e t e n t i o n / i) ) . toBeVisible ( )
165258 } )
166259
260+ test ( 'should display workspace logging headers textarea when available' , async ( { configSettingsPage } ) => {
261+ const isVisible = await configSettingsPage . workspaceLoggingHeadersTextarea . isVisible ( ) . catch ( ( ) => false )
262+ if ( isVisible ) {
263+ await expect ( configSettingsPage . workspaceLoggingHeadersTextarea ) . toBeVisible ( )
264+ } else {
265+ test . skip ( true , 'Workspace logging headers not available (depends on log connector)' )
266+ }
267+ } )
268+
167269 test ( 'should toggle content logging when available' , async ( { configSettingsPage } ) => {
168270 // Check if the switch is available (depends on logs being connected)
169271 const disableContentLoggingVisible = await configSettingsPage . disableContentLoggingSwitch . isVisible ( ) . catch ( ( ) => false )
@@ -272,9 +374,42 @@ test.describe('Config Settings', () => {
272374 await expect ( configSettingsPage . saveBtn ) . toBeVisible ( )
273375 } )
274376
377+ test ( 'should display enforce auth on inference switch' , async ( { configSettingsPage } ) => {
378+ const isVisible = await configSettingsPage . enforceAuthOnInferenceSwitch . isVisible ( ) . catch ( ( ) => false )
379+ if ( ! isVisible ) {
380+ test . skip ( true , 'Enforce auth on inference not available' )
381+ return
382+ }
383+ await expect ( configSettingsPage . enforceAuthOnInferenceSwitch ) . toBeVisible ( )
384+ } )
385+
386+ test ( 'should toggle enforce auth on inference' , async ( { configSettingsPage } ) => {
387+ const isVisible = await configSettingsPage . enforceAuthOnInferenceSwitch . isVisible ( ) . catch ( ( ) => false )
388+ if ( ! isVisible ) {
389+ test . skip ( true , 'Enforce auth on inference not available' )
390+ return
391+ }
392+ const initialState = await configSettingsPage . getSwitchState ( configSettingsPage . enforceAuthOnInferenceSwitch )
393+ await configSettingsPage . toggleEnforceAuthOnInference ( )
394+ const newState = await configSettingsPage . getSwitchState ( configSettingsPage . enforceAuthOnInferenceSwitch )
395+ expect ( newState ) . toBe ( ! initialState )
396+ await configSettingsPage . toggleEnforceAuthOnInference ( )
397+ if ( await configSettingsPage . hasPendingChanges ( ) ) {
398+ await configSettingsPage . saveSettings ( )
399+ }
400+ } )
401+
402+ test ( 'should display required headers textarea' , async ( { configSettingsPage } ) => {
403+ const isVisible = await configSettingsPage . requiredHeadersTextarea . isVisible ( ) . catch ( ( ) => false )
404+ if ( ! isVisible ) {
405+ test . skip ( true , 'Required headers control not available' )
406+ return
407+ }
408+ await expect ( configSettingsPage . requiredHeadersTextarea ) . toBeVisible ( )
409+ } )
410+
275411 test ( 'should display rate limiting section' , async ( { configSettingsPage } ) => {
276412 const isVisible = await configSettingsPage . isRateLimitingSectionVisible ( )
277- // Rate limiting section should exist
278413 expect ( isVisible ) . toBeDefined ( )
279414 } )
280415 } )
0 commit comments