Skip to content

Commit

Permalink
Fix functional test for scripted field language filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Bargs committed Nov 9, 2017
1 parent 599e611 commit 71212d5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions test/functional/apps/management/_scripted_fields_filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@ export default function ({ getService, getPageObjects }) {
const retry = getService('retry');
const log = getService('log');
const remote = getService('remote');
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['settings']);

describe('filter scripted fields', function describeIndexTests() {

beforeEach(async function () {
await remote.setWindowSize(1200, 800);
before(async function () {
// delete .kibana index and then wait for Kibana to re-create it
await remote.setWindowSize(1200, 800);
await esArchiver.load('management');
await kibanaServer.uiSettings.replace({
'dateFormat:tz': 'UTC',
'defaultIndex': 'f1e4c910-a2e6-11e7-bb30-233be9be6a15'
});
});

after(async function () {
await esArchiver.unload('management');
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC' });
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaIndices();
await PageObjects.settings.createIndexPattern();
await kibanaServer.uiSettings.update({ 'dateFormat:tz': 'UTC' });
});

const scriptedExpressionFieldName = 'ram_expr1';
const scriptedPainlessFieldName = 'ram_pain1';

it('should filter scripted fields', async function () {
Expand All @@ -28,10 +32,9 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.settings.clickScriptedFieldsTab();
const scriptedFieldLangsBefore = await PageObjects.settings.getScriptedFieldLangs();
await log.debug('add scripted field');
await PageObjects.settings
.addScriptedField(scriptedExpressionFieldName,
'expression', 'number', null, '1', 'doc[\'machine.ram\'].value / (1024 * 1024 * 1024)'
);

// The expression scripted field has been pre-created in the management esArchiver pack since it is no longer
// possible to create an expression script via the UI
await PageObjects.settings
.addScriptedField(scriptedPainlessFieldName,
'painless', 'number', null, '1', 'doc[\'machine.ram\'].value / (1024 * 1024 * 1024)'
Expand All @@ -40,7 +43,7 @@ export default function ({ getService, getPageObjects }) {
// confirm two additional scripted fields were created
await retry.try(async function () {
const scriptedFieldLangs = await PageObjects.settings.getScriptedFieldLangs();
expect(scriptedFieldLangs.length).to.be(scriptedFieldLangsBefore.length + 2);
expect(scriptedFieldLangs.length).to.be(scriptedFieldLangsBefore.length + 1);
});

await PageObjects.settings.setScriptedFieldLanguageFilter('painless');
Expand Down
Binary file modified test/functional/fixtures/es_archiver/management/data.json.gz
Binary file not shown.

0 comments on commit 71212d5

Please sign in to comment.