[Upgrade] Fix tests for 8.3 snapshots (#132374)

* Update canvas url check and widen maps pixel diff

* Move maps screenshots to upgrade dir and update paths/names

* Hide map tooltip if exists

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
liza-mae 2022-05-31 11:48:23 -06:00 committed by GitHub
parent 9aa26549b5
commit ac5d00381c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 14 deletions

View file

@ -39,14 +39,16 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.header.waitUntilLoadingHasFinished();
});
it('renders elements on workpad ' + name + ' page ' + page, async () => {
const currentUrl = await browser.getCurrentUrl();
const [, hash] = currentUrl.split('#/');
if (hash.length === 0) {
const browserUrl = await browser.getCurrentUrl();
const currentUrl = new URL(browserUrl);
const pathname = currentUrl.pathname;
const hash = currentUrl.hash;
if (hash.length === 0 && pathname.replace(/\/$/, '') === basePath + '/app/canvas') {
throw new Error('Did not launch canvas sample data for ' + name);
}
if (name === 'ecommerce') {
if (!currentUrl.includes('page/' + page)) {
await browser.get(currentUrl.replace(/\/[^\/]*$/, '/' + page), false);
if (!browserUrl.includes('page/' + page)) {
await browser.get(browserUrl.replace(/\/[^\/]*$/, '/' + page), false);
await PageObjects.header.waitUntilLoadingHasFinished();
}
}

View file

@ -123,10 +123,10 @@ export default function ({
});
it('should load layers', async () => {
const percentDifference = await screenshot.compareAgainstBaseline(
'ecommerce_map',
'upgrade_ecommerce_map',
updateBaselines
);
expect(percentDifference.toFixed(3)).to.be.lessThan(0.031);
expect(percentDifference.toFixed(3)).to.be.lessThan(0.05);
});
});
describe('space: ' + space + ', name: flights', () => {
@ -147,10 +147,10 @@ export default function ({
});
it('should load saved object and display layers', async () => {
const percentDifference = await screenshot.compareAgainstBaseline(
'flights_map',
'upgrade_flights_map',
updateBaselines
);
expect(percentDifference.toFixed(3)).to.be.lessThan(0.031);
expect(percentDifference.toFixed(3)).to.be.lessThan(0.05);
});
});
describe('space: ' + space + ', name: web logs', () => {
@ -172,10 +172,10 @@ export default function ({
});
it('should load saved object and display layers', async () => {
const percentDifference = await screenshot.compareAgainstBaseline(
'web_logs_map',
'upgrade_web_logs_map',
updateBaselines
);
expect(percentDifference.toFixed(3)).to.be.lessThan(0.031);
expect(percentDifference.toFixed(3)).to.be.lessThan(0.05);
});
});
});

View file

@ -5,6 +5,8 @@
* 2.0.
*/
import { resolve } from 'path';
import { FtrConfigProviderContext } from '@kbn/test';
import { pageObjects } from '../functional/page_objects';
import { ReportingAPIProvider } from './services/reporting_upgrade_services';
@ -36,6 +38,10 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
mapsHelper: MapsHelper,
},
screenshots: {
directory: resolve(__dirname, 'screenshots'),
},
junit: {
reportName: 'Kibana Core Tests',
},

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

View file

@ -8,10 +8,23 @@
import { FtrProviderContext } from '../ftr_provider_context';
export function MapsHelper({ getPageObjects, getService }: FtrProviderContext) {
const PageObjects = getPageObjects(['maps']);
const PageObjects = getPageObjects(['maps', 'common']);
const testSubjects = getService('testSubjects');
const log = getService('log');
return {
async toggleLayerVisibility(layerName: string) {
log.debug('Inside toggleLayerVisibility');
await PageObjects.maps.openLayerTocActionsPanel(layerName);
await testSubjects.click('layerVisibilityToggleButton');
await PageObjects.common.sleep(3000);
const isTooltipOpen = await testSubjects.exists(`layerTocTooltip`, { timeout: 5000 });
if (isTooltipOpen) {
await testSubjects.click(`layerTocTooltip`);
await PageObjects.common.sleep(1000);
}
},
// In v8.0, the default base map switched from bright to desaturated.
// https://github.com/elastic/kibana/pull/116179
// Maps created before this change will have a base map called "Road map"
@ -26,10 +39,10 @@ export function MapsHelper({ getPageObjects, getService }: FtrProviderContext) {
throw new Error('Layer road map not found');
}
if (isRoadMapDesaturated) {
await PageObjects.maps.toggleLayerVisibility('Road map - desaturated');
await this.toggleLayerVisibility('Road map - desaturated');
}
if (isRoadMap) {
await PageObjects.maps.toggleLayerVisibility('Road map');
await this.toggleLayerVisibility('Road map');
}
},