adding large_string_test (#17312)

* adding large_string_test

* removed a failing test, modified the existing one

* new line at the end of mappings.json

* removed the data.json file and also removed the navigateTo() and clickKibanaIndices() as createIndexPattern() takes care of it

* more modifications
This commit is contained in:
Rashmi Kulkarni 2018-03-23 10:48:51 -07:00 committed by GitHub
parent 64ea452a0c
commit 5ef60e09fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 90 additions and 0 deletions

View file

@ -0,0 +1,62 @@
import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const esArchiver = getService('esArchiver');
const log = getService('log');
const retry = getService('retry');
const PageObjects = getPageObjects(['common', 'home', 'settings', 'discover']);
describe('test large strings', function () {
before(async function () {
await esArchiver.load('empty_kibana');
await esArchiver.loadIfNeeded('hamlet');
await PageObjects.settings.createIndexPattern('testlargestring', null);
});
it('verify the large string book present', async function () {
const ExpectedDoc =
'mybook:Project Gutenberg EBook of Hamlet, by William Shakespeare'
+ ' This eBook is for the use of anyone anywhere in the United States'
+ ' and most other parts of the world at no cost and with almost no restrictions whatsoever.'
+ ' You may copy it, give it away or re-use it under the terms of the'
+ ' Project Gutenberg License included with this eBook or online at www.gutenberg.org.'
+ ' If you are not located in the United States,'
+ ' youll have to check the laws of the country where you are'
+ ' located before using this ebook.'
+ ' Title: Hamlet Author: William Shakespeare Release Date: November 1998 [EBook #1524]'
+ ' Last Updated: December 30, 2017 Language: English Character set encoding:';
let rowData;
await PageObjects.common.navigateToApp('discover');
await retry.try(async function tryingForTime() {
rowData = await PageObjects.discover.getDocTableIndex(1);
log.debug('rowData.length=' + rowData.length);
expect(rowData.substring(0, 200)).to.be(ExpectedDoc.substring(0, 200));
});
});
describe('test large data', function () {
it('search Newsletter should show the correct hit count', async function () {
const expectedHitCount = '1';
await PageObjects.discover.query('Newsletter');
await retry.try(async function tryingForTime() {
const hitCount = await PageObjects.discover.getHitCount();
expect(hitCount).to.be(expectedHitCount);
log.debug('test Newsletter keyword is searched');
});
});
it('the search term Newsletter should be highlighted in the field data', async function () {
// marks is the style that highlights the text in yellow
const marks = await PageObjects.discover.getMarks();
expect(marks.length).to.be(1);
log.debug('Newsletter appears only once');
});
});
after(async () => {
await esArchiver.unload('hamlet');
});
});
}

View file

@ -17,5 +17,6 @@ export default function ({ getService, loadTestFile }) {
loadTestFile(require.resolve('./_shared_links'));
loadTestFile(require.resolve('./_collapse_expand'));
loadTestFile(require.resolve('./_source_filters'));
loadTestFile(require.resolve('./_large_string'));
});
}

View file

@ -0,0 +1,27 @@
{
"type": "index",
"value": {
"index": "testlargestring",
"settings": {
"index": {
"number_of_shards": "5",
"number_of_replicas": "1"
}
},
"mappings": {
"test": {
"properties": {
"mybook": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}