Skip to content

Commit

Permalink
[Uptime] Fix flaky uptime overview page test (#54767)
Browse files Browse the repository at this point in the history
* Fix flaky uptime overview page test.

* Increase timeout for url checks.

* Prefer standard `retry.try` to custom retry implementation.

* Remove unneeded symbol.

* Remove unnecessary type annotation.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
justinkambic and elasticmachine committed Jan 21, 2020
1 parent ce286f5 commit 2bf111c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 3 additions & 6 deletions x-pack/test/functional/apps/uptime/overview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,11 @@ export default ({ getPageObjects }: FtrProviderContext) => {
]);
});

// flakey see https://github.com/elastic/kibana/issues/54527
it.skip('pagination is cleared when filter criteria changes', async () => {
it('pagination is cleared when filter criteria changes', async () => {
await pageObjects.uptime.goToUptimePageAndSetDateRange(DEFAULT_DATE_START, DEFAULT_DATE_END);
await pageObjects.uptime.changePage('next');
// there should now be pagination data in the URL
const contains = await pageObjects.uptime.pageUrlContains('pagination');
expect(contains).to.be(true);
await pageObjects.uptime.pageUrlContains('pagination');
await pageObjects.uptime.pageHasExpectedIds([
'0010-down',
'0011-up',
Expand All @@ -71,8 +69,7 @@ export default ({ getPageObjects }: FtrProviderContext) => {
]);
await pageObjects.uptime.setStatusFilter('up');
// ensure that pagination is removed from the URL
const doesNotContain = await pageObjects.uptime.pageUrlContains('pagination');
expect(doesNotContain).to.be(false);
await pageObjects.uptime.pageUrlContains('pagination', false);
await pageObjects.uptime.pageHasExpectedIds([
'0000-intermittent',
'0001-up',
Expand Down
8 changes: 6 additions & 2 deletions x-pack/test/functional/page_objects/uptime_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
* you may not use this file except in compliance with the Elastic License.
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../ftr_provider_context';

export function UptimePageProvider({ getPageObjects, getService }: FtrProviderContext) {
const pageObjects = getPageObjects(['common', 'timePicker']);
const uptimeService = getService('uptime');
const retry = getService('retry');

return new (class UptimePage {
public async goToUptimePageAndSetDateRange(
Expand Down Expand Up @@ -51,8 +53,10 @@ export function UptimePageProvider({ getPageObjects, getService }: FtrProviderCo
await Promise.all(monitorIdsToCheck.map(id => uptimeService.monitorPageLinkExists(id)));
}

public async pageUrlContains(value: string) {
return await uptimeService.urlContains(value);
public async pageUrlContains(value: string, expected: boolean = true) {
retry.try(async () => {
expect(await uptimeService.urlContains(value)).to.eql(expected);
});
}

public async changePage(direction: 'next' | 'prev') {
Expand Down

0 comments on commit 2bf111c

Please sign in to comment.