e2e: creates a separate package for selectors (#23858)

* Initial commit

* Chore: fixes after merge

* Chore: removes todos

* Chore: uncomment test

* Chore: adds missing externals to rollup config

* Refactor: selectors is master for everything

* Docs: updates Docs

* Chore: adds e2e-selectors to publish
This commit is contained in:
Hugo Häggmark
2020-04-27 09:09:05 +02:00
committed by GitHub
parent 9ac7263e66
commit b09b49fb37
105 changed files with 691 additions and 760 deletions

View File

@@ -8,12 +8,13 @@ import {
transformDataFrame,
} from '@grafana/data';
import { Button, Field, Icon, Select, Table } from '@grafana/ui';
import { selectors } from '@grafana/e2e-selectors';
import AutoSizer from 'react-virtualized-auto-sizer';
import { getPanelInspectorStyles } from './styles';
import { config } from 'app/core/config';
import AutoSizer from 'react-virtualized-auto-sizer';
import { saveAs } from 'file-saver';
import { cx } from 'emotion';
import { e2e } from '@grafana/e2e';
interface Props {
data: DataFrame[];
@@ -109,7 +110,7 @@ export class InspectDataTab extends PureComponent<Props, State> {
});
return (
<div className={styles.dataTabContent} aria-label={e2e.components.PanelInspector.Data.selectors.content}>
<div className={styles.dataTabContent} aria-label={selectors.components.PanelInspector.Data.content}>
<div className={styles.toolbar}>
<Field label="Transformer" className="flex-grow-1">
<Select options={transformationOptions} value={transformId} onChange={this.onTransformationChange} />

View File

@@ -2,10 +2,11 @@ import React, { PureComponent } from 'react';
import { chain } from 'lodash';
import { AppEvents, PanelData, SelectableValue } from '@grafana/data';
import { Button, ClipboardButton, Field, JSONFormatter, Select, TextArea } from '@grafana/ui';
import { selectors } from '@grafana/e2e-selectors';
import { appEvents } from 'app/core/core';
import { DashboardModel, PanelModel } from '../../state';
import { getPanelInspectorStyles } from './styles';
import { e2e } from '@grafana/e2e';
enum ShowContent {
PanelJSON = 'panel',
@@ -142,7 +143,7 @@ export class InspectJSONTab extends PureComponent<Props, State> {
return (
<>
<div className={styles.toolbar} aria-label={e2e.components.PanelInspector.Json.selectors.content}>
<div className={styles.toolbar} aria-label={selectors.components.PanelInspector.Json.content}>
<Field label="Select source" className="flex-grow-1">
<Select options={options} value={selected} onChange={this.onSelectChanged} />
</Field>

View File

@@ -7,6 +7,7 @@ import { QueryInspector } from './QueryInspector';
import { DashboardModel, PanelModel } from 'app/features/dashboard/state';
import { CustomScrollbar, Drawer, JSONFormatter, TabContent } from '@grafana/ui';
import { selectors } from '@grafana/e2e-selectors';
import { getDataSourceSrv, getLocationSrv } from '@grafana/runtime';
import {
DataFrame,
@@ -25,7 +26,6 @@ import { config } from 'app/core/config';
import { getPanelInspectorStyles } from './styles';
import { StoreState } from 'app/types';
import { InspectDataTab } from './InspectDataTab';
import { e2e } from '@grafana/e2e';
interface OwnProps {
dashboard: DashboardModel;
@@ -223,7 +223,7 @@ export class PanelInspectorUnconnected extends PureComponent<Props, State> {
}
return (
<div aria-label={e2e.components.PanelInspector.Stats.selectors.content}>
<div aria-label={selectors.components.PanelInspector.Stats.content}>
{this.renderStatsTable('Stats', stats)}
{this.renderStatsTable('Data source stats', dataStats)}
</div>

View File

@@ -1,12 +1,13 @@
import React, { PureComponent } from 'react';
import { Button, JSONFormatter, LoadingPlaceholder } from '@grafana/ui';
import { selectors } from '@grafana/e2e-selectors';
import { AppEvents, PanelEvents } from '@grafana/data';
import appEvents from 'app/core/app_events';
import { CopyToClipboard } from 'app/core/components/CopyToClipboard/CopyToClipboard';
import { Button, JSONFormatter, LoadingPlaceholder } from '@grafana/ui';
import { CoreEvents } from 'app/types';
import { AppEvents, PanelEvents } from '@grafana/data';
import { PanelModel } from 'app/features/dashboard/state';
import { getPanelInspectorStyles } from './styles';
import { e2e } from '@grafana/e2e';
interface DsQuery {
isLoading: boolean;
@@ -189,7 +190,7 @@ export class QueryInspector extends PureComponent<Props, State> {
return (
<>
<div aria-label={e2e.components.PanelInspector.Query.selectors.content}>
<div aria-label={selectors.components.PanelInspector.Query.content}>
<h3 className="section-heading">Query inspector</h3>
<p className="small muted">
Query inspector allows you to view raw request and response. To collect this data Grafana needs to issue a