Dashboards/E2E: Add tests for drag and drop (#105066)

This commit is contained in:
kay delaney
2025-05-13 20:27:40 +01:00
committed by GitHub
parent 5e056c2a3f
commit 3d5689cd07
6 changed files with 103 additions and 0 deletions
+1
View File
@@ -2,5 +2,6 @@ export * from './addPanel';
export * from './configurePanel';
export * from './removePanel';
export * from './toggleEditMode';
export * from './movePanel';
export * from './groupPanels';
export * from './saveDashboard';
+15
View File
@@ -0,0 +1,15 @@
import { e2e } from '../..';
/** Drags and drops the panel with title `sourcePanel` to the location of the panel with title `targetPanel` */
export const movePanel = (sourcePanel: string | RegExp, targetPanel: string | RegExp) => {
e2e.components.Panels.Panel.headerContainer()
.contains(targetPanel)
.then((el) => {
const rect = el.offset();
e2e.components.Panels.Panel.headerContainer()
.contains(sourcePanel)
.trigger('mousedown', { which: 1 })
.trigger('mousemove', { clientX: rect.left, clientY: rect.top })
.trigger('mouseup', { force: true });
});
};