* replace kbnTimepicker directive with EuiSuperDatePicker * remove kbnTimepicker directive * remove bootstrap datepicker * Embed timepicker in query bar (#29130) * replace kbnTimepicker directive with EuiSuperDatePicker * remove kbnTimepicker directive * remove bootstrap datepicker * embed timepicker in query bar * flesh out date picker in query bar for maps app * wire up refresh config * fix bug with way update function called by watcher * get maps application functional tests working with new timepicker * update setAbsoluteRange for EuiSuperDatePicker * replace setQuickTime with calls to setAbsoluteTime * remove open time picker button in discover empty results view * pass config values to super-date-picker directive * remove getPrettyDuration * clean up typescript lint problems * some functional test fixes * try something else to fix I18n problems * fix some more functional tests * update query_bar jest test * remove unused method in kbn_global_timepicker * do not import removed timepicker styles * remove mode from time state * remove mode from time_history interface * fix problem with ui_settings_defaults * fix failing TSVB functional test * another round to test fixes * more functional test changes * fixes for failing tests * add retry block to flaky tsvb test * styles/bootstrap_dark.less * fix functional tests * call fetch event even when times are the same * add retry around flaky tsvb test * fix timefilter jest test, attempt to fix another flaky functional test * revert emitting fetch outside of areTimePickerValsDifferent check * clean up time mode code that is no longer needed in dashboard * fix timefilter tests changed by timefilter emit revert
110 lines
5 KiB
JavaScript
110 lines
5 KiB
JavaScript
/*
|
|
* 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.
|
|
*/
|
|
|
|
import expect from 'expect.js';
|
|
|
|
export default function ({ getPageObjects }) {
|
|
const PageObjects = getPageObjects(['common', 'timelion', 'settings', 'timePicker']);
|
|
|
|
describe('expression typeahead', () => {
|
|
before(async () => {
|
|
const fromTime = '2015-09-19 06:31:44.000';
|
|
const toTime = '2015-09-23 18:31:44.000';
|
|
|
|
await PageObjects.timelion.initTests();
|
|
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
|
|
});
|
|
|
|
it('should display function suggestions filtered by function name', async () => {
|
|
await PageObjects.timelion.setExpression('.e');
|
|
const suggestions = await PageObjects.timelion.getSuggestionItemsText();
|
|
expect(suggestions.length).to.eql(2);
|
|
expect(suggestions[0].includes('.elasticsearch()')).to.eql(true);
|
|
expect(suggestions[1].includes('.es()')).to.eql(true);
|
|
});
|
|
|
|
it('should show argument suggestions when function suggestion is selected', async () => {
|
|
await PageObjects.timelion.setExpression('.es');
|
|
await PageObjects.timelion.clickSuggestion();
|
|
const suggestions = await PageObjects.timelion.getSuggestionItemsText();
|
|
expect(suggestions.length).to.eql(9);
|
|
expect(suggestions[0].includes('fit=')).to.eql(true);
|
|
});
|
|
|
|
it('should show argument value suggestions when argument is selected', async () => {
|
|
await PageObjects.timelion.setExpression('.legend');
|
|
await PageObjects.timelion.clickSuggestion();
|
|
const argumentSuggestions = await PageObjects.timelion.getSuggestionItemsText();
|
|
expect(argumentSuggestions.length).to.eql(4);
|
|
expect(argumentSuggestions[1].includes('position=')).to.eql(true);
|
|
await PageObjects.timelion.clickSuggestion(1);
|
|
const valueSuggestions = await PageObjects.timelion.getSuggestionItemsText();
|
|
expect(valueSuggestions.length).to.eql(5);
|
|
expect(valueSuggestions[0].includes('disable legend')).to.eql(true);
|
|
expect(valueSuggestions[1].includes('place legend in north east corner')).to.eql(true);
|
|
});
|
|
|
|
describe('dynamic suggestions for argument values', () => {
|
|
describe('.es()', () => {
|
|
before(async () => {
|
|
await PageObjects.timelion.setExpression('.es');
|
|
await PageObjects.timelion.clickSuggestion();
|
|
});
|
|
|
|
it('should show index pattern suggestions for index argument', async () => {
|
|
await PageObjects.timelion.updateExpression('index');
|
|
await PageObjects.timelion.clickSuggestion();
|
|
const suggestions = await PageObjects.timelion.getSuggestionItemsText();
|
|
expect(suggestions.length).to.eql(1);
|
|
expect(suggestions[0].includes('logstash-*')).to.eql(true);
|
|
await PageObjects.timelion.clickSuggestion();
|
|
});
|
|
|
|
it('should show field suggestions for timefield argument when index pattern set', async () => {
|
|
await PageObjects.timelion.updateExpression(',timefield');
|
|
await PageObjects.timelion.clickSuggestion();
|
|
const suggestions = await PageObjects.timelion.getSuggestionItemsText();
|
|
expect(suggestions.length).to.eql(4);
|
|
expect(suggestions[0].includes('@timestamp')).to.eql(true);
|
|
await PageObjects.timelion.clickSuggestion();
|
|
});
|
|
|
|
it('should show field suggestions for split argument when index pattern set', async () => {
|
|
await PageObjects.timelion.updateExpression(',split');
|
|
await PageObjects.timelion.clickSuggestion();
|
|
const suggestions = await PageObjects.timelion.getSuggestionItemsText();
|
|
expect(suggestions.length).to.eql(52);
|
|
expect(suggestions[0].includes('@message.raw')).to.eql(true);
|
|
await PageObjects.timelion.clickSuggestion(10);
|
|
});
|
|
|
|
it('should show field suggestions for metric argument when index pattern set', async () => {
|
|
await PageObjects.timelion.updateExpression(',metric');
|
|
await PageObjects.timelion.clickSuggestion();
|
|
await PageObjects.timelion.updateExpression('avg:');
|
|
await PageObjects.timelion.clickSuggestion();
|
|
const suggestions = await PageObjects.timelion.getSuggestionItemsText();
|
|
expect(suggestions.length).to.eql(2);
|
|
expect(suggestions[0].includes('avg:bytes')).to.eql(true);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|