mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Make lon/lat comparison less strict in selenium test (#11464)
Make comparison on location less strict. Depending on the browser, the location might be slightly off after the decimal point.
This commit is contained in:
parent
fcf1f5089a
commit
73f2ff513a
1 changed files with 27 additions and 6 deletions
|
@ -45,6 +45,28 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* manually compare data due to possible small difference in numbers. This is browser dependent.
|
||||
*/
|
||||
function compareTableData(expected, actual) {
|
||||
|
||||
expect(actual.length).to.eql(expected.length);
|
||||
|
||||
function tokenize(row) {
|
||||
const tokens = row.split(' ');
|
||||
return {
|
||||
geohash: tokens[0],
|
||||
count: tokens[1],
|
||||
lat: Math.floor(parseFloat(tokens[4])),
|
||||
lon: Math.floor(parseFloat(tokens[6]))
|
||||
};
|
||||
}
|
||||
|
||||
expect(actual.map(tokenize)).to.eql(expected.map(tokenize));
|
||||
}
|
||||
|
||||
|
||||
describe('tile map chart', function indexPatternCreation() {
|
||||
|
||||
it('should show correct tile map data on default zoom level', function () {
|
||||
|
@ -69,8 +91,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
})
|
||||
.then(function getDataTableData() {
|
||||
return PageObjects.visualize.getDataTableData()
|
||||
.then(function showData(data) {
|
||||
expect(data.trim().split('\n')).to.eql(expectedTableData);
|
||||
.then(function showData(actualTableData) {
|
||||
compareTableData(expectedTableData, actualTableData.trim().split('\n'));
|
||||
return PageObjects.visualize.collapseChart();
|
||||
});
|
||||
});
|
||||
|
@ -204,7 +226,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
return PageObjects.visualize.getDataTableData();
|
||||
})
|
||||
.then(function showData(data) {
|
||||
expect(data.trim().split('\n')).to.eql(expectedTableData);
|
||||
compareTableData(expectedTableData, data.trim().split('\n'));
|
||||
return PageObjects.visualize.collapseChart();
|
||||
})
|
||||
.then(function () {
|
||||
|
@ -219,8 +241,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
return PageObjects.visualize.getDataTableData();
|
||||
})
|
||||
.then(function showData(data) {
|
||||
|
||||
expect(data.trim().split('\n')).to.eql(expectedTableDataZoomed);
|
||||
compareTableData(expectedTableDataZoomed, data.trim().split('\n'));
|
||||
return PageObjects.visualize.collapseChart();
|
||||
})
|
||||
.then(function () {
|
||||
|
@ -241,7 +262,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
return PageObjects.visualize.getDataTableData();
|
||||
})
|
||||
.then(function showData(data) {
|
||||
expect(data.trim().split('\n')).to.eql(expectedTableData);
|
||||
compareTableData(expectedTableData, data.trim().split('\n'));
|
||||
return PageObjects.visualize.collapseChart();
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue