Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await esArchiver.loadIfNeeded(
'test/functional/fixtures/es_archiver/index_pattern_without_timefield'
);
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
await kibanaServer.importExport.load(
'test/functional/fixtures/kbn_archiver/index_pattern_without_timefield'
);
await kibanaServer.uiSettings.replace({
defaultIndex: 'without-timefield',
'timepicker:timeDefaults': '{ "from": "2019-01-18T19:37:13.000Z", "to": "now"}',
Expand All @@ -37,6 +41,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await esArchiver.unload(
'test/functional/fixtures/es_archiver/index_pattern_without_timefield'
);
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
});

it('should not display a timepicker', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
{
"type": "doc",
"value": {
"id": "index-pattern:without-timefield",
"index": ".kibana",
"source": {
"index-pattern": {
"fields": "[]",
"title": "without-timefield"
},
"type": "index-pattern"
}
}
}

{
"type": "doc",
"value": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"attributes": {
"fields": "[]",
"timeFieldName": "@timestamp",
"title": "with-timefield"
},
"coreMigrationVersion": "7.17.1",
"id": "with-timefield",
"migrationVersion": {
"index-pattern": "7.11.0"
},
"references": [],
"type": "index-pattern",
"version": "WzEzLDJd"
}

{
"attributes": {
"fields": "[]",
"title": "without-timefield"
},
"coreMigrationVersion": "7.17.1",
"id": "without-timefield",
"migrationVersion": {
"index-pattern": "7.11.0"
},
"references": [],
"type": "index-pattern",
"version": "WzEyLDJd"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@ import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const queryBar = getService('queryBar');
const PageObjects = getPageObjects(['common', 'settings', 'context', 'header']);
const kibanaServer = getService('kibanaServer');

describe('value suggestions non time based', function describeIndexTests() {
before(async function () {
await esArchiver.loadIfNeeded(
'test/functional/fixtures/es_archiver/index_pattern_without_timefield'
);
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
await kibanaServer.importExport.load(
'test/functional/fixtures/kbn_archiver/index_pattern_without_timefield'
);
await kibanaServer.uiSettings.replace({ defaultIndex: 'without-timefield' });
Copy link
Copy Markdown
Author

@LeeDr LeeDr Feb 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you can see in test/functional/fixtures/kbn_archiver/index_pattern_without_timefield.json there are actually two index patterns in that archive with-timefield and without-timefield. The previous test runs failed because the with-timefield index pattern ended up being the default one in Discover. I added code here to set the default to the one the test needs (it's faster than having the test select it in the UI).

await kibanaServer.uiSettings.update({
'doc_table:legacy': true,
});
Expand All @@ -27,6 +32,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await esArchiver.unload(
'test/functional/fixtures/es_archiver/index_pattern_without_timefield'
);
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
await kibanaServer.uiSettings.unset('defaultIndex');
await kibanaServer.uiSettings.unset('doc_table:legacy');
});

Expand Down