mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DashboardScene: Adjust plugin-e2e for dashboardScene FF (#89052)
adjust plugin-e2e for dashboard scene ff
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { expect, test, DashboardPage } from '@grafana/plugin-e2e';
|
import { expect, test } from '@grafana/plugin-e2e';
|
||||||
|
|
||||||
import { formatExpectError } from '../errors';
|
import { formatExpectError } from '../errors';
|
||||||
import { successfulDataQuery } from '../mocks/queries';
|
import { successfulDataQuery } from '../mocks/queries';
|
||||||
@@ -71,7 +71,7 @@ test.describe('dashboard page', () => {
|
|||||||
test('getting panel by id', async ({ gotoDashboardPage }) => {
|
test('getting panel by id', async ({ gotoDashboardPage }) => {
|
||||||
const dashboardPage = await gotoDashboardPage(REACT_TABLE_DASHBOARD);
|
const dashboardPage = await gotoDashboardPage(REACT_TABLE_DASHBOARD);
|
||||||
await dashboardPage.goto();
|
await dashboardPage.goto();
|
||||||
const panel = await dashboardPage.getPanelById('4');
|
const panel = await dashboardPage.getPanelByTitle('Colored background');
|
||||||
await expect(panel.fieldNames, formatExpectError('Could not locate header elements in table panel')).toContainText([
|
await expect(panel.fieldNames, formatExpectError('Could not locate header elements in table panel')).toContainText([
|
||||||
'Field',
|
'Field',
|
||||||
'Max',
|
'Max',
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ describe('PanelOptions', () => {
|
|||||||
|
|
||||||
expect(screen.getByLabelText(OptionsPaneSelector.fieldLabel('Panel options Title'))).toBeInTheDocument();
|
expect(screen.getByLabelText(OptionsPaneSelector.fieldLabel('Panel options Title'))).toBeInTheDocument();
|
||||||
|
|
||||||
const input = screen.getByTestId('panel-edit-panel-title-input');
|
const input = screen.getByTestId(selectors.components.PanelEditor.OptionsPane.fieldInput('Title'));
|
||||||
fireEvent.change(input, { target: { value: 'New title' } });
|
fireEvent.change(input, { target: { value: 'New title' } });
|
||||||
|
|
||||||
expect(vizManager.state.panel.state.title).toBe('New title');
|
expect(vizManager.state.panel.state.title).toBe('New title');
|
||||||
@@ -127,7 +127,7 @@ describe('PanelOptions', () => {
|
|||||||
|
|
||||||
expect(screen.getByLabelText(OptionsPaneSelector.fieldLabel('Panel options Title'))).toBeInTheDocument();
|
expect(screen.getByLabelText(OptionsPaneSelector.fieldLabel('Panel options Title'))).toBeInTheDocument();
|
||||||
|
|
||||||
const input = screen.getByTestId('panel-edit-panel-title-input');
|
const input = screen.getByTestId(selectors.components.PanelEditor.OptionsPane.fieldInput('Title'));
|
||||||
fireEvent.change(input, { target: { value: '' } });
|
fireEvent.change(input, { target: { value: '' } });
|
||||||
|
|
||||||
expect(vizManager.state.panel.state.title).toBe('');
|
expect(vizManager.state.panel.state.title).toBe('');
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { SelectableValue } from '@grafana/data';
|
import { SelectableValue } from '@grafana/data';
|
||||||
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
import { VizPanel } from '@grafana/scenes';
|
import { VizPanel } from '@grafana/scenes';
|
||||||
import { RadioButtonGroup, Select, DataLinksInlineEditor, Input, TextArea, Switch } from '@grafana/ui';
|
import { RadioButtonGroup, Select, DataLinksInlineEditor, Input, TextArea, Switch } from '@grafana/ui';
|
||||||
@@ -187,7 +188,7 @@ function PanelFrameTitle({ vizManager }: { vizManager: VizPanelManager }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Input
|
<Input
|
||||||
data-testid="panel-edit-panel-title-input"
|
data-testid={selectors.components.PanelEditor.OptionsPane.fieldInput('Title')}
|
||||||
value={title}
|
value={title}
|
||||||
onChange={(e) => vizManager.setPanelTitle(e.currentTarget.value)}
|
onChange={(e) => vizManager.setPanelTitle(e.currentTarget.value)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user