diff --git a/test/functional/apps/discover/group2/_indexpattern_without_timefield.ts b/test/functional/apps/discover/group2/_indexpattern_without_timefield.ts index 8fe192618f2ff..7b351633530de 100644 --- a/test/functional/apps/discover/group2/_indexpattern_without_timefield.ts +++ b/test/functional/apps/discover/group2/_indexpattern_without_timefield.ts @@ -129,5 +129,21 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.assertHitCount('1'); }); + + it('should allow switching from data views with different timefield and adjust sorting', async () => { + await PageObjects.common.navigateToApp('discover'); + await PageObjects.discover.selectIndexPattern('with-timefield'); + await PageObjects.header.waitUntilLoadingHasFinished(); + let url = await browser.getCurrentUrl(); + expect(url).to.contain(`@timestamp`); + + await PageObjects.discover.selectIndexPattern('with-different-timefield'); + await PageObjects.header.waitUntilLoadingHasFinished(); + url = await browser.getCurrentUrl(); + expect(url).to.contain(`with-different-timefield`); + browser.goBack(); + await PageObjects.header.waitUntilLoadingHasFinished(); + expect(url).to.contain(`@timestamp`); + }); }); } diff --git a/test/functional/config.base.js b/test/functional/config.base.js index aadaae3c8d81b..5e4d89d6c195b 100644 --- a/test/functional/config.base.js +++ b/test/functional/config.base.js @@ -391,7 +391,7 @@ export default async function ({ readConfigFile }) { cluster: [], indices: [ { - names: ['without-timefield', 'with-timefield'], + names: ['without-timefield', 'with-timefield', 'with-different-timefield'], privileges: ['read', 'view_index_metadata'], field_security: { grant: ['*'], except: [] }, }, diff --git a/test/functional/fixtures/es_archiver/index_pattern_without_timefield/data.json b/test/functional/fixtures/es_archiver/index_pattern_without_timefield/data.json index aea1bf770c18f..3bd71cfb198dd 100644 --- a/test/functional/fixtures/es_archiver/index_pattern_without_timefield/data.json +++ b/test/functional/fixtures/es_archiver/index_pattern_without_timefield/data.json @@ -31,3 +31,22 @@ } } +{ + "type": "doc", + "value": { + "id": "with-different-timefield-1", + "index": "with-different-timefield", + "source": { + "@message" : "ole", + "with-different-timefield": "2019-10-22T23:50:13.253Z", + "referer": "http://twitter.com/error/takuya-onishi", + "request": "/uploads/dafydd-williams.jpg", + "response": "200", + "type": "apache", + "url": "https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/dafydd-williams.jpg" + } + } +} + + + diff --git a/test/functional/fixtures/es_archiver/index_pattern_without_timefield/mappings.json b/test/functional/fixtures/es_archiver/index_pattern_without_timefield/mappings.json index dd41e01592a7b..0d1fe46408f36 100644 --- a/test/functional/fixtures/es_archiver/index_pattern_without_timefield/mappings.json +++ b/test/functional/fixtures/es_archiver/index_pattern_without_timefield/mappings.json @@ -30,3 +30,23 @@ } } } + +{ + "type": "index", + "value": { + "index": "with-different-timefield", + "mappings": { + "properties": { + "different-timefield": { + "type": "date" + } + } + }, + "settings": { + "index": { + "number_of_replicas": "0", + "number_of_shards": "1" + } + } + } +} diff --git a/test/functional/fixtures/kbn_archiver/index_pattern_without_timefield.json b/test/functional/fixtures/kbn_archiver/index_pattern_without_timefield.json index d5906dc8a2e99..d0c7b2f55b975 100644 --- a/test/functional/fixtures/kbn_archiver/index_pattern_without_timefield.json +++ b/test/functional/fixtures/kbn_archiver/index_pattern_without_timefield.json @@ -14,6 +14,22 @@ "version": "WzEzLDJd" } +{ + "attributes": { + "fields": "[]", + "timeFieldName": "with-different-timefield", + "title": "with-different-timefield" + }, + "coreMigrationVersion": "7.17.1", + "id": "with-different-timefield", + "migrationVersion": { + "index-pattern": "7.11.0" + }, + "references": [], + "type": "index-pattern", + "version": "WzEzLDJd" +} + { "attributes": { "fields": "[]", @@ -27,4 +43,4 @@ "references": [], "type": "index-pattern", "version": "WzEyLDJd" -} \ No newline at end of file +}