Skip to content

Commit

Permalink
ccs_discover additional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rashmivkulkarni committed Apr 7, 2021
1 parent 05f56dd commit 60cc994
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import expect from '@kbn/expect';

export default ({ getService, getPageObjects }) => {
describe('Cross cluster search test', async () => {
describe('Cross cluster search test in discover', async () => {
const PageObjects = getPageObjects([
'common',
'settings',
Expand All @@ -22,10 +22,12 @@ export default ({ getService, getPageObjects }) => {
const browser = getService('browser');
const appsMenu = getService('appsMenu');
const kibanaServer = getService('kibanaServer');
const queryBar = getService('queryBar');
const filterBar = getService('filterBar');

before(async () => {
await browser.setWindowSize(1200, 800);
// pincking relative time in timepicker isn't working. This is also faster.
// picking relative time in timepicker isn't working. This is also faster.
// It's the default set, plus new "makelogs" +/- 3 days from now
await kibanaServer.uiSettings.replace({
'timepicker:quickRanges': `[
Expand Down Expand Up @@ -172,5 +174,34 @@ export default ({ getService, getPageObjects }) => {
expect(hitCount).to.be('28,010');
});
});

it('should reload the saved search with persisted query to show the initial hit count', async function () {
await PageObjects.discover.selectIndexPattern('data:makelogs工程-*,local:makelogs工程-*');
// apply query some changes
await queryBar.setQuery('success');
await queryBar.submitQuery();
await retry.try(async () => {
const hitCountNumber = await PageObjects.discover.getHitCount();
const hitCount = parseInt(hitCountNumber.replace(/\,/g, ''));
log.debug('### hit count = ' + hitCount);
expect(hitCount).to.be.greaterThan(25000);
expect(hitCount).to.be.lessThan(28000);
});
});

it('should add a phrases filter', async function () {
await PageObjects.discover.selectIndexPattern('data:makelogs工程-*,local:makelogs工程-*');
const hitCountNumber = await PageObjects.discover.getHitCount();
const originalHitCount = parseInt(hitCountNumber.replace(/\,/g, ''));
await filterBar.addFilter('extension.keyword', 'is', 'jpg');
expect(await filterBar.hasFilter('extension.keyword', 'jpg')).to.be(true);
await retry.try(async () => {
const hitCountNumber = await PageObjects.discover.getHitCount();
const hitCount = parseInt(hitCountNumber.replace(/\,/g, ''));
log.debug('### hit count = ' + hitCount);
expect(hitCount).to.be.greaterThan(15000);
expect(hitCount).to.be.lessThan(originalHitCount);
});
});
});
};
2 changes: 1 addition & 1 deletion x-pack/test/stack_functional_integration/apps/ccs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

export default function ({ loadTestFile }) {
describe('ccs test', function () {
loadTestFile(require.resolve('./ccs'));
loadTestFile(require.resolve('./ccs_discover'));
});
}

0 comments on commit 60cc994

Please sign in to comment.