Enable expression service screenshot tests (#50472)
* Enables interpreter screenshot tests which were disabled in #42842 * Refactors tests to use expression service * Fixes edge cases in expression service render: ** fixes swallowing of promise rejections from renderer.render() ** fixes swallowing of errors which emitted sync in render() * Adds default value to colorRange type, as otherwise it fails in runtime if not passed
|
@ -14,7 +14,7 @@ Object {
|
|||
},
|
||||
"metric": Object {
|
||||
"colorSchema": "\\"Green to Red\\"",
|
||||
"colorsRange": undefined,
|
||||
"colorsRange": "{range from=0 to=10000}",
|
||||
"invertColors": false,
|
||||
"labels": Object {
|
||||
"show": true,
|
||||
|
|
|
@ -99,6 +99,7 @@ export const createMetricVisFn = (): ExpressionFunction<
|
|||
colorRange: {
|
||||
types: ['range'],
|
||||
multi: true,
|
||||
default: '{range from=0 to=10000}',
|
||||
help: i18n.translate('visTypeMetric.function.colorRange.help', {
|
||||
defaultMessage:
|
||||
'A range object specifying groups of values to which different colors should be applied.',
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { first, skip } from 'rxjs/operators';
|
||||
import { fromExpression } from '@kbn/interpreter/common';
|
||||
import { first } from 'rxjs/operators';
|
||||
import { loader, ExpressionLoader } from './loader';
|
||||
import { ExpressionDataHandler } from './execute';
|
||||
import { IInterpreterRenderHandlers } from './types';
|
||||
|
@ -124,7 +124,7 @@ describe('ExpressionLoader', () => {
|
|||
let response = await expressionLoader.render$.pipe(first()).toPromise();
|
||||
expect(response).toBe(1);
|
||||
expressionLoader.update('test');
|
||||
response = await expressionLoader.render$.pipe(first()).toPromise();
|
||||
response = await expressionLoader.render$.pipe(skip(1), first()).toPromise();
|
||||
expect(response).toBe(2);
|
||||
});
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ export class ExpressionLoader {
|
|||
private loadingSubject: Subject<void>;
|
||||
private data: Data;
|
||||
private params: IExpressionLoaderParams = {};
|
||||
private ignoreNextResponse = false;
|
||||
|
||||
constructor(
|
||||
element: HTMLElement,
|
||||
|
@ -134,15 +133,14 @@ export class ExpressionLoader {
|
|||
params: IExpressionLoaderParams
|
||||
): Promise<void> => {
|
||||
if (this.dataHandler && this.dataHandler.isPending) {
|
||||
this.ignoreNextResponse = true;
|
||||
this.dataHandler.cancel();
|
||||
}
|
||||
this.setParams(params);
|
||||
this.dataHandler = new ExpressionDataHandler(expression, params);
|
||||
if (!params.inspectorAdapters) params.inspectorAdapters = this.dataHandler.inspect();
|
||||
const data = await this.dataHandler.getData();
|
||||
if (this.ignoreNextResponse) {
|
||||
this.ignoreNextResponse = false;
|
||||
const prevDataHandler = this.dataHandler;
|
||||
const data = await prevDataHandler.getData();
|
||||
if (this.dataHandler !== prevDataHandler) {
|
||||
return;
|
||||
}
|
||||
this.dataSubject.next(data);
|
||||
|
|
|
@ -128,5 +128,19 @@ describe('ExpressionRenderHandler', () => {
|
|||
expressionRenderHandler.render({ type: 'render', as: 'test' });
|
||||
});
|
||||
});
|
||||
|
||||
// in case render$ subscription happen after render() got called
|
||||
// we still want to be notified about sync render$ updates
|
||||
it("doesn't swallow sync render errors", async () => {
|
||||
const expressionRenderHandler = new ExpressionRenderHandler(element);
|
||||
expressionRenderHandler.render(false);
|
||||
const promise = expressionRenderHandler.render$.pipe(first()).toPromise();
|
||||
await expect(promise).resolves.toEqual({
|
||||
type: 'error',
|
||||
error: {
|
||||
message: 'invalid data provided to the expression renderer',
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import { Observable } from 'rxjs';
|
||||
import * as Rx from 'rxjs';
|
||||
import { share } from 'rxjs/operators';
|
||||
import { filter, share } from 'rxjs/operators';
|
||||
import { event, RenderId, Data, IInterpreterRenderHandlers } from './types';
|
||||
import { getRenderersRegistry } from './services';
|
||||
|
||||
|
@ -38,7 +38,7 @@ export class ExpressionRenderHandler {
|
|||
private element: HTMLElement;
|
||||
private destroyFn?: any;
|
||||
private renderCount: number = 0;
|
||||
private renderSubject: Rx.Subject<RenderId | RenderError>;
|
||||
private renderSubject: Rx.BehaviorSubject<RenderId | RenderError | null>;
|
||||
private eventsSubject: Rx.Subject<unknown>;
|
||||
private updateSubject: Rx.Subject<unknown>;
|
||||
private handlers: IInterpreterRenderHandlers;
|
||||
|
@ -49,8 +49,11 @@ export class ExpressionRenderHandler {
|
|||
this.eventsSubject = new Rx.Subject();
|
||||
this.events$ = this.eventsSubject.asObservable().pipe(share());
|
||||
|
||||
this.renderSubject = new Rx.Subject();
|
||||
this.render$ = this.renderSubject.asObservable().pipe(share());
|
||||
this.renderSubject = new Rx.BehaviorSubject(null as RenderId | RenderError | null);
|
||||
this.render$ = this.renderSubject.asObservable().pipe(
|
||||
share(),
|
||||
filter(_ => _ !== null)
|
||||
) as Observable<RenderId | RenderError>;
|
||||
|
||||
this.updateSubject = new Rx.Subject();
|
||||
this.update$ = this.updateSubject.asObservable().pipe(share());
|
||||
|
@ -75,7 +78,7 @@ export class ExpressionRenderHandler {
|
|||
};
|
||||
}
|
||||
|
||||
render = (data: Data, extraHandlers: IExpressionRendererExtraHandlers = {}) => {
|
||||
render = async (data: Data, extraHandlers: IExpressionRendererExtraHandlers = {}) => {
|
||||
if (!data || typeof data !== 'object') {
|
||||
this.renderSubject.next({
|
||||
type: 'error',
|
||||
|
@ -108,7 +111,7 @@ export class ExpressionRenderHandler {
|
|||
|
||||
try {
|
||||
// Rendering is asynchronous, completed by handlers.done()
|
||||
getRenderersRegistry()
|
||||
await getRenderersRegistry()
|
||||
.get(data.as)!
|
||||
.render(this.element, data.value, { ...this.handlers, ...extraHandlers });
|
||||
} catch (e) {
|
||||
|
|
|
@ -25,6 +25,7 @@ import chrome from 'ui/chrome';
|
|||
|
||||
import { RequestAdapter, DataAdapter } from 'ui/inspector/adapters';
|
||||
import { registries } from 'plugins/interpreter/registries';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
|
||||
// This is required so some default styles and required scripts/Angular modules are loaded,
|
||||
// or the timezone setting is correctly applied.
|
||||
|
@ -38,6 +39,7 @@ import 'uiExports/visEditorTypes';
|
|||
import 'uiExports/visualize';
|
||||
import 'uiExports/savedObjectTypes';
|
||||
import 'uiExports/search';
|
||||
import 'uiExports/interpreter';
|
||||
|
||||
import { Main } from './components/main';
|
||||
|
||||
|
@ -54,17 +56,6 @@ app.config(stateManagementConfigProvider =>
|
|||
stateManagementConfigProvider.disable()
|
||||
);
|
||||
|
||||
import { fromExpression } from '@kbn/interpreter/common';
|
||||
import { getInterpreter } from '../../../../../src/legacy/core_plugins/interpreter/public/interpreter';
|
||||
|
||||
const runPipeline = async (expression, context, handlers) => {
|
||||
const ast = fromExpression(expression);
|
||||
const { interpreter } = await getInterpreter();
|
||||
const pipelineResponse = await interpreter.interpretAst(ast, context, handlers);
|
||||
return pipelineResponse;
|
||||
};
|
||||
|
||||
|
||||
function RootController($scope, $element) {
|
||||
const domNode = $element[0];
|
||||
|
||||
|
@ -72,7 +63,7 @@ function RootController($scope, $element) {
|
|||
render(<Main
|
||||
RequestAdapter={RequestAdapter}
|
||||
DataAdapter={DataAdapter}
|
||||
runPipeline={runPipeline}
|
||||
expressions={npStart.plugins.expressions}
|
||||
registries={registries}
|
||||
/>, domNode);
|
||||
|
||||
|
|
|
@ -24,11 +24,10 @@ import {
|
|||
EuiPageContent,
|
||||
EuiPageContentHeader,
|
||||
} from '@elastic/eui';
|
||||
import { first } from 'rxjs/operators';
|
||||
|
||||
class Main extends React.Component {
|
||||
|
||||
chartDiv = React.createRef();
|
||||
exprDiv = React.createRef();
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
@ -43,37 +42,26 @@ class Main extends React.Component {
|
|||
requests: new props.RequestAdapter(),
|
||||
data: new props.DataAdapter(),
|
||||
};
|
||||
return await props.runPipeline(expression, context, {
|
||||
return await props.expressions.execute(expression, {
|
||||
inspectorAdapters: adapters,
|
||||
getInitialContext: () => initialContext,
|
||||
});
|
||||
};
|
||||
|
||||
const handlers = {
|
||||
onDestroy: () => { return; },
|
||||
context,
|
||||
searchContext: initialContext,
|
||||
}).getData();
|
||||
};
|
||||
|
||||
let lastRenderHandler;
|
||||
window.renderPipelineResponse = async (context = {}) => {
|
||||
return new Promise(resolve => {
|
||||
if (context.type !== 'render') {
|
||||
this.setState({ expression: 'Expression did not return render type!\n\n' + JSON.stringify(context) });
|
||||
return resolve();
|
||||
}
|
||||
const renderer = props.registries.renderers.get(context.as);
|
||||
if (!renderer) {
|
||||
this.setState({ expression: 'Renderer was not found in registry!\n\n' + JSON.stringify(context) });
|
||||
return resolve();
|
||||
}
|
||||
const renderCompleteHandler = () => {
|
||||
resolve('render complete');
|
||||
this.chartDiv.removeEventListener('renderComplete', renderCompleteHandler);
|
||||
};
|
||||
this.chartDiv.addEventListener('renderComplete', renderCompleteHandler);
|
||||
renderer.render(this.chartDiv, context.value, handlers);
|
||||
});
|
||||
if (lastRenderHandler) {
|
||||
lastRenderHandler.destroy();
|
||||
}
|
||||
|
||||
lastRenderHandler = props.expressions.render(this.chartDiv, context);
|
||||
const renderResult = await lastRenderHandler.render$.pipe(first()).toPromise();
|
||||
|
||||
if (typeof renderResult === 'object' && renderResult.type === 'error') {
|
||||
return this.setState({ expression: 'Render error!\n\n' + JSON.stringify(renderResult.error) });
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 19 KiB |
|
@ -1 +1 @@
|
|||
{"type":"kibana_context"}
|
||||
{"filters":null,"query":null,"timeRange":null,"type":"kibana_context"}
|
|
@ -1 +1 @@
|
|||
{"filters":[],"query":[],"type":"kibana_context"}
|
||||
{"filters":[],"query":[],"timeRange":null,"type":"kibana_context"}
|
|
@ -1 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"metric"}}
|
||||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","colorsRange":[{"from":0,"to":10000,"type":"range"}],"invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"metric"}}
|
|
@ -1 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"metric"}}
|
||||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","colorsRange":[{"from":0,"to":10000,"type":"range"}],"invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"metric"}}
|
|
@ -1 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"bucket":{"accessor":2,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"},{"id":"col-2-1","name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"kibana_datatable"},"visType":"metric"}}
|
||||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"bucket":{"accessor":2,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","colorsRange":[{"from":0,"to":10000,"type":"range"}],"invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"},{"id":"col-2-1","name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"kibana_datatable"},"visType":"metric"}}
|
|
@ -0,0 +1 @@
|
|||
"[metricVis] > [visdimension] > Can not cast 'null' to any of 'kibana_datatable'"
|
|
@ -1 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"},{"id":"col-2-1","name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"kibana_datatable"},"visType":"metric"}}
|
||||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","colorsRange":[{"from":0,"to":10000,"type":"range"}],"invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"},{"id":"col-2-1","name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"kibana_datatable"},"visType":"metric"}}
|
|
@ -1 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"},{"id":"col-2-1","name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"kibana_datatable"},"visType":"metric"}}
|
||||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","colorsRange":[{"from":0,"to":10000,"type":"range"}],"invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"},{"id":"col-2-1","name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"kibana_datatable"},"visType":"metric"}}
|
|
@ -0,0 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"maxFontSize":72,"metric":{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"single","scale":"linear","showLabel":true},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"tagcloud"}}
|
|
@ -0,0 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","colorsRange":[{"from":0,"to":10000,"type":"range"}],"invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"metric"}}
|
|
@ -0,0 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"bucket":{"accessor":0},"metric":{"accessor":1,"format":{"id":"number"}}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"region_map"}}
|
|
@ -1 +1 @@
|
|||
{"type":"kibana_context"}
|
||||
{"filters":null,"query":null,"timeRange":null,"type":"kibana_context"}
|
|
@ -1 +1 @@
|
|||
{"filters":[],"query":[],"type":"kibana_context"}
|
||||
{"filters":[],"query":[],"timeRange":null,"type":"kibana_context"}
|
|
@ -1 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"metric"}}
|
||||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","colorsRange":[{"from":0,"to":10000,"type":"range"}],"invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"metric"}}
|
|
@ -1 +1 @@
|
|||
{"error":{"message":"[tagcloud] > [vis_dimension] > Objects must have a type property","stack":"Error: [vis_dimension] > Objects must have a type property\n at getType (http://localhost:5620/bundles/commons.bundle.js:15876:27)\n at cast (http://localhost:5620/bundles/commons.bundle.js:15683:46)\n at _callee3$ (http://localhost:5620/bundles/commons.bundle.js:31552:35)\n at tryCatch (webpack://%5Bname%5D/./node_modules/regenerator-runtime/runtime.js?:62:40)\n at Generator.invoke [as _invoke] (webpack://%5Bname%5D/./node_modules/regenerator-runtime/runtime.js?:288:22)\n at Generator.prototype.(anonymous function) [as next] (webpack://%5Bname%5D/./node_modules/regenerator-runtime/runtime.js?:114:21)\n at asyncGeneratorStep (http://localhost:5620/bundles/commons.bundle.js:31397:103)\n at _next (http://localhost:5620/bundles/commons.bundle.js:31399:194)\n at http://localhost:5620/bundles/commons.bundle.js:31399:364\n at new Promise (<anonymous>)"},"type":"error"}
|
||||
"[tagcloud] > [visdimension] > Can not cast 'null' to any of 'kibana_datatable'"
|
|
@ -0,0 +1 @@
|
|||
{"filters":null,"query":null,"timeRange":null,"type":"kibana_context"}
|
|
@ -0,0 +1 @@
|
|||
{"filters":[],"query":[],"timeRange":null,"type":"kibana_context"}
|
|
@ -0,0 +1 @@
|
|||
{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"}
|
|
@ -0,0 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","colorsRange":[{"from":0,"to":10000,"type":"range"}],"invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"metric"}}
|
|
@ -0,0 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","colorsRange":[{"from":0,"to":10000,"type":"range"}],"invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"metric"}}
|
|
@ -0,0 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"bucket":{"accessor":2,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","colorsRange":[{"from":0,"to":10000,"type":"range"}],"invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"},{"id":"col-2-1","name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"kibana_datatable"},"visType":"metric"}}
|
|
@ -0,0 +1 @@
|
|||
"[metricVis] > [visdimension] > Can not cast 'null' to any of 'kibana_datatable'"
|
|
@ -0,0 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","colorsRange":[{"from":0,"to":10000,"type":"range"}],"invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"},{"id":"col-2-1","name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"kibana_datatable"},"visType":"metric"}}
|
|
@ -0,0 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","colorsRange":[{"from":0,"to":1000,"type":"range"}],"invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":true,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"},{"id":"col-2-1","name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"kibana_datatable"},"visType":"metric"}}
|
|
@ -0,0 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","colorsRange":[{"from":0,"to":10000,"type":"range"}],"invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"},{"id":"col-2-1","name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"kibana_datatable"},"visType":"metric"}}
|
|
@ -0,0 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"maxFontSize":72,"metric":{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"single","scale":"linear","showLabel":true},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"tagcloud"}}
|
|
@ -0,0 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","colorsRange":[{"from":0,"to":10000,"type":"range"}],"invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"metric"}}
|
|
@ -0,0 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"bucket":{"accessor":0},"metric":{"accessor":1,"format":{"id":"number"}}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"region_map"}}
|
|
@ -0,0 +1 @@
|
|||
{"filters":null,"query":null,"timeRange":null,"type":"kibana_context"}
|
|
@ -0,0 +1 @@
|
|||
{"filters":[],"query":[],"timeRange":null,"type":"kibana_context"}
|
|
@ -0,0 +1 @@
|
|||
{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"}
|
|
@ -0,0 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"colorSchema":"Green to Red","colorsRange":[{"from":0,"to":10000,"type":"range"}],"invertColors":false,"labels":{"show":true},"metricColorMode":"None","percentageMode":false,"style":{"bgColor":false,"bgFill":"#000","fontSize":60,"labelColor":false,"subText":""},"useRanges":false}},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"metric"}}
|
|
@ -0,0 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"bucket":{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"},"maxFontSize":72,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"single","scale":"linear","showLabel":true},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"tagcloud"}}
|
|
@ -0,0 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"bucket":{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"},"maxFontSize":40,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":20,"orientation":"single","scale":"linear","showLabel":true},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"tagcloud"}}
|
|
@ -0,0 +1 @@
|
|||
"[tagcloud] > [visdimension] > Can not cast 'null' to any of 'kibana_datatable'"
|
|
@ -0,0 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"maxFontSize":72,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"single","scale":"linear","showLabel":true},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"tagcloud"}}
|
|
@ -0,0 +1 @@
|
|||
{"as":"visualization","type":"render","value":{"params":{"listenOnChange":true},"visConfig":{"bucket":{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"},"maxFontSize":72,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"multiple","scale":"log","showLabel":true},"visData":{"columns":[{"id":"col-0-2","name":"response.raw: Descending"},{"id":"col-1-1","name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"kibana_datatable"},"visType":"tagcloud"}}
|
|
@ -45,9 +45,7 @@ export default function ({ getService, updateBaselines }) {
|
|||
});
|
||||
|
||||
// rather we want to use this to do integration tests.
|
||||
// Failing on chromedriver 76
|
||||
// https://github.com/elastic/kibana/issues/42842
|
||||
describe.skip('full expression', () => {
|
||||
describe('full expression', () => {
|
||||
const expression = `kibana | kibana_context | esaggs index='logstash-*' aggConfigs='[
|
||||
{"id":"1","enabled":true,"type":"count","schema":"metric","params":{}},
|
||||
{"id":"2","enabled":true,"type":"terms","schema":"segment","params":
|
||||
|
@ -84,7 +82,7 @@ export default function ({ getService, updateBaselines }) {
|
|||
|
||||
// if we want to do multiple different tests using the same data, or reusing a part of expression its
|
||||
// possible to retrieve the intermediate result and reuse it in later expressions
|
||||
describe.skip('reusing partial results', () => {
|
||||
describe('reusing partial results', () => {
|
||||
it ('does some screenshot comparisons', async () => {
|
||||
const expression = `kibana | kibana_context | esaggs index='logstash-*' aggConfigs='[
|
||||
{"id":"1","enabled":true,"type":"count","schema":"metric","params":{}},
|
||||
|
@ -97,16 +95,15 @@ export default function ({ getService, updateBaselines }) {
|
|||
// we reuse that response to render 3 different charts and compare screenshots with baselines
|
||||
const tagCloudExpr =
|
||||
`tagcloud metric={visdimension 1 format="number"} bucket={visdimension 0}`;
|
||||
await expectExpression('partial_test_1', tagCloudExpr, context).toMatchScreenshot();
|
||||
await (await expectExpression('partial_test_1', tagCloudExpr, context).toMatchSnapshot()).toMatchScreenshot();
|
||||
|
||||
const metricExpr =
|
||||
`metricVis metric={visdimension 1 format="number"} bucket={visdimension 0}`;
|
||||
await expectExpression('partial_test_2', metricExpr, context).toMatchScreenshot();
|
||||
await (await expectExpression('partial_test_2', metricExpr, context).toMatchSnapshot()).toMatchScreenshot();
|
||||
|
||||
// todo: regionmap doesn't correctly signal when its done rendering (base layer might not yet be loaded)
|
||||
// const regionMapExpr =
|
||||
// `regionmap visConfig='{"metric":{"accessor":1,"format":{"id":"number"}},"bucket":{"accessor":0}}'`;
|
||||
// await expectExpression('partial_test_3', regionMapExpr, context).toMatchScreenshot();
|
||||
const regionMapExpr =
|
||||
`regionmap visConfig='{"metric":{"accessor":1,"format":{"id":"number"}},"bucket":{"accessor":0}}'`;
|
||||
await (await expectExpression('partial_test_3', regionMapExpr, context).toMatchSnapshot()).toMatchScreenshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -84,7 +84,7 @@ export const expectExpressionProvider = ({ getService, updateBaselines }) => {
|
|||
for (let i = 0; i < steps.length; i++) {
|
||||
const step = steps[i];
|
||||
lastResponse = await handler.runExpression(step, lastResponse);
|
||||
const diff = await snapshots.compareAgainstBaseline(name + i, lastResponse, updateBaselines);
|
||||
const diff = await snapshots.compareAgainstBaseline(name + i, toSerializable(lastResponse), updateBaselines);
|
||||
expect(diff).to.be.lessThan(0.05);
|
||||
}
|
||||
if (!responsePromise) {
|
||||
|
@ -101,7 +101,7 @@ export const expectExpressionProvider = ({ getService, updateBaselines }) => {
|
|||
*/
|
||||
toMatchSnapshot: async () => {
|
||||
const pipelineResponse = await handler.getResponse();
|
||||
await snapshots.compareAgainstBaseline(name, pipelineResponse, updateBaselines);
|
||||
await snapshots.compareAgainstBaseline(name, toSerializable(pipelineResponse), updateBaselines);
|
||||
return handler;
|
||||
},
|
||||
/**
|
||||
|
@ -110,6 +110,7 @@ export const expectExpressionProvider = ({ getService, updateBaselines }) => {
|
|||
*/
|
||||
toMatchScreenshot: async () => {
|
||||
const pipelineResponse = await handler.getResponse();
|
||||
log.debug('starting to render');
|
||||
const result = await browser.executeAsync((context, done) => {
|
||||
window.renderPipelineResponse(context).then(result => {
|
||||
done(result);
|
||||
|
@ -126,4 +127,13 @@ export const expectExpressionProvider = ({ getService, updateBaselines }) => {
|
|||
|
||||
return handler;
|
||||
};
|
||||
|
||||
function toSerializable(response) {
|
||||
if (response.error) {
|
||||
// in case of error, pass through only message to the snapshot
|
||||
// as error could be expected and stack trace shouldn't be part of the snapshot
|
||||
return response.error.message;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@ export default function ({ getService, getPageObjects, loadTestFile }) {
|
|||
const testSubjects = getService('testSubjects');
|
||||
const PageObjects = getPageObjects(['common', 'header']);
|
||||
|
||||
describe.skip('runPipeline', function () {
|
||||
describe('runPipeline', function () {
|
||||
this.tags(['skipFirefox']);
|
||||
|
||||
before(async () => {
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
import { expectExpressionProvider } from './helpers';
|
||||
|
||||
// this file showcases how to use testing utilities defined in helpers.js together with the kbn_tp_run_pipeline
|
||||
// test plugin to write autmated tests for interprete
|
||||
export default function ({ getService, updateBaselines }) {
|
||||
|
||||
let expectExpression;
|
||||
|
@ -29,8 +27,6 @@ export default function ({ getService, updateBaselines }) {
|
|||
expectExpression = expectExpressionProvider({ getService, updateBaselines });
|
||||
});
|
||||
|
||||
// we should not use this for tests like the ones below. this should be unit tested.
|
||||
// - tests against a single function could easily be written as unit tests (and should be)
|
||||
describe('correctly renders metric', () => {
|
||||
let dataContext;
|
||||
before(async () => {
|
||||
|
@ -46,35 +42,29 @@ export default function ({ getService, updateBaselines }) {
|
|||
dataContext = await expectExpression('partial_metric_test', expression).getResponse();
|
||||
});
|
||||
|
||||
it.skip('with invalid data', async () => {
|
||||
it('with invalid data', async () => {
|
||||
const expression = 'metricVis metric={visdimension 0}';
|
||||
await (await expectExpression('metric_invalid_data', expression).toMatchSnapshot()).toMatchScreenshot();
|
||||
});
|
||||
|
||||
// Test fails on chromedriver 76
|
||||
// https://github.com/elastic/kibana/issues/42842
|
||||
it.skip('with single metric data', async () => {
|
||||
it('with single metric data', async () => {
|
||||
const expression = 'metricVis metric={visdimension 0}';
|
||||
await (await expectExpression('metric_single_metric_data', expression, dataContext).toMatchSnapshot()).toMatchScreenshot();
|
||||
});
|
||||
|
||||
// Test fails on chromedriver 76
|
||||
// https://github.com/elastic/kibana/issues/42842
|
||||
it.skip('with multiple metric data', async () => {
|
||||
it('with multiple metric data', async () => {
|
||||
const expression = 'metricVis metric={visdimension 0} metric={visdimension 1}';
|
||||
await expectExpression('metric_multi_metric_data', expression, dataContext).toMatchSnapshot();
|
||||
await (await expectExpression('metric_multi_metric_data', expression, dataContext).toMatchSnapshot()).toMatchScreenshot();
|
||||
});
|
||||
|
||||
// Test fails on chromedriver 76
|
||||
// https://github.com/elastic/kibana/issues/42842
|
||||
it.skip('with metric and bucket data', async () => {
|
||||
it('with metric and bucket data', async () => {
|
||||
const expression = 'metricVis metric={visdimension 0} bucket={visdimension 2}';
|
||||
await (await expectExpression('metric_all_data', expression, dataContext).toMatchSnapshot()).toMatchScreenshot();
|
||||
});
|
||||
|
||||
it('with percentage option', async () => {
|
||||
const expression = 'metricVis metric={visdimension 0} percentage=true colorRange={range from=0 to=1000}';
|
||||
await expectExpression('metric_percentage', expression, dataContext).toMatchSnapshot();
|
||||
await (await expectExpression('metric_percentage', expression, dataContext).toMatchSnapshot()).toMatchScreenshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
import { expectExpressionProvider } from './helpers';
|
||||
|
||||
// this file showcases how to use testing utilities defined in helpers.js together with the kbn_tp_run_pipeline
|
||||
// test plugin to write autmated tests for interprete
|
||||
export default function ({ getService, updateBaselines }) {
|
||||
|
||||
let expectExpression;
|
||||
|
@ -29,8 +27,6 @@ export default function ({ getService, updateBaselines }) {
|
|||
expectExpression = expectExpressionProvider({ getService, updateBaselines });
|
||||
});
|
||||
|
||||
// we should not use this for tests like the ones below. this should be unit tested.
|
||||
// - tests against a single function could easily be written as unit tests (and should be)
|
||||
describe('correctly renders tagcloud', () => {
|
||||
let dataContext;
|
||||
before(async () => {
|
||||
|
@ -43,7 +39,7 @@ export default function ({ getService, updateBaselines }) {
|
|||
dataContext = await expectExpression('partial_tagcloud_test', expression).getResponse();
|
||||
});
|
||||
|
||||
it.skip('with invalid data', async () => {
|
||||
it('with invalid data', async () => {
|
||||
const expression = 'tagcloud metric={visdimension 0}';
|
||||
await (await expectExpression('tagcloud_invalid_data', expression).toMatchSnapshot()).toMatchScreenshot();
|
||||
});
|
||||
|
|