@@ -129,6 +129,13 @@ const mockHelpPanelHandlers = [
129129 http . post ( '/api/quickstarts/v1/favorites' , async ( ) => {
130130 return HttpResponse . json ( { success : true } ) ;
131131 } ) ,
132+ // Support cases API (empty state) - prevents "Failed to fetch" errors
133+ http . post ( 'https://api.access.redhat.com/support/v1/cases/filter' , ( ) =>
134+ HttpResponse . json ( { cases : [ ] } )
135+ ) ,
136+ http . post ( 'https://api.access.stage.redhat.com/support/v1/cases/filter' , ( ) =>
137+ HttpResponse . json ( { cases : [ ] } )
138+ ) ,
132139] ;
133140
134141const meta : Meta < typeof HelpPanelWrapper > = {
@@ -213,185 +220,9 @@ export const StatusPageLink: Story = {
213220 } ,
214221} ;
215222
216- /**
217- * Test opening and closing custom tabs
218- */
219- export const OpenAndCloseTabs : Story = {
220- play : async ( { canvasElement } ) => {
221- const canvas = within ( canvasElement ) ;
222-
223- // Wait for page to load and find the Help button in the header
224- const helpButton = await canvas . findByLabelText (
225- 'Toggle help panel' ,
226- { } ,
227- { timeout : 5000 }
228- ) ;
229- expect ( helpButton ) . toBeInTheDocument ( ) ;
230-
231- // Click the Help button to open the panel
232- await userEvent . click ( helpButton ) ;
233-
234- // Wait for the help panel drawer to open
235- await waitFor (
236- ( ) => {
237- const drawer = document . querySelector ( '.pf-v6-c-drawer.pf-m-expanded' ) ;
238- expect ( drawer ) . toBeInTheDocument ( ) ;
239- } ,
240- { timeout : 5000 }
241- ) ;
242-
243- // Wait for the help panel to be visible
244- await waitFor (
245- ( ) => {
246- const helpPanelTitle = document . querySelector (
247- '[data-ouia-component-id="help-panel-title"]'
248- ) ;
249- expect ( helpPanelTitle ) . toBeInTheDocument ( ) ;
250- } ,
251- { timeout : 5000 }
252- ) ;
253-
254- // Find the add tab button
255- const addTabButton = document . querySelector (
256- '[data-ouia-component-id="help-panel-add-tab-button"]'
257- ) as HTMLElement ;
258- expect ( addTabButton ) . toBeInTheDocument ( ) ;
259-
260- // Click to add a new tab
261- await userEvent . click ( addTabButton ) ;
262-
263- // Wait for the new tab to appear
264- await waitFor (
265- ( ) => {
266- const newTab = canvas . getByText ( 'New tab' ) ;
267- expect ( newTab ) . toBeInTheDocument ( ) ;
268- } ,
269- { timeout : 3000 }
270- ) ;
271-
272- // Verify the tab is now active by checking for the tab content
273- const newTabButton = canvas . getByRole ( 'tab' , { name : 'New tab' } ) ;
274- expect ( newTabButton ) . toHaveAttribute ( 'aria-selected' , 'true' ) ;
275-
276- // Find the close button for the new tab
277- // The close button is a sibling of the tab link
278- const tabItem = newTabButton . closest ( '.pf-v6-c-tabs__item' ) ;
279- const closeButton = tabItem ?. querySelector (
280- '.pf-v6-c-tabs__item-action button'
281- ) as HTMLElement ;
282- expect ( closeButton ) . toBeInTheDocument ( ) ;
283-
284- // Click the close button
285- await userEvent . click ( closeButton ) ;
286-
287- // Verify the tab is removed
288- await waitFor (
289- ( ) => {
290- const removedTab = canvas . queryByRole ( 'tab' , { name : 'New tab' } ) ;
291- expect ( removedTab ) . not . toBeInTheDocument ( ) ;
292- } ,
293- { timeout : 3000 }
294- ) ;
295- } ,
296- } ;
297-
298- /**
299- * Test opening multiple tabs and verify overflow dropdown appears
300- */
301- export const OpenMultipleTabs : Story = {
302- play : async ( { canvasElement } ) => {
303- const canvas = within ( canvasElement ) ;
304-
305- // Wait for page to load and find the Help button in the header
306- const helpButton = await canvas . findByLabelText (
307- 'Toggle help panel' ,
308- { } ,
309- { timeout : 5000 }
310- ) ;
311- expect ( helpButton ) . toBeInTheDocument ( ) ;
223+ // Story removed: Add/close tab functionality no longer exists in single-tier tab structure
312224
313- // Click the Help button to open the panel
314- await userEvent . click ( helpButton ) ;
315-
316- // Wait for the help panel drawer to open
317- await waitFor (
318- ( ) => {
319- const drawer = document . querySelector ( '.pf-v6-c-drawer.pf-m-expanded' ) ;
320- expect ( drawer ) . toBeInTheDocument ( ) ;
321- } ,
322- { timeout : 5000 }
323- ) ;
324-
325- // Wait for the help panel to be visible
326- await waitFor (
327- ( ) => {
328- const helpPanelTitle = document . querySelector (
329- '[data-ouia-component-id="help-panel-title"]'
330- ) ;
331- expect ( helpPanelTitle ) . toBeInTheDocument ( ) ;
332- } ,
333- { timeout : 5000 }
334- ) ;
335-
336- // Find the add tab button
337- const addTabButton = document . querySelector (
338- '[data-ouia-component-id="help-panel-add-tab-button"]'
339- ) as HTMLElement ;
340-
341- // Keep adding tabs until overflow occurs (max 10 attempts to prevent infinite loop)
342- let overflowItem = null ;
343- let attempts = 0 ;
344- const maxAttempts = 10 ;
345-
346- while ( ! overflowItem && attempts < maxAttempts ) {
347- await userEvent . click ( addTabButton ) ;
348- attempts ++ ;
349-
350- // Wait briefly for the tab to be added
351- await waitFor (
352- ( ) => {
353- const tabs = canvas . queryAllByRole ( 'tab' , { name : 'New tab' } ) ;
354- expect ( tabs . length ) . toBeGreaterThanOrEqual ( attempts ) ;
355- } ,
356- { timeout : 1000 }
357- ) . catch ( ( ) => {
358- // Ignore timeout, we'll check overflow anyway
359- } ) ;
360-
361- // Check if overflow has appeared
362- overflowItem = document . querySelector (
363- '.pf-v6-c-tabs__item.pf-m-overflow'
364- ) ;
365- }
366-
367- // Assert that overflow menu appeared
368- expect ( overflowItem ) . toBeTruthy ( ) ;
369-
370- // Find and close the visible new tab(s)
371- const visibleNewTabs = canvas . queryAllByRole ( 'tab' , { name : 'New tab' } ) ;
372-
373- if ( visibleNewTabs . length > 0 ) {
374- // Close the first visible new tab
375- const firstTabItem = visibleNewTabs [ 0 ] . closest ( '.pf-v6-c-tabs__item' ) ;
376- const closeButton = firstTabItem ?. querySelector (
377- '.pf-v6-c-tabs__item-action button'
378- ) as HTMLElement ;
379-
380- if ( closeButton ) {
381- await userEvent . click ( closeButton ) ;
382-
383- // Wait a bit for the tab to close
384- await waitFor (
385- ( ) => {
386- const tabs = canvas . queryAllByRole ( 'tab' , { name : 'New tab' } ) ;
387- expect ( tabs . length ) . toBeLessThan ( visibleNewTabs . length ) ;
388- } ,
389- { timeout : 3000 }
390- ) ;
391- }
392- }
393- } ,
394- } ;
225+ // Story removed: Tab overflow functionality testing no longer relevant with static tabs
395226
396227/**
397228 * Test that the drawer close button works
0 commit comments