mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Test: canvas functional smoke test (#25262)
~~Blocked by https://github.com/elastic/kibana/issues/23046 (pending https://github.com/elastic/kibana/pull/25828)~~ merged Adds functional smoke tests for Canvas. - Loads and checks the list of workpads - Loads the first workpad and checks that elements render This is the simple workpad it's testing 
This commit is contained in:
parent
5ec1117788
commit
3b7cca2e2a
8 changed files with 454 additions and 0 deletions
|
@ -51,6 +51,7 @@ export const ElementContent = compose(
|
|||
// TODO: 'canvas__element' was added for BWC, It can be removed after a while
|
||||
className={'canvas__element canvasElement'}
|
||||
style={{ ...renderable.containerStyle, ...size }}
|
||||
data-test-subj="canvasWorkpadPageElementContent"
|
||||
>
|
||||
<ElementShareContainer
|
||||
className="canvasElement__content"
|
||||
|
|
|
@ -179,6 +179,7 @@ export class WorkpadLoader extends React.PureComponent {
|
|||
|
||||
return (
|
||||
<Link
|
||||
data-test-subj="canvasWorkpadLoaderWorkpad"
|
||||
name="loadWorkpad"
|
||||
params={{ id: workpad.id }}
|
||||
aria-label={`Load workpad ${workpadName}`}
|
||||
|
@ -246,6 +247,7 @@ export class WorkpadLoader extends React.PureComponent {
|
|||
isSelectable
|
||||
selection={selection}
|
||||
className="canvasWorkpad__dropzoneTable"
|
||||
data-test-subj="canvasWorkpadLoaderTable"
|
||||
/>
|
||||
<EuiSpacer />
|
||||
<EuiFlexGroup gutterSize="none" justifyContent="flexEnd">
|
||||
|
|
|
@ -72,6 +72,7 @@ export class WorkpadPage extends PureComponent {
|
|||
<div
|
||||
key={page.id}
|
||||
id={page.id}
|
||||
data-test-subj="canvasWorkpadPage"
|
||||
className={`canvasPage ${className} ${isEditable ? 'canvasPage--isEditable' : ''}`}
|
||||
data-shared-items-container
|
||||
style={{
|
||||
|
|
11
x-pack/test/functional/apps/canvas/index.js
Normal file
11
x-pack/test/functional/apps/canvas/index.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export default function canvasApp({ loadTestFile }) {
|
||||
describe('Canvas app', function canvasAppTestSuite() {
|
||||
loadTestFile(require.resolve('./smoke_test'));
|
||||
});
|
||||
}
|
81
x-pack/test/functional/apps/canvas/smoke_test.js
Normal file
81
x-pack/test/functional/apps/canvas/smoke_test.js
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import expect from 'expect.js';
|
||||
import { parse } from 'url';
|
||||
|
||||
export default function canvasSmokeTest({ getService, getPageObjects }) {
|
||||
const esArchiver = getService('esArchiver');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const remote = getService('remote');
|
||||
const retry = getService('retry');
|
||||
const PageObjects = getPageObjects(['common']);
|
||||
|
||||
describe('smoke test', async () => {
|
||||
const workpadListSelector = 'canvasWorkpadLoaderTable canvasWorkpadLoaderWorkpad';
|
||||
const testWorkpadId = 'workpad-1705f884-6224-47de-ba49-ca224fe6ec31';
|
||||
|
||||
before(async () => {
|
||||
// init data
|
||||
await Promise.all([
|
||||
esArchiver.loadIfNeeded('logstash_functional'),
|
||||
esArchiver.load('canvas/default'),
|
||||
]);
|
||||
|
||||
// load canvas
|
||||
// see also navigateToUrl(app, hash)
|
||||
await PageObjects.common.navigateToApp('canvas');
|
||||
});
|
||||
|
||||
it('loads workpad list', async () => {
|
||||
await retry.try(async () => {
|
||||
const workpadRows = await testSubjects.findAll(workpadListSelector);
|
||||
expect(workpadRows).to.have.length(1);
|
||||
expect(await workpadRows[0].getVisibleText()).to.equal('Test Workpad');
|
||||
});
|
||||
});
|
||||
|
||||
it('loads workpage when clicked', async () => {
|
||||
// click the first workpad in the list to load it
|
||||
await testSubjects.click(workpadListSelector);
|
||||
|
||||
// wait for the workpad page to load
|
||||
await retry.waitFor('workpad page', () => testSubjects.exists('canvasWorkpadPage'));
|
||||
|
||||
// check that workpad loaded in url
|
||||
const url = await remote.getCurrentUrl();
|
||||
expect(parse(url).hash).to.equal(`#/workpad/${testWorkpadId}/page/1`);
|
||||
});
|
||||
|
||||
it('renders elements on workpad', async () => {
|
||||
await retry.try(async () => {
|
||||
// check for elements on the page
|
||||
const elements = await testSubjects.findAll(
|
||||
'canvasWorkpadPage canvasWorkpadPageElementContent'
|
||||
);
|
||||
expect(elements).to.have.length(4);
|
||||
|
||||
// check that the elements are what we expect
|
||||
|
||||
// first is a markdown element
|
||||
const md = await elements[0].findByCssSelector('.canvasMarkdown');
|
||||
expect(await md.getVisibleText()).to.contain('Welcome to Canvas');
|
||||
|
||||
// second element is a datatable that uses essql
|
||||
const serverRows = await elements[1].findAllByCssSelector('.canvasDataTable tbody tr');
|
||||
expect(serverRows).to.have.length(10);
|
||||
|
||||
// third is a datatable that uses csv
|
||||
const commonRows = await elements[2].findAllByCssSelector('.canvasDataTable tbody tr');
|
||||
expect(commonRows).to.have.length(2);
|
||||
|
||||
// fourth is a datatable that uses timelion
|
||||
const timelionRows = await elements[3].findAllByCssSelector('.canvasDataTable tbody tr');
|
||||
expect(timelionRows).to.have.length(12);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
|
@ -62,6 +62,7 @@ export default async function ({ readConfigFile }) {
|
|||
return {
|
||||
// list paths to the files that contain your plugins tests
|
||||
testFiles: [
|
||||
resolve(__dirname, './apps/canvas'),
|
||||
resolve(__dirname, './apps/graph'),
|
||||
resolve(__dirname, './apps/monitoring'),
|
||||
resolve(__dirname, './apps/watcher'),
|
||||
|
@ -178,6 +179,10 @@ export default async function ({ readConfigFile }) {
|
|||
},
|
||||
infraOps: {
|
||||
pathname: '/app/infra'
|
||||
},
|
||||
canvas: {
|
||||
pathname: '/app/canvas',
|
||||
hash: '/',
|
||||
}
|
||||
},
|
||||
|
||||
|
|
BIN
x-pack/test/functional/es_archives/canvas/default/data.json.gz
Normal file
BIN
x-pack/test/functional/es_archives/canvas/default/data.json.gz
Normal file
Binary file not shown.
353
x-pack/test/functional/es_archives/canvas/default/mappings.json
Normal file
353
x-pack/test/functional/es_archives/canvas/default/mappings.json
Normal file
|
@ -0,0 +1,353 @@
|
|||
{
|
||||
"type": "index",
|
||||
"value": {
|
||||
"index": ".kibana_1",
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_shards": "1",
|
||||
"number_of_replicas": "1"
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"doc": {
|
||||
"dynamic": "strict",
|
||||
"properties": {
|
||||
"canvas-workpad": {
|
||||
"dynamic": "false",
|
||||
"properties": {
|
||||
"@created": {
|
||||
"type": "date"
|
||||
},
|
||||
"@timestamp": {
|
||||
"type": "date"
|
||||
},
|
||||
"id": {
|
||||
"type": "text",
|
||||
"index": false
|
||||
},
|
||||
"name": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"dynamic": "true",
|
||||
"properties": {
|
||||
"buildNum": {
|
||||
"type": "keyword"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dashboard": {
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"hits": {
|
||||
"type": "integer"
|
||||
},
|
||||
"kibanaSavedObjectMeta": {
|
||||
"properties": {
|
||||
"searchSourceJSON": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"optionsJSON": {
|
||||
"type": "text"
|
||||
},
|
||||
"panelsJSON": {
|
||||
"type": "text"
|
||||
},
|
||||
"refreshInterval": {
|
||||
"properties": {
|
||||
"display": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"pause": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"section": {
|
||||
"type": "integer"
|
||||
},
|
||||
"value": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"timeFrom": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"timeRestore": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"timeTo": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"title": {
|
||||
"type": "text"
|
||||
},
|
||||
"uiStateJSON": {
|
||||
"type": "text"
|
||||
},
|
||||
"version": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"graph-workspace": {
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"kibanaSavedObjectMeta": {
|
||||
"properties": {
|
||||
"searchSourceJSON": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"numLinks": {
|
||||
"type": "integer"
|
||||
},
|
||||
"numVertices": {
|
||||
"type": "integer"
|
||||
},
|
||||
"title": {
|
||||
"type": "text"
|
||||
},
|
||||
"version": {
|
||||
"type": "integer"
|
||||
},
|
||||
"wsState": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"index-pattern": {
|
||||
"properties": {
|
||||
"fieldFormatMap": {
|
||||
"type": "text"
|
||||
},
|
||||
"fields": {
|
||||
"type": "text"
|
||||
},
|
||||
"intervalName": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"notExpandable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"sourceFilters": {
|
||||
"type": "text"
|
||||
},
|
||||
"timeFieldName": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"title": {
|
||||
"type": "text"
|
||||
},
|
||||
"type": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"typeMeta": {
|
||||
"type": "keyword"
|
||||
}
|
||||
}
|
||||
},
|
||||
"kql-telemetry": {
|
||||
"properties": {
|
||||
"optInCount": {
|
||||
"type": "long"
|
||||
},
|
||||
"optOutCount": {
|
||||
"type": "long"
|
||||
}
|
||||
}
|
||||
},
|
||||
"migrationVersion": {
|
||||
"type": "object",
|
||||
"dynamic": "true"
|
||||
},
|
||||
"namespace": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"search": {
|
||||
"properties": {
|
||||
"columns": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"hits": {
|
||||
"type": "integer"
|
||||
},
|
||||
"kibanaSavedObjectMeta": {
|
||||
"properties": {
|
||||
"searchSourceJSON": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sort": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"title": {
|
||||
"type": "text"
|
||||
},
|
||||
"version": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"server": {
|
||||
"properties": {
|
||||
"uuid": {
|
||||
"type": "keyword"
|
||||
}
|
||||
}
|
||||
},
|
||||
"space": {
|
||||
"properties": {
|
||||
"_reserved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"color": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"initials": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"name": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 2048
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"telemetry": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"timelion-sheet": {
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"hits": {
|
||||
"type": "integer"
|
||||
},
|
||||
"kibanaSavedObjectMeta": {
|
||||
"properties": {
|
||||
"searchSourceJSON": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"timelion_chart_height": {
|
||||
"type": "integer"
|
||||
},
|
||||
"timelion_columns": {
|
||||
"type": "integer"
|
||||
},
|
||||
"timelion_interval": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"timelion_other_interval": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"timelion_rows": {
|
||||
"type": "integer"
|
||||
},
|
||||
"timelion_sheet": {
|
||||
"type": "text"
|
||||
},
|
||||
"title": {
|
||||
"type": "text"
|
||||
},
|
||||
"version": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "date"
|
||||
},
|
||||
"url": {
|
||||
"properties": {
|
||||
"accessCount": {
|
||||
"type": "long"
|
||||
},
|
||||
"accessDate": {
|
||||
"type": "date"
|
||||
},
|
||||
"createDate": {
|
||||
"type": "date"
|
||||
},
|
||||
"url": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 2048
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"visualization": {
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"kibanaSavedObjectMeta": {
|
||||
"properties": {
|
||||
"searchSourceJSON": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"savedSearchId": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"title": {
|
||||
"type": "text"
|
||||
},
|
||||
"uiStateJSON": {
|
||||
"type": "text"
|
||||
},
|
||||
"version": {
|
||||
"type": "integer"
|
||||
},
|
||||
"visState": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"aliases": {
|
||||
".kibana": {}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue