mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Corey Robertson <corey.robertson@elastic.co>
This commit is contained in:
parent
4ac00f95c8
commit
9b7145f3e9
3 changed files with 414 additions and 0 deletions
|
@ -29,5 +29,6 @@ export default function canvasApp({ loadTestFile, getService }) {
|
|||
loadTestFile(require.resolve('./feature_controls/canvas_spaces'));
|
||||
loadTestFile(require.resolve('./lens'));
|
||||
loadTestFile(require.resolve('./reports'));
|
||||
loadTestFile(require.resolve('./saved_object_resolve'));
|
||||
});
|
||||
}
|
||||
|
|
131
x-pack/test/functional/apps/canvas/saved_object_resolve.ts
Normal file
131
x-pack/test/functional/apps/canvas/saved_object_resolve.ts
Normal file
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||
|
||||
export default function canvasFiltersTest({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const testSubjects = getService('testSubjects');
|
||||
const retry = getService('retry');
|
||||
const PageObjects = getPageObjects(['canvas', 'common']);
|
||||
const find = getService('find');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const spacesService = getService('spaces');
|
||||
const archive = 'x-pack/test/functional/fixtures/kbn_archiver/canvas/saved_object_resolve';
|
||||
const browser = getService('browser');
|
||||
|
||||
describe('filters', function () {
|
||||
// there is an issue with FF not properly clicking on workpad elements
|
||||
this.tags('skipFirefox');
|
||||
|
||||
before(async () => {
|
||||
await spacesService.create({
|
||||
id: 'custom_space',
|
||||
name: 'custom_space',
|
||||
disabledFeatures: [],
|
||||
});
|
||||
|
||||
await kibanaServer.importExport.load(archive, { space: 'custom_space' });
|
||||
|
||||
// Create alias match
|
||||
await kibanaServer.savedObjects.create({
|
||||
type: 'legacy-url-alias',
|
||||
id: 'custom_space:canvas-workpad:workpad-1705f884-6224-47de-ba49-ca224fe6ec31-old-id',
|
||||
overwrite: true,
|
||||
attributes: {
|
||||
targetType: 'canvas-workpad',
|
||||
targetId: 'workpad-1705f884-6224-47de-ba49-ca224fe6ec31-new-id',
|
||||
targetNamespace: 'custom_space',
|
||||
sourceId: 'workpad-1705f884-6224-47de-ba49-ca224fe6ec31-old-id',
|
||||
},
|
||||
references: [],
|
||||
});
|
||||
|
||||
// Create conflict match
|
||||
await kibanaServer.savedObjects.create({
|
||||
type: 'legacy-url-alias',
|
||||
id: 'custom_space:canvas-workpad:workpad-1705f884-6224-47de-ba49-ca224fe6ec31-conflict-old',
|
||||
overwrite: true,
|
||||
attributes: {
|
||||
targetType: 'canvas-workpad',
|
||||
targetId: 'workpad-1705f884-6224-47de-ba49-ca224fe6ec31-conflict-new',
|
||||
targetNamespace: 'custom_space',
|
||||
sourceId: 'workpad-1705f884-6224-47de-ba49-ca224fe6ec31-conflict-old',
|
||||
},
|
||||
references: [],
|
||||
});
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await kibanaServer.savedObjects.bulkDelete({
|
||||
objects: [
|
||||
{
|
||||
type: 'legacy-url-alias',
|
||||
id: 'custom_space:canvas-workpad:workpad-1705f884-6224-47de-ba49-ca224fe6ec31-old-id',
|
||||
},
|
||||
{
|
||||
type: 'legacy-url-alias',
|
||||
id: 'custom_space:canvas-workpad:workpad-1705f884-6224-47de-ba49-ca224fe6ec31-conflict-old',
|
||||
},
|
||||
],
|
||||
});
|
||||
await kibanaServer.importExport.unload(archive, { space: 'custom_space' });
|
||||
await spacesService.delete('custom_space');
|
||||
});
|
||||
|
||||
it('redirects an alias match', async () => {
|
||||
await PageObjects.common.navigateToApp('canvas', {
|
||||
basePath: '/s/custom_space',
|
||||
hash: '/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31-old-id/page/1',
|
||||
});
|
||||
|
||||
// Wait for the redirect toast
|
||||
await retry.try(async () => {
|
||||
const text = await (
|
||||
await find.byCssSelector('.euiGlobalToastList .euiToast .euiText')
|
||||
).getVisibleText();
|
||||
|
||||
expect(text.includes("The Workpad you're looking for has a new location.")).to.be(true);
|
||||
});
|
||||
|
||||
const currentUrl = await browser.getCurrentUrl();
|
||||
|
||||
expect(
|
||||
currentUrl.includes('/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31-new-id')
|
||||
).to.be(true);
|
||||
|
||||
await retry.try(async () => {
|
||||
const elements = await testSubjects.findAll(
|
||||
'canvasWorkpadPage > canvasWorkpadPageElementContent'
|
||||
);
|
||||
expect(elements).to.have.length(4);
|
||||
});
|
||||
});
|
||||
|
||||
it('handles a conflict match', async () => {
|
||||
await PageObjects.common.navigateToApp('canvas', {
|
||||
basePath: '/s/custom_space',
|
||||
hash: '/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31-conflict-old/page/1',
|
||||
});
|
||||
|
||||
await testSubjects.click('legacy-url-conflict-go-to-other-button');
|
||||
|
||||
const currentUrl = await browser.getCurrentUrl();
|
||||
expect(
|
||||
currentUrl.includes('/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31-conflict-new')
|
||||
).to.be(true);
|
||||
|
||||
// Conflict workpad has no elements, so let's make sure the new one is rendered with it's elements
|
||||
await retry.try(async () => {
|
||||
const elements = await testSubjects.findAll(
|
||||
'canvasWorkpadPage > canvasWorkpadPageElementContent'
|
||||
);
|
||||
expect(elements).to.have.length(4);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
|
@ -0,0 +1,282 @@
|
|||
{
|
||||
"attributes": {
|
||||
"@created": "2018-11-19T19:17:12.646Z",
|
||||
"@timestamp": "2018-11-19T19:36:28.499Z",
|
||||
"assets": {},
|
||||
"colors": [
|
||||
"#37988d",
|
||||
"#c19628",
|
||||
"#b83c6f",
|
||||
"#3f9939",
|
||||
"#1785b0",
|
||||
"#ca5f35",
|
||||
"#45bdb0",
|
||||
"#f2bc33",
|
||||
"#e74b8b",
|
||||
"#4fbf48",
|
||||
"#1ea6dc",
|
||||
"#fd7643",
|
||||
"#72cec3",
|
||||
"#f5cc5d",
|
||||
"#ec77a8",
|
||||
"#7acf74",
|
||||
"#4cbce4",
|
||||
"#fd986f",
|
||||
"#a1ded7",
|
||||
"#f8dd91",
|
||||
"#f2a4c5",
|
||||
"#a6dfa2",
|
||||
"#86d2ed",
|
||||
"#fdba9f",
|
||||
"#000000",
|
||||
"#444444",
|
||||
"#777777",
|
||||
"#BBBBBB",
|
||||
"#FFFFFF",
|
||||
"rgba(255,255,255,0)"
|
||||
],
|
||||
"height": 920,
|
||||
"isWriteable": true,
|
||||
"name": "Alias Match Workpad",
|
||||
"page": 0,
|
||||
"pages": [
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"expression": "markdown \n \"### Welcome to Canvas\n\nEnjoy your stay!\n\n- Green: Markdown, Browser function\n- Blue: SQL, Server function\n- Pink: CSV, Common function\n- Orange: Timelion, Server function\"\n| render \n containerStyle={containerStyle padding=\"8px\" opacity=\"1\" backgroundColor=\"#7acf74\"}",
|
||||
"id": "element-8f64a10a-01f3-4a71-a682-5b627cbe4d0e",
|
||||
"position": {
|
||||
"angle": 0,
|
||||
"height": 238,
|
||||
"left": 33.5,
|
||||
"top": 20,
|
||||
"width": 338
|
||||
}
|
||||
},
|
||||
{
|
||||
"expression": "filters\n| essql query=\"SELECT extension,bytes FROM \\\"logstash*\\\" LIMIT 10\"\n| table\n| render \n containerStyle={containerStyle padding=\"4px\" opacity=\"0.7\" backgroundColor=\"#4cbce4\"}",
|
||||
"id": "element-d3bf91e2-7e8c-4884-942e-d4e9006aef09",
|
||||
"position": {
|
||||
"angle": 0,
|
||||
"height": 345,
|
||||
"left": 439,
|
||||
"top": 20,
|
||||
"width": 367
|
||||
}
|
||||
},
|
||||
{
|
||||
"expression": "csv \"desc,price\nred fish,100\nblue fish,200\"\n| render \n containerStyle={containerStyle backgroundColor=\"#ec77a8\" padding=\"4px\" opacity=\"0.7\"}",
|
||||
"id": "element-223fe2b3-ffb4-4070-ae61-3e06b8052abb",
|
||||
"position": {
|
||||
"angle": 0,
|
||||
"height": 132,
|
||||
"left": 25,
|
||||
"top": 390,
|
||||
"width": 207
|
||||
}
|
||||
},
|
||||
{
|
||||
"expression": "filters\n| timelion query=\".es(index=logstash*,q=extension:jpg)\" interval=\"1M\" from=\"2017-01-01\" to=\"2017-12-31\"\n| table perPage=200\n| render containerStyle={containerStyle backgroundColor=\"#fd986f\" opacity=\"0.7\"}",
|
||||
"id": "element-3c905696-8258-4e9c-ab58-89018681f79f",
|
||||
"position": {
|
||||
"angle": 0,
|
||||
"height": 397,
|
||||
"left": 263.5,
|
||||
"top": 390,
|
||||
"width": 533
|
||||
}
|
||||
}
|
||||
],
|
||||
"id": "page-c38cd459-10fe-45f9-847b-2cbd7ec74319",
|
||||
"style": {
|
||||
"background": "#fff"
|
||||
},
|
||||
"transition": {}
|
||||
}
|
||||
],
|
||||
"width": 840
|
||||
},
|
||||
"coreMigrationVersion": "7.15.0",
|
||||
"id": "workpad-1705f884-6224-47de-ba49-ca224fe6ec31-new-id",
|
||||
"migrationVersion": {
|
||||
"canvas-workpad": "7.0.0"
|
||||
},
|
||||
"references": [],
|
||||
"type": "canvas-workpad",
|
||||
"updated_at": "2018-11-19T19:36:28.511Z",
|
||||
"version": "WzUsMl0="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"@created": "2018-11-19T19:17:12.646Z",
|
||||
"@timestamp": "2018-11-19T19:36:28.499Z",
|
||||
"assets": {},
|
||||
"colors": [
|
||||
"#37988d",
|
||||
"#c19628",
|
||||
"#b83c6f",
|
||||
"#3f9939",
|
||||
"#1785b0",
|
||||
"#ca5f35",
|
||||
"#45bdb0",
|
||||
"#f2bc33",
|
||||
"#e74b8b",
|
||||
"#4fbf48",
|
||||
"#1ea6dc",
|
||||
"#fd7643",
|
||||
"#72cec3",
|
||||
"#f5cc5d",
|
||||
"#ec77a8",
|
||||
"#7acf74",
|
||||
"#4cbce4",
|
||||
"#fd986f",
|
||||
"#a1ded7",
|
||||
"#f8dd91",
|
||||
"#f2a4c5",
|
||||
"#a6dfa2",
|
||||
"#86d2ed",
|
||||
"#fdba9f",
|
||||
"#000000",
|
||||
"#444444",
|
||||
"#777777",
|
||||
"#BBBBBB",
|
||||
"#FFFFFF",
|
||||
"rgba(255,255,255,0)"
|
||||
],
|
||||
"height": 920,
|
||||
"isWriteable": true,
|
||||
"name": "Conflict Alternate Workpad",
|
||||
"page": 0,
|
||||
"pages": [
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"expression": "markdown \n \"### Welcome to Canvas\n\nEnjoy your stay!\n\n- Green: Markdown, Browser function\n- Blue: SQL, Server function\n- Pink: CSV, Common function\n- Orange: Timelion, Server function\"\n| render \n containerStyle={containerStyle padding=\"8px\" opacity=\"1\" backgroundColor=\"#7acf74\"}",
|
||||
"id": "element-8f64a10a-01f3-4a71-a682-5b627cbe4d0e",
|
||||
"position": {
|
||||
"angle": 0,
|
||||
"height": 238,
|
||||
"left": 33.5,
|
||||
"top": 20,
|
||||
"width": 338
|
||||
}
|
||||
},
|
||||
{
|
||||
"expression": "filters\n| essql query=\"SELECT extension,bytes FROM \\\"logstash*\\\" LIMIT 10\"\n| table\n| render \n containerStyle={containerStyle padding=\"4px\" opacity=\"0.7\" backgroundColor=\"#4cbce4\"}",
|
||||
"id": "element-d3bf91e2-7e8c-4884-942e-d4e9006aef09",
|
||||
"position": {
|
||||
"angle": 0,
|
||||
"height": 345,
|
||||
"left": 439,
|
||||
"top": 20,
|
||||
"width": 367
|
||||
}
|
||||
},
|
||||
{
|
||||
"expression": "csv \"desc,price\nred fish,100\nblue fish,200\"\n| render \n containerStyle={containerStyle backgroundColor=\"#ec77a8\" padding=\"4px\" opacity=\"0.7\"}",
|
||||
"id": "element-223fe2b3-ffb4-4070-ae61-3e06b8052abb",
|
||||
"position": {
|
||||
"angle": 0,
|
||||
"height": 132,
|
||||
"left": 25,
|
||||
"top": 390,
|
||||
"width": 207
|
||||
}
|
||||
},
|
||||
{
|
||||
"expression": "filters\n| timelion query=\".es(index=logstash*,q=extension:jpg)\" interval=\"1M\" from=\"2017-01-01\" to=\"2017-12-31\"\n| table perPage=200\n| render containerStyle={containerStyle backgroundColor=\"#fd986f\" opacity=\"0.7\"}",
|
||||
"id": "element-3c905696-8258-4e9c-ab58-89018681f79f",
|
||||
"position": {
|
||||
"angle": 0,
|
||||
"height": 397,
|
||||
"left": 263.5,
|
||||
"top": 390,
|
||||
"width": 533
|
||||
}
|
||||
}
|
||||
],
|
||||
"id": "page-c38cd459-10fe-45f9-847b-2cbd7ec74319",
|
||||
"style": {
|
||||
"background": "#fff"
|
||||
},
|
||||
"transition": {}
|
||||
}
|
||||
],
|
||||
"width": 840
|
||||
},
|
||||
"coreMigrationVersion": "7.15.0",
|
||||
"id": "workpad-1705f884-6224-47de-ba49-ca224fe6ec31-conflict-new",
|
||||
"migrationVersion": {
|
||||
"canvas-workpad": "7.0.0"
|
||||
},
|
||||
"references": [],
|
||||
"type": "canvas-workpad",
|
||||
"updated_at": "2018-11-19T19:36:28.511Z",
|
||||
"version": "WzUsMl0="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"@created": "2018-11-19T19:17:12.646Z",
|
||||
"@timestamp": "2018-11-19T19:36:28.499Z",
|
||||
"assets": {},
|
||||
"colors": [
|
||||
"#37988d",
|
||||
"#c19628",
|
||||
"#b83c6f",
|
||||
"#3f9939",
|
||||
"#1785b0",
|
||||
"#ca5f35",
|
||||
"#45bdb0",
|
||||
"#f2bc33",
|
||||
"#e74b8b",
|
||||
"#4fbf48",
|
||||
"#1ea6dc",
|
||||
"#fd7643",
|
||||
"#72cec3",
|
||||
"#f5cc5d",
|
||||
"#ec77a8",
|
||||
"#7acf74",
|
||||
"#4cbce4",
|
||||
"#fd986f",
|
||||
"#a1ded7",
|
||||
"#f8dd91",
|
||||
"#f2a4c5",
|
||||
"#a6dfa2",
|
||||
"#86d2ed",
|
||||
"#fdba9f",
|
||||
"#000000",
|
||||
"#444444",
|
||||
"#777777",
|
||||
"#BBBBBB",
|
||||
"#FFFFFF",
|
||||
"rgba(255,255,255,0)"
|
||||
],
|
||||
"height": 920,
|
||||
"isWriteable": true,
|
||||
"name": "Conflict Match Workpad",
|
||||
"page": 0,
|
||||
"pages": [
|
||||
{
|
||||
"elements": [
|
||||
],
|
||||
"id": "page-c38cd459-10fe-45f9-847b-2cbd7ec74319",
|
||||
"style": {
|
||||
"background": "#fff"
|
||||
},
|
||||
"transition": {}
|
||||
}
|
||||
],
|
||||
"width": 840
|
||||
},
|
||||
"coreMigrationVersion": "7.15.0",
|
||||
"id": "workpad-1705f884-6224-47de-ba49-ca224fe6ec31-conflict-old",
|
||||
"migrationVersion": {
|
||||
"canvas-workpad": "7.0.0"
|
||||
},
|
||||
"references": [],
|
||||
"type": "canvas-workpad",
|
||||
"updated_at": "2018-11-19T19:36:28.511Z",
|
||||
"version": "WzUsMl0="
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue