forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add functional tests for visualize loader API (elastic#22595)
* Initial visualize loader functional tests * Extend plugin test README * Add temporary tz work around * Switch to Australia/North timezone * Add filtering tests * Add all tests * Remove unneeded uiExports * Improve explanation * Add saved object test, add retry
- Loading branch information
Showing
15 changed files
with
996 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+1.94 KB
test/functional/fixtures/es_archiver/visualize_embedding/data.json.gz
Binary file not shown.
246 changes: 246 additions & 0 deletions
246
test/functional/fixtures/es_archiver/visualize_embedding/mappings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,246 @@ | ||
{ | ||
"type": "index", | ||
"value": { | ||
"index": ".kibana", | ||
"settings": { | ||
"index": { | ||
"number_of_shards": "1", | ||
"number_of_replicas": "1" | ||
} | ||
}, | ||
"mappings": { | ||
"doc": { | ||
"properties": { | ||
"type": { | ||
"type": "keyword" | ||
}, | ||
"server": { | ||
"dynamic": "strict", | ||
"properties": { | ||
"uuid": { | ||
"type": "keyword" | ||
} | ||
} | ||
}, | ||
"url": { | ||
"dynamic": "strict", | ||
"properties": { | ||
"accessCount": { | ||
"type": "long" | ||
}, | ||
"accessDate": { | ||
"type": "date" | ||
}, | ||
"createDate": { | ||
"type": "date" | ||
}, | ||
"url": { | ||
"type": "text", | ||
"fields": { | ||
"keyword": { | ||
"type": "keyword", | ||
"ignore_above": 2048 | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"search": { | ||
"dynamic": "strict", | ||
"properties": { | ||
"columns": { | ||
"type": "keyword" | ||
}, | ||
"description": { | ||
"type": "text" | ||
}, | ||
"hits": { | ||
"type": "integer" | ||
}, | ||
"kibanaSavedObjectMeta": { | ||
"properties": { | ||
"searchSourceJSON": { | ||
"type": "text" | ||
} | ||
} | ||
}, | ||
"sort": { | ||
"type": "keyword" | ||
}, | ||
"title": { | ||
"type": "text" | ||
}, | ||
"version": { | ||
"type": "integer" | ||
} | ||
} | ||
}, | ||
"visualization": { | ||
"dynamic": "strict", | ||
"properties": { | ||
"description": { | ||
"type": "text" | ||
}, | ||
"kibanaSavedObjectMeta": { | ||
"properties": { | ||
"searchSourceJSON": { | ||
"type": "text" | ||
} | ||
} | ||
}, | ||
"savedSearchId": { | ||
"type": "keyword" | ||
}, | ||
"title": { | ||
"type": "text" | ||
}, | ||
"uiStateJSON": { | ||
"type": "text" | ||
}, | ||
"version": { | ||
"type": "integer" | ||
}, | ||
"visState": { | ||
"type": "text" | ||
} | ||
} | ||
}, | ||
"index-pattern": { | ||
"dynamic": "strict", | ||
"properties": { | ||
"fieldFormatMap": { | ||
"type": "text" | ||
}, | ||
"fields": { | ||
"type": "text" | ||
}, | ||
"intervalName": { | ||
"type": "keyword" | ||
}, | ||
"notExpandable": { | ||
"type": "boolean" | ||
}, | ||
"sourceFilters": { | ||
"type": "text" | ||
}, | ||
"timeFieldName": { | ||
"type": "keyword" | ||
}, | ||
"title": { | ||
"type": "text" | ||
} | ||
} | ||
}, | ||
"config": { | ||
"dynamic": "true", | ||
"properties": { | ||
"buildNum": { | ||
"type": "keyword" | ||
} | ||
} | ||
}, | ||
"dashboard": { | ||
"dynamic": "strict", | ||
"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" | ||
} | ||
} | ||
}, | ||
"timelion-sheet": { | ||
"dynamic": "strict", | ||
"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" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
export function TableProvider({ getService }) { | ||
const testSubjects = getService('testSubjects'); | ||
// const retry = getService('retry'); | ||
|
||
class Table { | ||
|
||
async getDataFromTestSubj(testSubj) { | ||
const table = await testSubjects.find(testSubj); | ||
// Convert the data into a nested array format: | ||
// [ [cell1_in_row1, cell2_in_row1], [cell1_in_row2, cell2_in_row2] ] | ||
const rows = await table.findAllByTagName('tr'); | ||
return await Promise.all(rows.map(async row => { | ||
const cells = await row.findAllByTagName('td'); | ||
return await Promise.all(cells.map(async cell => cell.getVisibleText())); | ||
})); | ||
} | ||
} | ||
|
||
return new Table(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
test/plugin_functional/plugins/visualize_embedding/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
export default function (kibana) { | ||
return new kibana.Plugin({ | ||
uiExports: { | ||
app: { | ||
title: 'Embedding Vis', | ||
description: 'This is a sample plugin to test embedding of visualizations', | ||
main: 'plugins/visualize_embedding/app', | ||
} | ||
}, | ||
|
||
init(server) { | ||
// The following lines copy over some configuration variables from Kibana | ||
// to this plugin. This will be needed when embedding visualizations, so that e.g. | ||
// region map is able to get its configuration. | ||
server.injectUiAppVars('visualize_embedding', async () => { | ||
return await server.getInjectedUiAppVars('kibana'); | ||
}); | ||
} | ||
}); | ||
} |
4 changes: 4 additions & 0 deletions
4
test/plugin_functional/plugins/visualize_embedding/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "visualize_embedding", | ||
"version": "kibana" | ||
} |
Oops, something went wrong.