e2eTests: Adds cleanup of created datasource and dashboard (#20244)

* e2eTests: Adds cleanup of created datasource and dashboard

* Chore: Fixes Prettier error

* Tests: Updates snapshots
This commit is contained in:
Hugo Häggmark
2019-11-08 09:48:33 +01:00
committed by GitHub
parent f2415a319e
commit 85c4311c9f
15 changed files with 203 additions and 83 deletions

View File

@@ -10,7 +10,7 @@ export interface Props {
const BasicSettings: FC<Props> = ({ dataSourceName, isDefault, onDefaultChange, onNameChange }) => {
return (
<div className="gf-form-group">
<div className="gf-form-group" aria-label="Datasource settings page basic settings">
<div className="gf-form-inline">
<div className="gf-form max-width-30" style={{ marginRight: '3px' }}>
<FormLabel
@@ -28,11 +28,17 @@ const BasicSettings: FC<Props> = ({ dataSourceName, isDefault, onDefaultChange,
placeholder="Name"
onChange={event => onNameChange(event.target.value)}
required
aria-label="Datasource settings page name input field"
/>
</div>
{/*
//@ts-ignore */}
<Switch label="Default" checked={isDefault} onChange={event => onDefaultChange(event.target.checked)} />
<Switch
label="Default"
checked={isDefault}
onChange={event => {
// @ts-ignore
onDefaultChange(event.target.checked);
}}
/>
</div>
</div>
);

View File

@@ -27,7 +27,13 @@ const ButtonRow: FC<Props> = ({ isReadOnly, onDelete, onSubmit, onTest }) => {
Test
</button>
)}
<button type="submit" className="btn btn-danger" disabled={isReadOnly} onClick={onDelete}>
<button
type="submit"
className="btn btn-danger"
disabled={isReadOnly}
onClick={onDelete}
aria-label="Delete button"
>
Delete
</button>
<a className="btn btn-inverse" href={`${config.appSubUrl}/datasources`}>

View File

@@ -3,36 +3,31 @@ import React, { PureComponent } from 'react';
import { hot } from 'react-hot-loader';
import { connect } from 'react-redux';
import isString from 'lodash/isString';
// Components
import Page from 'app/core/components/Page/Page';
import { PluginSettings, GenericDataSourcePlugin } from './PluginSettings';
import { GenericDataSourcePlugin, PluginSettings } from './PluginSettings';
import BasicSettings from './BasicSettings';
import ButtonRow from './ButtonRow';
// Services & Utils
import appEvents from 'app/core/app_events';
import { getBackendSrv } from 'app/core/services/backend_srv';
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
// Actions & selectors
import { getDataSource, getDataSourceMeta } from '../state/selectors';
import {
dataSourceLoaded,
deleteDataSource,
loadDataSource,
setDataSourceName,
setIsDefault,
updateDataSource,
dataSourceLoaded,
} from '../state/actions';
import { getNavModel } from 'app/core/selectors/navModel';
import { getRouteParamsId } from 'app/core/selectors/location';
// Types
import { StoreState, CoreEvents } from 'app/types/';
import { CoreEvents, StoreState } from 'app/types/';
import { UrlQueryMap } from '@grafana/runtime';
import { DataSourceSettings, DataSourcePluginMeta } from '@grafana/data';
import { NavModel } from '@grafana/data';
import { DataSourcePluginMeta, DataSourceSettings, NavModel } from '@grafana/data';
import { getDataSourceLoadingNav } from '../state/navModel';
import PluginStateinfo from 'app/features/plugins/PluginStateInfo';
import { importDataSourcePlugin } from 'app/features/plugins/plugin_loader';

View File

@@ -2,6 +2,7 @@
exports[`Render should render component 1`] = `
<div
aria-label="Datasource settings page basic settings"
className="gf-form-group"
>
<div
@@ -21,6 +22,7 @@ exports[`Render should render component 1`] = `
Name
</Component>
<Input
aria-label="Datasource settings page name input field"
className="gf-form-input max-width-23"
onChange={[Function]}
placeholder="Name"

View File

@@ -12,6 +12,7 @@ exports[`Render should render component 1`] = `
Test
</button>
<button
aria-label="Delete button"
className="btn btn-danger"
disabled={true}
onClick={[MockFunction]}
@@ -42,6 +43,7 @@ exports[`Render should render with buttons enabled 1`] = `
Save & Test
</button>
<button
aria-label="Delete button"
className="btn btn-danger"
disabled={false}
onClick={[MockFunction]}