Investigate 6.0 flaky tile map test (#13942)

This commit is contained in:
Stacey Gammon 2017-09-12 08:38:22 -04:00 committed by GitHub
parent c9c135ea14
commit f55c9da6f2
7 changed files with 64 additions and 7 deletions

View file

@ -14,7 +14,9 @@
</div>
</kbn-top-nav>
<div class="kuiViewContent kuiViewContent--constrainedWidth">
<div class="kuiViewContent kuiViewContent--constrainedWidth"
data-test-subj="visualizeLandingPage"
>
<div class="kuiViewContentItem kuiVerticalRhythm" ng-if="listingController.showLimitError">
<div class="kuiInfoPanel kuiInfoPanel--warning">
<div class="kuiInfoPanelBody">
@ -32,6 +34,7 @@
class="kuiToolBarSection"
filter="listingController.filter"
on-filter="listingController.onFilter"
data-test-subj="visualizationSearchFilter"
></tool-bar-search-box>
<div class="kuiToolBarSection">

View file

@ -21,6 +21,14 @@ export default function ({ getService, getPageObjects }) {
return PageObjects.dashboard.initTests();
});
after(async function () {
// avoids any 'Object with id x not found' errors when switching tests.
await PageObjects.header.clickVisualize();
await PageObjects.visualize.gotoLandingPage();
await PageObjects.header.clickDashboard();
await PageObjects.dashboard.gotoDashboardLandingPage();
});
it('should be able to add visualizations to dashboard', async function addVisualizations() {
await screenshots.take('Dashboard-no-visualizations');
@ -308,6 +316,10 @@ export default function ({ getService, getPageObjects }) {
const currentUrl = await remote.getCurrentUrl();
expect(currentUrl).to.contain(VisualizeConstants.EDIT_PATH);
});
after(async () => {
await PageObjects.header.clickDashboard();
});
});
});
}

View file

@ -20,6 +20,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.dashboard.setTimepickerInDataRange();
await PageObjects.dashboard.addVisualizations(['Visualization TileMap']);
await PageObjects.dashboard.saveDashboard('No local edits');
await PageObjects.header.clickToastOK();
await testSubjects.moveMouseTo('dashboardPanel');
await PageObjects.visualize.openSpyPanel();

View file

@ -2,7 +2,7 @@ export default function ({ getService, loadTestFile }) {
const remote = getService('remote');
describe('dashboard app', function () {
before(() => remote.setWindowSize(1200,800));
before(() => remote.setWindowSize(1200, 900));
loadTestFile(require.resolve('./_view_edit'));
loadTestFile(require.resolve('./_dashboard'));

View file

@ -32,6 +32,13 @@ export function DashboardPageProvider({ getService, getPageObjects }) {
async clickEditVisualization() {
log.debug('clickEditVisualization');
await testSubjects.click('dashboardPanelEditLink');
await retry.try(async () => {
const current = await remote.getCurrentUrl();
if (current.indexOf('visualize') < 0) {
throw new Error('not on visualize page');
}
});
}
async clickFullScreenMode() {

View file

@ -1,3 +1,5 @@
import { VisualizeConstants } from '../../../src/core_plugins/kibana/public/visualize/visualize_constants';
export function VisualizePageProvider({ getService, getPageObjects }) {
const remote = getService('remote');
const config = getService('config');
@ -530,9 +532,11 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
}
async clickMapButton(zoomSelector) {
const zooms = await this.getZoomSelectors(zoomSelector);
await Promise.all(zooms.map(async zoom => await zoom.click()));
await PageObjects.header.waitUntilLoadingHasFinished();
await retry.try(async () => {
const zooms = await this.getZoomSelectors(zoomSelector);
await Promise.all(zooms.map(async zoom => await zoom.click()));
await PageObjects.header.waitUntilLoadingHasFinished();
});
}
async getVisualizationRequest() {
@ -587,6 +591,31 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
return await this.clickMapButton('a.fa-crop');
}
async clickLandingPageBreadcrumbLink() {
log.debug('clickLandingPageBreadcrumbLink');
await find.clickByCssSelector(`a[href="#${VisualizeConstants.LANDING_PAGE_PATH}"]`);
}
/**
* Returns true if already on the landing page (that page doesn't have a link to itself).
* @returns {Promise<boolean>}
*/
async onLandingPage() {
log.debug(`VisualizePage.onLandingPage`);
const exists = await testSubjects.exists('visualizeLandingPage');
return exists;
}
async gotoLandingPage() {
log.debug('VisualizePage.gotoLandingPage');
const onPage = await this.onLandingPage();
if (!onPage) {
await retry.try(async () => {
await this.clickLandingPageBreadcrumbLink();
await testSubjects.find('visualizationSearchFilter');
});
}
}
}
return new VisualizePage();

View file

@ -104,8 +104,13 @@ export function TestSubjectsProvider({ getService }) {
}
async moveMouseTo(selector) {
const element = await this.find(selector);
await remote.moveMouseTo(element);
// Wrapped in a retry because even though the find should do a stale element check of it's own, we seem to
// have run into a case where the element becomes stale after the find succeeds, throwing an error during the
// moveMouseTo function.
await retry.try(async () => {
const element = await this.find(selector);
await remote.moveMouseTo(element);
});
}
async _mapAll(selectorAll, mapFn) {