mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
A bunch of tests on dashboards are customising some of the panels settings and providing custom time ranges: <img width="409" alt="image" src="c869c1a3
-f7db-4ccd-ad00-c5403f2b4201"> Currently, the logic is not waiting for the quick toggle animation to complete, before proceeding to select a time range. This can cause a flaky behavior if the logic tries to customize the range before the button is actually available, as seen on [this failed test](018a4c46
-0e7a-4b69-9a3d-9c54c27165b0_4fcbc47e71644919129e320eea8bb3bc.html?response-content-type=text%2Fhtml&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAQPCP3C7LZWZ5UB5F%2F20230901%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230901T094837Z&X-Amz-Expires=600&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEB0aCXVzLWVhc3QtMSJGMEQCIGCyKcVLGPUawZubNzZdt5oZNb5v0saiIuPqXwI7rmwlAiAsOj%2Fiep94v%2BYZJtLY3Gw0m%2FmK5mJw2IcIBdNKFXgK%2BCr6Awjm%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAAaDDAzMjM3OTcwNTMwMyIMXOd1Hm6ks%2FNE37V0Ks4DgMUso7syv87hnPcC%2BB1soxvFFnj4JnNZc6ZgkLUe93z99iPFBUsqH%2BRbUTfSbjVOEJYBKGYuvp32xvSWsYNVPXKmcej18LC0yNi%2BBzoG2X%2Bj80g%2BbGMm6YfTncjPhOE0CHHqOWXts9nQ8WpDy8XOl0zfMtuiPjzOXHo9lvw2mgYDZIJIMV72FYB9JGg8FPbLQtD3rysLGNE0VDKgl5LCnYwhY1pwRCRHnVW41QfV0pwK%2FbjNf9HjdK31LQvMY%2FGPuB3M6O2CUZLsvLGfWBeGYHtkqb0hrL9ijO1Uo28ZSS1FytPftEdF0e1kAC9C5zD56HtYm55aktOWtaaC0XPWLdWWGUq%2FKQzhxSCiXK6ovATU3zI3yPNoZs92YBYmIPMOpEI40dCCpksjPwAMCiQd%2F9gMNKP5Qp5CbYd2Khy%2FeXaT8J7HOZCueN63O0j%2FtX1tbwfznhbr74lAcRQjueRYmwboZaGSDZUQ33lSSmyZk1V9WF9eJyt88oHvIx0q9bIjvOlW05DiNKfEFWYwfBywdGuvRU6eGMs1QcDNu33Lb%2BhymudM2JZmQKIjZOcb2l3Fzctp614owH4JcRlmF4%2BIa4xHeBdRlTMysS8bTIsgMK7axacGOqYBzIpC1wgZWJ1kZ0agLWCNaMIdUl%2B4xrr7w%2Fz0843WWMhRrvbJhDTHqk5UclF%2FSROAMe0FH2XEXiQ65ILyUPlrUMels5tfQ3Pp%2FJWPi9NsQJUQ1n9uLN%2BFPDOoMo8Uxg4%2FkG2O7yTkrIdArfA6pWN9I21gFMW%2BFZy9BMYltt5T65ZKOyYAIFGpLhgfBySIBCUMgwR1kusfDhf1%2FRTvtDKD2sJKN5a0IA%3D%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=35fabe908aa7514e4a92de0ed12973af85ccfb439984fc3bdd7ef3bb8fe3419b). (part of this [failed CI build](https://buildkite.com/elastic/kibana-pull-request/builds/155285#018a4c46-0e7a-4b69-9a3d-9c54c27165b0)) The goal of this PR is to add a small waiting period, to make sure the toggle animation has completed, and that the time range controls are visible and clickable. I used the opportunity to cleanup some "await delay millis" calls, reusing existing logic instead. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
211 lines
5.8 KiB
TypeScript
211 lines
5.8 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
* 2.0.
|
|
*/
|
|
|
|
import expect from '@kbn/expect';
|
|
import { FtrProviderContext } from '../../ftr_provider_context';
|
|
|
|
export const UPTIME_HEARTBEAT_DATA = 'x-pack/test/functional/es_archives/uptime/full_heartbeat';
|
|
|
|
export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|
const { uptime, common } = getPageObjects(['uptime', 'common']);
|
|
const retry = getService('retry');
|
|
const esArchiver = getService('esArchiver');
|
|
|
|
const testSubjects = getService('testSubjects');
|
|
|
|
describe('overview page', function () {
|
|
const DEFAULT_DATE_START = 'Sep 10, 2019 @ 12:40:08.078';
|
|
const DEFAULT_DATE_END = 'Sep 11, 2019 @ 19:40:08.078';
|
|
|
|
before(async () => {
|
|
await esArchiver.loadIfNeeded(UPTIME_HEARTBEAT_DATA);
|
|
});
|
|
|
|
beforeEach(async () => {
|
|
await uptime.goToRoot();
|
|
await uptime.setDateRange(DEFAULT_DATE_START, DEFAULT_DATE_END);
|
|
|
|
await uptime.resetFilters();
|
|
});
|
|
|
|
it('loads and displays uptime data based on date range', async () => {
|
|
await uptime.goToUptimeOverviewAndLoadData(
|
|
DEFAULT_DATE_START,
|
|
DEFAULT_DATE_END,
|
|
'monitor-page-link-0000-intermittent'
|
|
);
|
|
});
|
|
|
|
it('applies filters for multiple fields', async () => {
|
|
await uptime.selectFilterItems({
|
|
Location: ['mpls'],
|
|
Port: ['5678'],
|
|
Scheme: ['http'],
|
|
});
|
|
await uptime.pageHasExpectedIds([
|
|
'0000-intermittent',
|
|
'0001-up',
|
|
'0002-up',
|
|
'0003-up',
|
|
'0004-up',
|
|
'0005-up',
|
|
'0006-up',
|
|
'0007-up',
|
|
'0008-up',
|
|
'0009-up',
|
|
]);
|
|
});
|
|
|
|
it('pagination is cleared when filter criteria changes', async () => {
|
|
await uptime.changePage('next');
|
|
await retry.try(async () => {
|
|
await uptime.pageHasExpectedIds([
|
|
'0010-down',
|
|
'0011-up',
|
|
'0012-up',
|
|
'0013-up',
|
|
'0014-up',
|
|
'0015-intermittent',
|
|
'0016-up',
|
|
'0017-up',
|
|
'0018-up',
|
|
'0019-up',
|
|
]);
|
|
});
|
|
// there should now be pagination data in the URL
|
|
await uptime.pageUrlContains('pagination');
|
|
await uptime.setStatusFilter('up');
|
|
await retry.try(async () => {
|
|
await uptime.pageHasExpectedIds([
|
|
'0000-intermittent',
|
|
'0001-up',
|
|
'0002-up',
|
|
'0003-up',
|
|
'0004-up',
|
|
'0005-up',
|
|
'0006-up',
|
|
'0007-up',
|
|
'0008-up',
|
|
'0009-up',
|
|
]);
|
|
});
|
|
// ensure that pagination is removed from the URL
|
|
await uptime.pageUrlContains('pagination', false);
|
|
});
|
|
|
|
it('clears pagination parameters when size changes', async () => {
|
|
await uptime.changePage('next');
|
|
await retry.try(async () => {
|
|
await uptime.pageUrlContains('pagination');
|
|
});
|
|
await uptime.setMonitorListPageSize(50);
|
|
// the pagination parameter should be cleared after a size change
|
|
await common.sleep(1000);
|
|
await retry.try(async () => {
|
|
await uptime.pageUrlContains('pagination', false);
|
|
});
|
|
});
|
|
|
|
it('pagination size updates to reflect current selection', async () => {
|
|
await uptime.pageHasExpectedIds([
|
|
'0000-intermittent',
|
|
'0001-up',
|
|
'0002-up',
|
|
'0003-up',
|
|
'0004-up',
|
|
'0005-up',
|
|
'0006-up',
|
|
'0007-up',
|
|
'0008-up',
|
|
'0009-up',
|
|
]);
|
|
await uptime.setMonitorListPageSize(50);
|
|
await uptime.pageHasExpectedIds([
|
|
'0000-intermittent',
|
|
'0001-up',
|
|
'0002-up',
|
|
'0003-up',
|
|
'0004-up',
|
|
'0005-up',
|
|
'0006-up',
|
|
'0007-up',
|
|
'0008-up',
|
|
'0009-up',
|
|
'0010-down',
|
|
'0011-up',
|
|
'0012-up',
|
|
'0013-up',
|
|
'0014-up',
|
|
'0015-intermittent',
|
|
'0016-up',
|
|
'0017-up',
|
|
'0018-up',
|
|
'0019-up',
|
|
'0020-down',
|
|
'0021-up',
|
|
'0022-up',
|
|
'0023-up',
|
|
'0024-up',
|
|
'0025-up',
|
|
'0026-up',
|
|
'0027-up',
|
|
'0028-up',
|
|
'0029-up',
|
|
'0030-intermittent',
|
|
'0031-up',
|
|
'0032-up',
|
|
'0033-up',
|
|
'0034-up',
|
|
'0035-up',
|
|
'0036-up',
|
|
'0037-up',
|
|
'0038-up',
|
|
'0039-up',
|
|
'0040-down',
|
|
'0041-up',
|
|
'0042-up',
|
|
'0043-up',
|
|
'0044-up',
|
|
'0045-intermittent',
|
|
'0046-up',
|
|
'0047-up',
|
|
'0048-up',
|
|
'0049-up',
|
|
]);
|
|
});
|
|
|
|
describe('snapshot counts', () => {
|
|
it('should not update when status filter is set to down', async () => {
|
|
await uptime.setStatusFilter('down');
|
|
|
|
await retry.tryForTime(12000, async () => {
|
|
const counts = await uptime.getSnapshotCount();
|
|
expect(counts).to.eql({ up: '93', down: '7' });
|
|
});
|
|
});
|
|
|
|
it('should not update when status filter is set to up', async () => {
|
|
await uptime.setStatusFilter('up');
|
|
await retry.tryForTime(12000, async () => {
|
|
const counts = await uptime.getSnapshotCount();
|
|
expect(counts).to.eql({ up: '93', down: '7' });
|
|
});
|
|
});
|
|
|
|
it('can change query syntax to kql', async () => {
|
|
await testSubjects.click('switchQueryLanguageButton');
|
|
await testSubjects.click('kqlLanguageMenuItem');
|
|
});
|
|
|
|
it('runs filter query without issues', async () => {
|
|
await uptime.inputFilterQuery('monitor.status:up and monitor.id:"0000-intermittent"');
|
|
await uptime.pageHasExpectedIds(['0000-intermittent']);
|
|
await uptime.resetFilters();
|
|
});
|
|
});
|
|
});
|
|
};
|