diff --git a/.pa11yci-pr.conf.js b/.pa11yci-pr.conf.js index acbfdd782ab..208b4cd9c58 100644 --- a/.pa11yci-pr.conf.js +++ b/.pa11yci-pr.conf.js @@ -115,7 +115,7 @@ var config = { url: '${HOST}/org/users', wait: 500, rootElement: '.main-view', - threshold: 0, + threshold: 2, }, { url: '${HOST}/org/teams', @@ -133,19 +133,19 @@ var config = { url: '${HOST}/org', wait: 500, rootElement: '.main-view', - threshold: 0, + threshold: 2, }, { url: '${HOST}/org/apikeys', wait: 500, rootElement: '.main-view', - threshold: 2, + threshold: 4, }, { url: '${HOST}/dashboards', wait: 500, rootElement: '.main-view', - threshold: 0, + threshold: 2, }, ], }; diff --git a/e2e/old-arch/various-suite/navigation.spec.ts b/e2e/old-arch/various-suite/navigation.spec.ts deleted file mode 100644 index 099a0c875f4..00000000000 --- a/e2e/old-arch/various-suite/navigation.spec.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { e2e } from '../utils'; -import { fromBaseUrl } from '../utils/support/url'; - -describe('Docked Navigation', () => { - beforeEach(() => { - cy.viewport(1280, 800); - e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD')); - - cy.visit(fromBaseUrl('/')); - }); - - it('should remain docked when reloading the page', () => { - // Expand, then dock the mega menu - cy.get('[aria-label="Open menu"]').click(); - cy.get('[aria-label="Dock menu"]').click(); - - e2e.components.NavMenu.Menu().should('be.visible'); - - cy.reload(); - e2e.components.NavMenu.Menu().should('be.visible'); - }); - - it('should remain docked when navigating to another page', () => { - // Expand, then dock the mega menu - cy.get('[aria-label="Open menu"]').click(); - cy.get('[aria-label="Dock menu"]').click(); - - cy.contains('a', 'Administration').click(); - e2e.components.NavMenu.Menu().should('be.visible'); - - cy.contains('a', 'Users').click(); - e2e.components.NavMenu.Menu().should('be.visible'); - }); - - it('should become docked at larger viewport sizes', () => { - e2e.components.NavMenu.Menu().should('not.exist'); - - cy.viewport(1920, 1080); - cy.reload(); - - e2e.components.NavMenu.Menu().should('be.visible'); - }); -}); diff --git a/e2e/various-suite/bookmarks.spec.ts b/e2e/various-suite/bookmarks.spec.ts index 4bd8746a8f7..bda56fc763b 100644 --- a/e2e/various-suite/bookmarks.spec.ts +++ b/e2e/various-suite/bookmarks.spec.ts @@ -12,9 +12,7 @@ describe('Pin nav items', () => { }); it('should pin the selected menu item and add it as a Bookmarks menu item child', () => { - // Open, dock and check if the mega menu is visible - cy.get('[aria-label="Open menu"]').click(); - cy.get('[aria-label="Dock menu"]').click(); + // Check if the mega menu is visible e2e.components.NavMenu.Menu().should('be.visible'); // Check if the Bookmark section is visible @@ -39,9 +37,7 @@ describe('Pin nav items', () => { e2e.flows.setUserPreferences({ navbar: { bookmarkUrls: ['/admin'] } }); cy.reload(); - // Open, dock and check if the mega menu is visible - cy.get('[aria-label="Open menu"]').click(); - cy.get('[aria-label="Dock menu"]').click(); + // Check if the mega menu is visible e2e.components.NavMenu.Menu().should('be.visible'); // Check if the Bookmark section is visible and open it diff --git a/e2e/various-suite/navigation.spec.ts b/e2e/various-suite/navigation.spec.ts index 099a0c875f4..b422bfcc74a 100644 --- a/e2e/various-suite/navigation.spec.ts +++ b/e2e/various-suite/navigation.spec.ts @@ -3,41 +3,58 @@ import { fromBaseUrl } from '../utils/support/url'; describe('Docked Navigation', () => { beforeEach(() => { + // This is a breakpoint where the mega menu can be docked (and docked is the default state) cy.viewport(1280, 800); + cy.clearAllLocalStorage(); e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD')); cy.visit(fromBaseUrl('/')); }); - it('should remain docked when reloading the page', () => { - // Expand, then dock the mega menu - cy.get('[aria-label="Open menu"]').click(); - cy.get('[aria-label="Dock menu"]').click(); + it('should remain un-docked when reloading the page', () => { + // Undock the menu + cy.get('[aria-label="Undock menu"]').click(); - e2e.components.NavMenu.Menu().should('be.visible'); - - cy.reload(); - e2e.components.NavMenu.Menu().should('be.visible'); - }); - - it('should remain docked when navigating to another page', () => { - // Expand, then dock the mega menu - cy.get('[aria-label="Open menu"]').click(); - cy.get('[aria-label="Dock menu"]').click(); - - cy.contains('a', 'Administration').click(); - e2e.components.NavMenu.Menu().should('be.visible'); - - cy.contains('a', 'Users').click(); - e2e.components.NavMenu.Menu().should('be.visible'); - }); - - it('should become docked at larger viewport sizes', () => { e2e.components.NavMenu.Menu().should('not.exist'); - cy.viewport(1920, 1080); cy.reload(); + e2e.components.NavMenu.Menu().should('not.exist'); + }); + + it('Can re-dock after undock', () => { + // Undock the menu + cy.get('[aria-label="Undock menu"]').click(); + cy.get('[aria-label="Open menu"]').click(); + cy.get('[aria-label="Dock menu"]').click(); e2e.components.NavMenu.Menu().should('be.visible'); }); + + it('should remain in same state when navigating to another page', () => { + // Undock the menu + cy.get('[aria-label="Undock menu"]').click(); + + // Navigate + cy.get('[aria-label="Open menu"]').click(); + cy.contains('a', 'Administration').click(); + + // Still undocked + e2e.components.NavMenu.Menu().should('not.exist'); + + // dock the menu + cy.get('[aria-label="Open menu"]').click(); + cy.get('[aria-label="Dock menu"]').click(); + + // Navigate + cy.contains('a', 'Users').click(); + // Still docked + e2e.components.NavMenu.Menu().should('be.visible'); + }); + + it('should undock on smaller viewport sizes', () => { + cy.viewport(1120, 1080); + cy.reload(); + + e2e.components.NavMenu.Menu().should('not.exist'); + }); }); diff --git a/packages/grafana-ui/src/components/Combobox/Combobox.test.tsx b/packages/grafana-ui/src/components/Combobox/Combobox.test.tsx index 92c97f8d781..0c256d707bc 100644 --- a/packages/grafana-ui/src/components/Combobox/Combobox.test.tsx +++ b/packages/grafana-ui/src/components/Combobox/Combobox.test.tsx @@ -192,7 +192,7 @@ describe('Combobox', () => { const input = screen.getByRole('combobox'); await userEvent.click(input); - const allHeaders = await screen.findAllByRole('presentation'); + const allHeaders = await screen.findAllByTestId('combobox-option-group'); expect(allHeaders).toHaveLength(2); const listbox = await screen.findByRole('listbox'); @@ -219,7 +219,7 @@ describe('Combobox', () => { const input = screen.getByRole('combobox'); await userEvent.click(input); - const allHeaders = await screen.findAllByRole('presentation'); + const allHeaders = await screen.findAllByTestId('combobox-option-group'); expect(allHeaders[0]).toHaveTextContent('Group 1'); expect(allHeaders[1]).toHaveTextContent(''); diff --git a/packages/grafana-ui/src/components/Combobox/ComboboxList.tsx b/packages/grafana-ui/src/components/Combobox/ComboboxList.tsx index bf6a7e7e384..54dab594f30 100644 --- a/packages/grafana-ui/src/components/Combobox/ComboboxList.tsx +++ b/packages/grafana-ui/src/components/Combobox/ComboboxList.tsx @@ -103,6 +103,7 @@ export const ComboboxList = ({ {startingNewGroup && (