Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.12] Unskip and Fix maps x-pack functional test - ( sample data and layer_errors) and also added baseline images (#91205) #91972

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class EMSTMSSource extends AbstractTMSSource {
return tmsService;
}

throw new Error(getErrorInfo());
throw new Error(getErrorInfo(emsTileLayerId));
}

async getDisplayName() {
Expand Down
15 changes: 9 additions & 6 deletions x-pack/test/functional/apps/maps/layer_errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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 () => {
Expand All @@ -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.`
);
});

Expand Down
109 changes: 85 additions & 24 deletions x-pack/test/functional/apps/maps/sample_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand All @@ -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 () => {
Expand All @@ -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);
});
});

Expand All @@ -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 () => {
Expand All @@ -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', {
Expand All @@ -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 () => {
Expand All @@ -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);
});
});
});
Expand Down
Binary file modified x-pack/test/functional/screenshots/baseline/ecommerce_map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified x-pack/test/functional/screenshots/baseline/flights_map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified x-pack/test/functional/screenshots/baseline/web_logs_map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.