Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Uptime] Fix flaky uptime overview page test #54767

Merged
merged 15 commits into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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