kibana/test/functional/page_objects/header_page.js
Lee Drengenberg 5a92dec11d
unskip dashboard_screenshot tests by using new setScreenshotSize (#46311)
* use new setScreenshotSize

* change tolerance from 1% to 2% (originally 5%)

* retake baseline without notification dialog

* close add and save notifications

* wait for render complete when going in to FullScreen mode

* add 5 second sleep to see if it ever goes to full screen mode

* add debugging screenshots and sleeps

* try reloading the Kibana index before this test

* 30 iterations with only the first test enabled

* revert multi-run changes

* ran node scripts/build_renovate_config

* fix tslint errors

* fix tslint error

* update xpack dependency to match oss

* update yarn.lock

* revert notifications:lifetime:info change by reducing some other timeouts

* remove commented-out code

* fixed and Unskipped 2nd test

* re-arrange order of dashboard tests to pass :-(

* removed commented-out sleep

Hopefully this won't be an issue

* Add comment about the order of tests

```
      loadTestFile(require.resolve('./view_edit'));
      // Order of test suites *shouldn't* be important but there's a bug for the view_edit test above
      // https://github.com/elastic/kibana/issues/46752
      // The dashboard_snapshot test below requires the timestamped URL which breaks the view_edit test.
      // If we don't use the timestamp in the URL, the colors in the charts will be different.
      loadTestFile(require.resolve('./dashboard_snapshots'));
 ```
2019-09-27 13:49:51 -05:00

101 lines
3.3 KiB
JavaScript

/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export function HeaderPageProvider({ getService, getPageObjects }) {
const config = getService('config');
const log = getService('log');
const retry = getService('retry');
const testSubjects = getService('testSubjects');
const appsMenu = getService('appsMenu');
const globalNav = getService('globalNav');
const PageObjects = getPageObjects(['common']);
const defaultFindTimeout = config.get('timeouts.find');
class HeaderPage {
async clickDiscover() {
await appsMenu.clickLink('Discover');
await PageObjects.common.waitForTopNavToBeVisible();
await this.awaitGlobalLoadingIndicatorHidden();
}
async clickVisualize() {
await appsMenu.clickLink('Visualize');
await this.awaitGlobalLoadingIndicatorHidden();
await retry.waitFor('first breadcrumb to be "Visualize"', async () => {
const firstBreadcrumb = await globalNav.getFirstBreadcrumb();
if (firstBreadcrumb !== 'Visualize') {
log.debug('-- first breadcrumb =', firstBreadcrumb);
return false;
}
return true;
});
}
async clickDashboard() {
await appsMenu.clickLink('Dashboard');
await retry.waitFor('dashboard app to be loaded', async () => {
const isNavVisible = await testSubjects.exists('top-nav');
const isLandingPageVisible = await testSubjects.exists('dashboardLandingPage');
return isNavVisible || isLandingPageVisible;
});
await this.awaitGlobalLoadingIndicatorHidden();
}
async clickManagement() {
await appsMenu.clickLink('Management');
await this.awaitGlobalLoadingIndicatorHidden();
}
async waitUntilLoadingHasFinished() {
try {
await this.isGlobalLoadingIndicatorVisible();
} catch (exception) {
if (exception.name === 'ElementNotVisible') {
// selenium might just have been too slow to catch it
} else {
throw exception;
}
}
await this.awaitGlobalLoadingIndicatorHidden();
}
async isGlobalLoadingIndicatorVisible() {
log.debug('isGlobalLoadingIndicatorVisible');
return await testSubjects.exists('globalLoadingIndicator', { timeout: 1500 });
}
async awaitGlobalLoadingIndicatorHidden() {
await testSubjects.existOrFail('globalLoadingIndicator-hidden', {
allowHidden: true,
timeout: defaultFindTimeout * 10
});
}
async awaitKibanaChrome() {
log.debug('awaitKibanaChrome');
await testSubjects.find('kibanaChrome', defaultFindTimeout * 10);
}
}
return new HeaderPage();
}