Skip to content

Commit

Permalink
Add functional test
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Jan 10, 2020
1 parent 58ef83d commit a944014
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 26 deletions.
57 changes: 57 additions & 0 deletions test/functional/apps/context/_date_nanos_custom_timestamp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* 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 '@kbn/expect';

const TEST_INDEX_PATTERN = 'date_nanos_custom_timestamp';
const TEST_DEFAULT_CONTEXT_SIZE = 1;
const TEST_STEP_SIZE = 3;

export default function({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const docTable = getService('docTable');
const PageObjects = getPageObjects(['common', 'context', 'timePicker', 'discover']);
const esArchiver = getService('esArchiver');

describe('context view for date_nanos with custom timestamp', () => {
before(async function() {
await esArchiver.loadIfNeeded('date_nanos_custom');
await kibanaServer.uiSettings.replace({ defaultIndex: TEST_INDEX_PATTERN });
await kibanaServer.uiSettings.update({
'context:defaultSize': `${TEST_DEFAULT_CONTEXT_SIZE}`,
'context:step': `${TEST_STEP_SIZE}`,
});
});

after(function unloadMakelogs() {
return esArchiver.unload('date_nanos_custom');
});

it('displays predessors - anchor - successors in right order ', async function() {
await PageObjects.context.navigateTo(TEST_INDEX_PATTERN, '1');
const actualRowsText = await docTable.getRowsText();
const expectedRowsText = [
'Oct 21, 2019 @ 08:30:04.828733000 -',
'Oct 21, 2019 @ 00:30:04.828740000 -',
'Oct 21, 2019 @ 00:30:04.828723000 -',
];
expect(actualRowsText).to.eql(expectedRowsText);
});
});
}
1 change: 1 addition & 0 deletions test/functional/apps/context/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ export default function({ getService, getPageObjects, loadTestFile }) {
loadTestFile(require.resolve('./_filters'));
loadTestFile(require.resolve('./_size'));
loadTestFile(require.resolve('./_date_nanos'));
loadTestFile(require.resolve('./_date_nanos_custom_timestamp'));
});
}
48 changes: 23 additions & 25 deletions test/functional/fixtures/es_archiver/date_nanos_custom/data.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,56 @@
{
"type": "doc",
"value": {
"id": "1",
"index": "date_nanos_test_custom_timestamp",
"id": "index-pattern:date_nanos_custom_timestamp",
"index": ".kibana",
"source": {
"test": "1",
"timestamp": "2019-10-12 00:30:04.828740"
"index-pattern": {
"fields": "[{\"name\":\"_id\",\"type\":\"string\",\"esTypes\":[\"_id\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"esTypes\":[\"_index\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"esTypes\":[\"_source\"],\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"esTypes\":[\"_type\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"test\",\"type\":\"string\",\"esTypes\":[\"text\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"test.keyword\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"test\"}}},{\"name\":\"timestamp\",\"type\":\"date\",\"esTypes\":[\"date_nanos\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]",
"timeFieldName": "timestamp",
"title": "date_nanos_custom_timestamp"
},
"references": [
],
"type": "index-pattern",
"updated_at": "2020-01-09T21:43:20.283Z"
}
}
}

{
"type": "doc",
"value": {
"id": "2",
"index": "date_nanos_test_custom_timestamp",
"id": "1",
"index": "date_nanos_custom_timestamp",
"source": {
"test": "1",
"timestamp": "2019-10-21 08:30:04.828733"
"timestamp": "2019-10-21 00:30:04.828740"
}
}
}

{
"type": "doc",
"value": {
"id": "3",
"index": "date_nanos_test_custom_timestamp",
"id": "2",
"index": "date_nanos_custom_timestamp",
"source": {
"test": "1",
"timestamp": "2019-10-21 00:30:04.828723"
"timestamp": "2019-10-21 08:30:04.828733"
}
}
}

{
"type": "doc",
"value": {
"id": "index-pattern:date_nanos_test_custom_timestamp",
"id": "index-pattern:0cd012a0-3329-11ea-8154-573d43fcd9ee",
"index": ".kibana_1",
"id": "3",
"index": "date_nanos_custom_timestamp",
"source": {
"index-pattern": {
"fields": "[{\"name\":\"_id\",\"type\":\"string\",\"esTypes\":[\"_id\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"esTypes\":[\"_index\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"esTypes\":[\"_source\"],\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"esTypes\":[\"_type\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"test\",\"type\":\"string\",\"esTypes\":[\"text\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"test.keyword\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"test\"}}},{\"name\":\"timestamp\",\"type\":\"date\",\"esTypes\":[\"date_nanos\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]",
"timeFieldName": "timestamp",
"title": "date_nanos_test_custom_timestamp"
},
"migrationVersion": {
"index-pattern": "7.6.0"
},
"references": [
],
"type": "index-pattern",
"updated_at": "2020-01-09T21:43:20.283Z"
"test": "1",
"timestamp": "2019-10-21 00:30:04.828723"
}
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"value": {
"aliases": {
},
"index": "date_nanos_test_custom_timestamp",
"index": "date_nanos_custom_timestamp",
"mappings": {
"properties": {
"test": {
Expand Down

0 comments on commit a944014

Please sign in to comment.