From a9aac8e7f34e74926bc359e5e1a0737f9aa43120 Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Wed, 21 Nov 2018 10:42:03 -0700 Subject: [PATCH 1/2] 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 ![screenshot 2018-11-19 12 37 07](https://user-images.githubusercontent.com/404731/48730518-da7ee980-ebf7-11e8-9abb-cf294079bb5f.png) --- .../element_content/element_content.js | 1 + .../workpad_loader/workpad_loader.js | 2 + .../components/workpad_page/workpad_page.js | 1 + x-pack/test/functional/apps/canvas/index.js | 11 + .../test/functional/apps/canvas/smoke_test.js | 81 ++++ x-pack/test/functional/config.js | 5 + .../es_archives/canvas/default/data.json.gz | Bin 0 -> 1326 bytes .../es_archives/canvas/default/mappings.json | 353 ++++++++++++++++++ 8 files changed, 454 insertions(+) create mode 100644 x-pack/test/functional/apps/canvas/index.js create mode 100644 x-pack/test/functional/apps/canvas/smoke_test.js create mode 100644 x-pack/test/functional/es_archives/canvas/default/data.json.gz create mode 100644 x-pack/test/functional/es_archives/canvas/default/mappings.json diff --git a/x-pack/plugins/canvas/public/components/element_content/element_content.js b/x-pack/plugins/canvas/public/components/element_content/element_content.js index 4a62f219b2ba5..4f9ee400940a4 100644 --- a/x-pack/plugins/canvas/public/components/element_content/element_content.js +++ b/x-pack/plugins/canvas/public/components/element_content/element_content.js @@ -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" > diff --git a/x-pack/plugins/canvas/public/components/workpad_page/workpad_page.js b/x-pack/plugins/canvas/public/components/workpad_page/workpad_page.js index fc46820aca56f..35ec5db959d76 100644 --- a/x-pack/plugins/canvas/public/components/workpad_page/workpad_page.js +++ b/x-pack/plugins/canvas/public/components/workpad_page/workpad_page.js @@ -72,6 +72,7 @@ export class WorkpadPage extends PureComponent {
{ + 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); + }); + }); + }); +} diff --git a/x-pack/test/functional/config.js b/x-pack/test/functional/config.js index 73f48d1f369c1..3c396fc7c2c97 100644 --- a/x-pack/test/functional/config.js +++ b/x-pack/test/functional/config.js @@ -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'), @@ -174,6 +175,10 @@ export default async function ({ readConfigFile }) { }, infraOps: { pathname: '/app/infra' + }, + canvas: { + pathname: '/app/canvas', + hash: '/', } }, diff --git a/x-pack/test/functional/es_archives/canvas/default/data.json.gz b/x-pack/test/functional/es_archives/canvas/default/data.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..de9d891058cb11725c011ae927ded826ac9f74c2 GIT binary patch literal 1326 zcmV+}1=0E+iwFP!000026TMe$Z`(Ey{+?gK$zR&RH29_$8VFD{Yli~O+AYQkbS?_M zI%;gmmE9?V0J7wFm0CP-du&6^m(eEvm~!rEcwljamnAP$6cm$=|l- zwjyn6Rps+0FAJ|RI?Zd~K1*j7Y+eOgi@$Vdsd8FYUcZNsw32pZpDRfCsrn`&V; zlGU}!%>vhs-oT5w7LC!LMdO78;S6F7Q8L2Wkf0$+1}UN+qgH)&;J>SbgR7quYgHCD zpA6Fh8lbyFz1G@}wOr&={l{YFP>xWFIVUko8R8t@8HtUZZwmz(qHK^7_P>Qf6z8Ib z7iD!e7kaq)g*ZjA%`yfPLKtMJHc$%2p%QLvO=1+q_e5^X=zg}2Ox=JF8;uUZ)^7cP zAMNamTsNoAK*mr9JvI5{)JL0>E<6_#?@9>O4*TZ@0v+c&4thnXXr?raImE~s$YRT3 z#!?B1k~%diWfb#{ck5_1%jtFjUsFq{vq@Dhiq?M5S{rSttO7$#C5k%Vl=f99HB&P) zMH8-NcRigoZRWttCQM)?Ai|bHCQ=MVk`WlogrrIurjZGjwGLi+>(7qV$*0EpBv3kt z`}^cgId|f2iaNsU%u<@|mEYu;+@T|>Naf_zDOKlvz&pPYO) zpEjndeFh!)bqc;NOyzTN^6KrYqY*HdjVZixUoIO{gV%q(I|k$NIGUCd$HMybS3dx6 z-yFXg0gTpMXoQ@aA0-6~NP!0Fep)akm3bOk5JIgXl0s{x+X+yLpfCxB)SyIWC?-P6 zN6>=Y*ODl|pB4l?KnqOClhZ=g=dKm`6JCE_<;o?qG8)*tKJ8z0@@nbi(RXKD2-3c^x zTfO@@tSPS%Od!RbW&!4=dhbp>hn`NiWcq$0SM6_%VL;a99Zqkz_0XlZsqehqCp7>C)<&nHW~MdAI{^_) zg`sncw1Na+mS|%1&fBHn;oDLBgwD55xXktmz?bb4fUnzU8>}W$JR@=3zy6}<(O!P$ z^@l2Nj4!6m?YSd-;j7x!?rh$@6=FWZd`Oca$p(z`kKMb@3so6^k=)hC=@64a!jdh0 kQP-xu5L~V9zN>EE+#a~IcD;)+-oCT`2LYJxQz;Pu03wc&S^xk5 literal 0 HcmV?d00001 diff --git a/x-pack/test/functional/es_archives/canvas/default/mappings.json b/x-pack/test/functional/es_archives/canvas/default/mappings.json new file mode 100644 index 0000000000000..6b943fc162b37 --- /dev/null +++ b/x-pack/test/functional/es_archives/canvas/default/mappings.json @@ -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": {} + } + } +} \ No newline at end of file From 4215d7b996fef7ab77da2679f3e9acecbd3419f1 Mon Sep 17 00:00:00 2001 From: spalger Date: Wed, 21 Nov 2018 18:05:59 -0800 Subject: [PATCH 2/2] [canvas/archive] remove _1 from .kibana archives to avoid lockup (cherry picked from commit d51e5545c322b6b204feb4f2a91db9a05f4d3604) --- .../es_archives/canvas/default/data.json.gz | Bin 1326 -> 1325 bytes .../es_archives/canvas/default/mappings.json | 44 ++++++++++++++++-- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/x-pack/test/functional/es_archives/canvas/default/data.json.gz b/x-pack/test/functional/es_archives/canvas/default/data.json.gz index de9d891058cb11725c011ae927ded826ac9f74c2..444125d376cfc2adc45016fd45eae0d546b180ae 100644 GIT binary patch delta 1317 zcmV+=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hqpW=B9e@PCbX7PPb(Gej-`Tv&4Q2akj>v4)#eth4+^5#1r*s%Ck&w@g?dh%oCCY zpv&( zn<-K5h#YFhO2uJ7*5w^eZ@2Z(rGK`m@4Ve7H2?+HMyH`>rZvYq0TE1vp>vD0f&^fe zXkzrv+oj;)+fn<3&bLpv%=QVum+cdPuiIxEtR_-CBXQin{-Wp6UVi5FhbnK3FQ(1y zxg&hxtJ>A>Y~H;UVm`urNRuJS28{EM-Mh{URT+Pg+||eF5R*Z|k}Z8v*B_?65L~V9 czN>EE+#a~IcD;)+-oCT`2LYJxQz;Pu0J|oSFaQ7m diff --git a/x-pack/test/functional/es_archives/canvas/default/mappings.json b/x-pack/test/functional/es_archives/canvas/default/mappings.json index 6b943fc162b37..a9fe069e4f920 100644 --- a/x-pack/test/functional/es_archives/canvas/default/mappings.json +++ b/x-pack/test/functional/es_archives/canvas/default/mappings.json @@ -1,17 +1,53 @@ { "type": "index", "value": { - "index": ".kibana_1", + "index": ".kibana", "settings": { "index": { "number_of_shards": "1", - "number_of_replicas": "1" + "auto_expand_replicas": "0-1", + "number_of_replicas": "0" } }, "mappings": { "doc": { "dynamic": "strict", "properties": { + "apm-telemetry": { + "properties": { + "has_any_services": { + "type": "boolean" + }, + "services_per_agent": { + "properties": { + "go": { + "type": "long", + "null_value": 0 + }, + "java": { + "type": "long", + "null_value": 0 + }, + "js-base": { + "type": "long", + "null_value": 0 + }, + "nodejs": { + "type": "long", + "null_value": 0 + }, + "python": { + "type": "long", + "null_value": 0 + }, + "ruby": { + "type": "long", + "null_value": 0 + } + } + } + } + }, "canvas-workpad": { "dynamic": "false", "properties": { @@ -346,8 +382,6 @@ } } }, - "aliases": { - ".kibana": {} - } + "aliases": {} } } \ No newline at end of file