mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 03:01:21 -04:00
[Search] enable fun-ctional tests (#97398)
* only fun-ctional * fix functional tests * tests * Type
This commit is contained in:
parent
1bc7e5462f
commit
4c45ae0645
3 changed files with 57 additions and 16 deletions
|
@ -195,7 +195,7 @@ export const SearchExamplesApp = ({
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const doSearchSourceSearch = async () => {
|
const doSearchSourceSearch = async (otherBucket: boolean) => {
|
||||||
if (!indexPattern) return;
|
if (!indexPattern) return;
|
||||||
|
|
||||||
const query = data.query.queryString.getQuery();
|
const query = data.query.queryString.getQuery();
|
||||||
|
@ -221,7 +221,7 @@ export const SearchExamplesApp = ({
|
||||||
aggDef.push({
|
aggDef.push({
|
||||||
type: 'terms',
|
type: 'terms',
|
||||||
schema: 'split',
|
schema: 'split',
|
||||||
params: { field: selectedBucketField.name, size: 2, otherBucket: true },
|
params: { field: selectedBucketField.name, size: 2, otherBucket },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (selectedNumericField) {
|
if (selectedNumericField) {
|
||||||
|
@ -280,8 +280,8 @@ export const SearchExamplesApp = ({
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSearchSourceClickHandler = () => {
|
const onSearchSourceClickHandler = (withOtherBucket: boolean) => {
|
||||||
doSearchSourceSearch();
|
doSearchSourceSearch(withOtherBucket);
|
||||||
};
|
};
|
||||||
|
|
||||||
const reqTabs = [
|
const reqTabs = [
|
||||||
|
@ -367,6 +367,7 @@ export const SearchExamplesApp = ({
|
||||||
setIndexPattern(newIndexPattern);
|
setIndexPattern(newIndexPattern);
|
||||||
}}
|
}}
|
||||||
isClearable={false}
|
isClearable={false}
|
||||||
|
data-test-subj="indexPatternSelector"
|
||||||
/>
|
/>
|
||||||
</EuiFlexItem>
|
</EuiFlexItem>
|
||||||
<EuiFlexItem>
|
<EuiFlexItem>
|
||||||
|
@ -449,7 +450,7 @@ export const SearchExamplesApp = ({
|
||||||
</EuiText>
|
</EuiText>
|
||||||
<EuiButtonEmpty
|
<EuiButtonEmpty
|
||||||
size="xs"
|
size="xs"
|
||||||
onClick={onSearchSourceClickHandler}
|
onClick={() => onSearchSourceClickHandler(true)}
|
||||||
iconType="play"
|
iconType="play"
|
||||||
data-test-subj="searchSourceWithOther"
|
data-test-subj="searchSourceWithOther"
|
||||||
>
|
>
|
||||||
|
@ -464,6 +465,23 @@ export const SearchExamplesApp = ({
|
||||||
defaultMessage="Bucket and metrics aggregations with other bucket."
|
defaultMessage="Bucket and metrics aggregations with other bucket."
|
||||||
/>
|
/>
|
||||||
</EuiText>
|
</EuiText>
|
||||||
|
<EuiButtonEmpty
|
||||||
|
size="xs"
|
||||||
|
onClick={() => onSearchSourceClickHandler(false)}
|
||||||
|
iconType="play"
|
||||||
|
data-test-subj="searchSourceWithoutOther"
|
||||||
|
>
|
||||||
|
<FormattedMessage
|
||||||
|
id="searchExamples.searchSource.buttonText"
|
||||||
|
defaultMessage="Request from high-level client (data.search.searchSource)"
|
||||||
|
/>
|
||||||
|
</EuiButtonEmpty>
|
||||||
|
<EuiText size="xs" color="subdued" className="searchExampleStepDsc">
|
||||||
|
<FormattedMessage
|
||||||
|
id="searchExamples.buttonText"
|
||||||
|
defaultMessage="Bucket and metrics aggregations without other bucket."
|
||||||
|
/>
|
||||||
|
</EuiText>
|
||||||
</EuiText>
|
</EuiText>
|
||||||
<EuiSpacer />
|
<EuiSpacer />
|
||||||
<EuiTitle size="s">
|
<EuiTitle size="s">
|
||||||
|
|
|
@ -12,26 +12,45 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||||
const testSubjects = getService('testSubjects');
|
const testSubjects = getService('testSubjects');
|
||||||
const PageObjects = getPageObjects(['common', 'timePicker']);
|
const PageObjects = getPageObjects(['common', 'timePicker']);
|
||||||
const retry = getService('retry');
|
const retry = getService('retry');
|
||||||
|
const comboBox = getService('comboBox');
|
||||||
|
|
||||||
describe.skip('Search session example', () => {
|
describe('Search session example', () => {
|
||||||
const appId = 'searchExamples';
|
const appId = 'searchExamples';
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
await PageObjects.common.navigateToApp(appId, { insertTimestamp: false });
|
await PageObjects.common.navigateToApp(appId, { insertTimestamp: false });
|
||||||
|
await comboBox.set('indexPatternSelector', 'logstash-*');
|
||||||
|
await comboBox.set('searchBucketField', 'geo.src');
|
||||||
|
await comboBox.set('searchMetricField', 'memory');
|
||||||
|
await PageObjects.timePicker.setAbsoluteRange(
|
||||||
|
'Mar 1, 2015 @ 00:00:00.000',
|
||||||
|
'Nov 1, 2015 @ 00:00:00.000'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have an other bucket', async () => {
|
it('should have an other bucket', async () => {
|
||||||
await PageObjects.timePicker.setAbsoluteRange(
|
|
||||||
'Jan 1, 2014 @ 00:00:00.000',
|
|
||||||
'Jan 1, 2016 @ 00:00:00.000'
|
|
||||||
);
|
|
||||||
await testSubjects.click('searchSourceWithOther');
|
await testSubjects.click('searchSourceWithOther');
|
||||||
|
await testSubjects.click('responseTab');
|
||||||
await retry.waitFor('has other bucket', async () => {
|
const codeBlock = await testSubjects.find('responseCodeBlock');
|
||||||
await testSubjects.click('responseTab');
|
await retry.waitFor('get code block', async () => {
|
||||||
const codeBlock = await testSubjects.find('responseCodeBlock');
|
|
||||||
const visibleText = await codeBlock.getVisibleText();
|
const visibleText = await codeBlock.getVisibleText();
|
||||||
return visibleText.indexOf('__other__') > -1;
|
const parsedResponse = JSON.parse(visibleText);
|
||||||
|
const buckets = parsedResponse.aggregations[1].buckets;
|
||||||
|
return (
|
||||||
|
buckets.length === 3 && buckets[2].key === '__other__' && buckets[2].doc_count === 9039
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not have an other bucket', async () => {
|
||||||
|
await testSubjects.click('searchSourceWithoutOther');
|
||||||
|
await testSubjects.click('responseTab');
|
||||||
|
const codeBlock = await testSubjects.find('responseCodeBlock');
|
||||||
|
await retry.waitFor('get code block', async () => {
|
||||||
|
const visibleText = await codeBlock.getVisibleText();
|
||||||
|
const parsedResponse = JSON.parse(visibleText);
|
||||||
|
const buckets = parsedResponse.aggregations[1].buckets;
|
||||||
|
return buckets.length === 2;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,6 +14,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||||
const PageObjects = getPageObjects(['common']);
|
const PageObjects = getPageObjects(['common']);
|
||||||
const toasts = getService('toasts');
|
const toasts = getService('toasts');
|
||||||
const retry = getService('retry');
|
const retry = getService('retry');
|
||||||
|
const comboBox = getService('comboBox');
|
||||||
|
|
||||||
async function getExecutedAt() {
|
async function getExecutedAt() {
|
||||||
const toast = await toasts.getToastElement(1);
|
const toast = await toasts.getToastElement(1);
|
||||||
|
@ -26,11 +27,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
describe.skip('Search session client side cache', () => {
|
describe('Search session client side cache', () => {
|
||||||
const appId = 'searchExamples';
|
const appId = 'searchExamples';
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
await PageObjects.common.navigateToApp(appId, { insertTimestamp: false });
|
await PageObjects.common.navigateToApp(appId, { insertTimestamp: false });
|
||||||
|
await comboBox.set('indexPatternSelector', 'logstash-*');
|
||||||
|
await comboBox.set('searchBucketField', 'extension.raw');
|
||||||
|
await comboBox.set('searchMetricField', 'phpmemory');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should cache responses by search session id', async () => {
|
it('should cache responses by search session id', async () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue