E2E: Adding selectors to improve interactions with panel edit options (#97802)

* added selector for older versions of selector menu.

* added test-id to the portal container.

* fixed import order.
This commit is contained in:
Marcus Andersson 2025-01-08 14:40:49 +01:00 committed by GitHub
parent 5ed2a4c624
commit 299e16b61a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

@ -881,6 +881,7 @@ export const versionedComponents = {
Select: {
menu: {
'11.4.0': 'data-testid Select menu',
[MIN_GRAFANA_VERSION]: 'Select options menu',
},
option: {
'11.1.0': 'data-testid Select option',
@ -1234,6 +1235,11 @@ export const versionedComponents = {
'11.2.0': 'data-testid entity-not-found',
},
},
Portal: {
container: {
'11.4.1': 'data-testid portal-container',
},
},
} satisfies VersionedSelectorGroup;
export type VersionedComponents = typeof versionedComponents;

View File

@ -4,6 +4,7 @@ import * as React from 'react';
import ReactDOM from 'react-dom';
import { GrafanaTheme2 } from '@grafana/data';
import { selectors } from '@grafana/e2e-selectors';
import { useStyles2, useTheme2 } from '../../themes';
@ -51,7 +52,13 @@ export function getPortalContainer() {
/** @internal */
export function PortalContainer() {
const styles = useStyles2(getStyles);
return <div id="grafana-portal-container" className={styles.grafanaPortalContainer} />;
return (
<div
id="grafana-portal-container"
data-testid={selectors.components.Portal.container}
className={styles.grafanaPortalContainer}
/>
);
}
const getStyles = (theme: GrafanaTheme2) => {