grafana/e2e/dashboards-suite/dashboard-panel-attention.spec.ts
Tobias Skarhed 06304894a1
Dashboard: Keyboard and mouse panel shortcuts improvement (#87317)
* Add custom attention state to dashboard

* Add attention state to DashboardGrid

* Remove old functionality

* Add attention state to keybindingSrv

* Create PanelAttentionService

* Add PanelAttentionService with scenes support

* Remove unused code

* Use viz panel key instead of VizPanel

* Add type assertion

* Add e2e test

* Update comments

* Use panel id for non-scenes use case

* Support undefined service use case

* Memoize singleton call

* Debounce mouseover

* Set panelAttention with appEvents

* Use AppEvents for Scenes

* Remove panelAttentionSrv

* Wait in e2e to handle debounce

* Move subscription to KeybindingSrv

* Remove imports and reset keyboardShortcuts from main

* Fix on* event handlers
2024-05-29 09:11:23 +02:00

31 lines
1.1 KiB
TypeScript

import { e2e } from '../utils';
describe('Dashboard Panel Attention', () => {
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
// Open all panels dashboard
e2e.flows.openDashboard({ uid: 'n1jR8vnnz' });
});
it('Should give panel attention on focus', () => {
e2e.components.Panels.Panel.title('State timeline').focus();
cy.get('body').type('v');
cy.url().should('include', 'viewPanel=41');
});
it('Should give panel attention on hover', () => {
e2e.components.Panels.Panel.title('State timeline').trigger('mousemove');
cy.wait(100); // Wait because of debounce
cy.get('body').type('v');
cy.url().should('include', 'viewPanel=41');
});
it('Should change panel attention between focus and mousemove', () => {
e2e.components.Panels.Panel.title('Size, color mapped to different fields + share view').focus();
e2e.components.Panels.Panel.title('State timeline').trigger('mousemove');
cy.wait(100); // Wait because of debounce
cy.get('body').type('v');
cy.url().should('include', 'viewPanel=41');
});
});