Advanced JSON input functional test (#88609) (#89123)

* Advanced JSON input functional test

* Replace string check with object property check

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Diana Derevyankina 2021-01-25 19:58:28 +03:00 committed by GitHub
parent 5daae0b0c0
commit 77e3f33b3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,12 +6,15 @@
* Public License, v 1.
*/
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const log = getService('log');
const inspector = getService('inspector');
const filterBar = getService('filterBar');
const testSubjects = getService('testSubjects');
const PageObjects = getPageObjects(['visualize', 'visEditor', 'visChart', 'timePicker']);
describe('inspector', function describeIndexTests() {
@ -23,6 +26,34 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.timePicker.setDefaultAbsoluteRange();
});
describe('advanced input JSON', () => {
it('should have "missing" property with value 10', async () => {
log.debug('Add Max Metric on memory field');
await PageObjects.visEditor.clickBucket('Y-axis', 'metrics');
await PageObjects.visEditor.selectAggregation('Max', 'metrics');
await PageObjects.visEditor.selectField('memory', 'metrics');
log.debug('Add value to advanced JSON input');
await PageObjects.visEditor.toggleAdvancedParams('2');
await testSubjects.setValue('codeEditorContainer', '{ "missing": 10 }');
await PageObjects.visEditor.clickGo();
await inspector.open();
await inspector.openInspectorRequestsView();
const requestTab = await inspector.getOpenRequestDetailRequestButton();
await requestTab.click();
const requestJSON = JSON.parse(await inspector.getCodeEditorValue());
expect(requestJSON.aggs['2'].max).property('missing', 10);
});
after(async () => {
await inspector.close();
await PageObjects.visEditor.removeDimension(2);
await PageObjects.visEditor.clickGo();
});
});
describe('inspector table', function indexPatternCreation() {
it('should update table header when columns change', async function () {
await inspector.open();