|
| 1 | +/* |
| 2 | + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one |
| 3 | + * or more contributor license agreements. Licensed under the Elastic License; |
| 4 | + * you may not use this file except in compliance with the Elastic License. |
| 5 | + */ |
| 6 | + |
| 7 | +import expect from '@kbn/expect'; |
| 8 | + |
| 9 | +export default function ({ getPageObjects, getService }) { |
| 10 | + const PageObjects = getPageObjects(['maps']); |
| 11 | + const inspector = getService('inspector'); |
| 12 | + const testSubjects = getService('testSubjects'); |
| 13 | + const log = getService('log'); |
| 14 | + |
| 15 | + describe('docvalue_fields', () => { |
| 16 | + before(async () => { |
| 17 | + await PageObjects.maps.loadSavedMap('document example'); |
| 18 | + }); |
| 19 | + |
| 20 | + async function getResponse() { |
| 21 | + await inspector.open(); |
| 22 | + await inspector.openInspectorRequestsView(); |
| 23 | + await testSubjects.click('inspectorRequestDetailResponse'); |
| 24 | + const responseBody = await testSubjects.getVisibleText('inspectorResponseBody'); |
| 25 | + log.info(responseBody); |
| 26 | + await inspector.close(); |
| 27 | + return JSON.parse(responseBody); |
| 28 | + } |
| 29 | + |
| 30 | + it('should only fetch geo_point field and nothing else when source does not have data driven styling', async () => { |
| 31 | + await PageObjects.maps.loadSavedMap('document example'); |
| 32 | + const response = await getResponse(); |
| 33 | + const firstHit = response.hits.hits[0]; |
| 34 | + expect(Object.keys(firstHit).join(',')).to.equal('_index,_type,_id,_score,fields'); |
| 35 | + expect(Object.keys(firstHit.fields).join(',')).to.equal('geo.coordinates'); |
| 36 | + }); |
| 37 | + |
| 38 | + it('should only fetch geo_point field and data driven styling fields', async () => { |
| 39 | + await PageObjects.maps.loadSavedMap('document example with data driven styles'); |
| 40 | + const response = await getResponse(); |
| 41 | + const firstHit = response.hits.hits[0]; |
| 42 | + expect(Object.keys(firstHit).join(',')).to.equal('_index,_type,_id,_score,fields'); |
| 43 | + expect(Object.keys(firstHit.fields).join(',')).to.equal('geo.coordinates,bytes,hour_of_day'); |
| 44 | + }); |
| 45 | + |
| 46 | + }); |
| 47 | +} |
0 commit comments