diff --git a/x-pack/plugins/maps/public/classes/sources/ems_tms_source/ems_tms_source.js b/x-pack/plugins/maps/public/classes/sources/ems_tms_source/ems_tms_source.js index 71476be2f9c2..f2216f2afd2d 100644 --- a/x-pack/plugins/maps/public/classes/sources/ems_tms_source/ems_tms_source.js +++ b/x-pack/plugins/maps/public/classes/sources/ems_tms_source/ems_tms_source.js @@ -101,7 +101,7 @@ export class EMSTMSSource extends AbstractTMSSource { return tmsService; } - throw new Error(getErrorInfo()); + throw new Error(getErrorInfo(emsTileLayerId)); } async getDisplayName() { diff --git a/x-pack/test/functional/apps/maps/layer_errors.js b/x-pack/test/functional/apps/maps/layer_errors.js index c3f231ae125c..64973461c107 100644 --- a/x-pack/test/functional/apps/maps/layer_errors.js +++ b/x-pack/test/functional/apps/maps/layer_errors.js @@ -10,7 +10,6 @@ import expect from '@kbn/expect'; export default function ({ getPageObjects }) { const PageObjects = getPageObjects(['maps', 'header']); - // Failing: See https://github.com/elastic/kibana/issues/69617 describe.skip('layer errors', () => { before(async () => { await PageObjects.maps.loadSavedMap('layer with errors'); @@ -66,14 +65,15 @@ export default function ({ getPageObjects }) { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/36011 - describe.skip('EMSFileSource with missing EMS id', () => { + describe('EMSFileSource with missing EMS id', () => { const MISSING_EMS_ID = 'idThatDoesNotExitForEMSFileSource'; const LAYER_NAME = 'EMS_vector_shapes'; it('should diplay error message in layer panel', async () => { const errorMsg = await PageObjects.maps.getLayerErrorText(LAYER_NAME); - expect(errorMsg).to.equal(`Unable to find EMS vector shapes for id: ${MISSING_EMS_ID}`); + expect(errorMsg).to.equal( + `Unable to find EMS vector shapes for id: ${MISSING_EMS_ID}. Kibana is unable to access Elastic Maps Service. Contact your system administrator.` + ); }); it('should allow deletion of layer', async () => { @@ -87,10 +87,13 @@ export default function ({ getPageObjects }) { const MISSING_EMS_ID = 'idThatDoesNotExitForEMSTile'; const LAYER_NAME = 'EMS_tiles'; - it('should diplay error message in layer panel', async () => { + // Flaky test on cloud and windows when run against a snapshot build of 7.11. + // https://github.com/elastic/kibana/issues/91043 + + it.skip('should diplay error message in layer panel', async () => { const errorMsg = await PageObjects.maps.getLayerErrorText(LAYER_NAME); expect(errorMsg).to.equal( - `Unable to find EMS tile configuration for id: ${MISSING_EMS_ID}` + `Unable to find EMS tile configuration for id: ${MISSING_EMS_ID}. Kibana is unable to access Elastic Maps Service. Contact your system administrator.` ); }); diff --git a/x-pack/test/functional/apps/maps/sample_data.js b/x-pack/test/functional/apps/maps/sample_data.js index 602b5877bcf1..0c0af2affe50 100644 --- a/x-pack/test/functional/apps/maps/sample_data.js +++ b/x-pack/test/functional/apps/maps/sample_data.js @@ -6,29 +6,82 @@ */ import expect from '@kbn/expect'; +import { UI_SETTINGS } from '../../../../../src/plugins/data/common'; export default function ({ getPageObjects, getService, updateBaselines }) { const PageObjects = getPageObjects(['common', 'maps', 'header', 'home', 'timePicker']); const screenshot = getService('screenshots'); + const testSubjects = getService('testSubjects'); + const kibanaServer = getService('kibanaServer'); - // FLAKY: https://github.com/elastic/kibana/issues/38137 - describe.skip('maps loaded from sample data', () => { - // Sample data is shifted to be relative to current time - // This means that a static timerange will return different documents - // Setting the time range to a window larger than the sample data set - // ensures all documents are coverered by time query so the ES results will always be the same - async function setTimerangeToCoverAllSampleData() { - const past = new Date(); - past.setMonth(past.getMonth() - 6); - const future = new Date(); - future.setMonth(future.getMonth() + 6); - await PageObjects.maps.setAbsoluteRange( - PageObjects.timePicker.formatDateToAbsoluteTimeString(past), - PageObjects.timePicker.formatDateToAbsoluteTimeString(future) - ); - } + // Only update the baseline images from Jenkins session images after comparing them + // These tests might fail locally because of scaling factors and resolution. + + describe('maps loaded from sample data', () => { + before(async () => { + const SAMPLE_DATA_RANGE = `[ + { + "from": "now-30d", + "to": "now+40d", + "display": "sample data range" + }, + { + "from": "now/d", + "to": "now/d", + "display": "Today" + }, + { + "from": "now/w", + "to": "now/w", + "display": "This week" + }, + { + "from": "now-15m", + "to": "now", + "display": "Last 15 minutes" + }, + { + "from": "now-30m", + "to": "now", + "display": "Last 30 minutes" + }, + { + "from": "now-1h", + "to": "now", + "display": "Last 1 hour" + }, + { + "from": "now-24h", + "to": "now", + "display": "Last 24 hours" + }, + { + "from": "now-7d", + "to": "now", + "display": "Last 7 days" + }, + { + "from": "now-30d", + "to": "now", + "display": "Last 30 days" + }, + { + "from": "now-90d", + "to": "now", + "display": "Last 90 days" + }, + { + "from": "now-1y", + "to": "now", + "display": "Last 1 year" + } + ]`; + + await kibanaServer.uiSettings.update({ + [UI_SETTINGS.TIMEPICKER_QUICK_RANGES]: SAMPLE_DATA_RANGE, + }); + }); - // Skipped because EMS vectors are not accessible in CI describe('ecommerce', () => { before(async () => { await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', { @@ -42,8 +95,11 @@ export default function ({ getPageObjects, getService, updateBaselines }) { await PageObjects.maps.toggleLayerVisibility('France'); await PageObjects.maps.toggleLayerVisibility('United States'); await PageObjects.maps.toggleLayerVisibility('World Countries'); - await setTimerangeToCoverAllSampleData(); + await PageObjects.timePicker.setCommonlyUsedTime('sample_data range'); await PageObjects.maps.enterFullScreen(); + await PageObjects.maps.closeLegend(); + const mapContainerElement = await testSubjects.find('mapContainer'); + await mapContainerElement.moveMouseTo({ xOffset: 0, yOffset: 0 }); }); after(async () => { @@ -60,7 +116,7 @@ export default function ({ getPageObjects, getService, updateBaselines }) { 'ecommerce_map', updateBaselines ); - expect(percentDifference).to.be.lessThan(0.05); + expect(percentDifference).to.be.lessThan(0.02); }); }); @@ -73,8 +129,11 @@ export default function ({ getPageObjects, getService, updateBaselines }) { await PageObjects.home.addSampleDataSet('flights'); await PageObjects.maps.loadSavedMap('[Flights] Origin and Destination Flight Time'); await PageObjects.maps.toggleLayerVisibility('Road map'); - await setTimerangeToCoverAllSampleData(); + await PageObjects.timePicker.setCommonlyUsedTime('sample_data range'); await PageObjects.maps.enterFullScreen(); + await PageObjects.maps.closeLegend(); + const mapContainerElement = await testSubjects.find('mapContainer'); + await mapContainerElement.moveMouseTo({ xOffset: 0, yOffset: 0 }); }); after(async () => { @@ -91,11 +150,10 @@ export default function ({ getPageObjects, getService, updateBaselines }) { 'flights_map', updateBaselines ); - expect(percentDifference).to.be.lessThan(0.05); + expect(percentDifference).to.be.lessThan(0.02); }); }); - // Skipped because EMS vectors are not accessible in CI describe('web logs', () => { before(async () => { await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', { @@ -106,8 +164,11 @@ export default function ({ getPageObjects, getService, updateBaselines }) { await PageObjects.maps.loadSavedMap('[Logs] Total Requests and Bytes'); await PageObjects.maps.toggleLayerVisibility('Road map'); await PageObjects.maps.toggleLayerVisibility('Total Requests by Country'); - await setTimerangeToCoverAllSampleData(); + await PageObjects.timePicker.setCommonlyUsedTime('sample_data range'); await PageObjects.maps.enterFullScreen(); + await PageObjects.maps.closeLegend(); + const mapContainerElement = await testSubjects.find('mapContainer'); + await mapContainerElement.moveMouseTo({ xOffset: 0, yOffset: 0 }); }); after(async () => { @@ -124,7 +185,7 @@ export default function ({ getPageObjects, getService, updateBaselines }) { 'web_logs_map', updateBaselines ); - expect(percentDifference).to.be.lessThan(0.06); + expect(percentDifference).to.be.lessThan(0.02); }); }); }); diff --git a/x-pack/test/functional/screenshots/baseline/ecommerce_map.png b/x-pack/test/functional/screenshots/baseline/ecommerce_map.png index 1450e48012a0..8b0e308b7ecb 100644 Binary files a/x-pack/test/functional/screenshots/baseline/ecommerce_map.png and b/x-pack/test/functional/screenshots/baseline/ecommerce_map.png differ diff --git a/x-pack/test/functional/screenshots/baseline/flights_map.png b/x-pack/test/functional/screenshots/baseline/flights_map.png index 2a896652e420..23ece6fb7fa3 100644 Binary files a/x-pack/test/functional/screenshots/baseline/flights_map.png and b/x-pack/test/functional/screenshots/baseline/flights_map.png differ diff --git a/x-pack/test/functional/screenshots/baseline/web_logs_map.png b/x-pack/test/functional/screenshots/baseline/web_logs_map.png index 0f2bfed5e0dd..c3526e73044e 100644 Binary files a/x-pack/test/functional/screenshots/baseline/web_logs_map.png and b/x-pack/test/functional/screenshots/baseline/web_logs_map.png differ