Skip to content

Commit

Permalink
use real reference in dataset and assert against it.
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed May 15, 2020
1 parent c7f6304 commit d453272
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions test/functional/apps/saved_objects_management/edit_saved_object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('preserves the object references when saving', async () => {
const testVisualizationUrl =
'/management/kibana/objects/savedVisualizations/75c3e060-1e7c-11e9-8488-65449e65d0ed';
const visualizationRefs = [
{
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
id: 'logstash-*',
},
];

await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaSavedObjects();
Expand All @@ -136,7 +143,9 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {

await testSubjects.existOrFail('savedObjectEditSave');

let referencesValue = await getAceEditorFieldValue('references');
let displayedReferencesValue = await getAceEditorFieldValue('references');

expect(JSON.parse(displayedReferencesValue)).to.eql(visualizationRefs);

await focusAndClickButton('savedObjectEditSave');

Expand All @@ -145,9 +154,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToActualUrl('kibana', testVisualizationUrl);

// Parsing to avoid random keys ordering issues in raw string comparison
expect(JSON.parse(await getAceEditorFieldValue('references'))).to.eql(
JSON.parse(referencesValue)
);
expect(JSON.parse(await getAceEditorFieldValue('references'))).to.eql(visualizationRefs);

await setAceEditorFieldValue('references', JSON.stringify([], undefined, 2));

Expand All @@ -157,9 +164,9 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {

await PageObjects.common.navigateToActualUrl('kibana', testVisualizationUrl);

referencesValue = await getAceEditorFieldValue('references');
displayedReferencesValue = await getAceEditorFieldValue('references');

expect(JSON.parse(referencesValue)).to.eql([]);
expect(JSON.parse(displayedReferencesValue)).to.eql([]);
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
},
"references" : [
{
"name" : "control_0_index_pattern",
"name" : "kibanaSavedObjectMeta.searchSourceJSON.index",
"type" : "index-pattern",
"id" : "logstash-*"
}
Expand Down

0 comments on commit d453272

Please sign in to comment.