Skip to content

Commit

Permalink
[Uptime] Fix flaky functional test for elastic#54541 (elastic#56449)
Browse files Browse the repository at this point in the history
* Add timeout block to race-prone functional test code.

* Add timeout for pagination click functions.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
justinkambic and elasticmachine committed Feb 3, 2020
1 parent 11f828c commit b0d383d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions x-pack/test/functional/apps/uptime/overview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
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
await pageObjects.uptime.pageUrlContains('pagination');
await pageObjects.uptime.pageHasExpectedIds([
'0010-down',
'0011-up',
Expand All @@ -67,9 +65,11 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
'0018-up',
'0019-up',
]);
await retry.tryForTime(12000, async () => {
// there should now be pagination data in the URL
await pageObjects.uptime.pageUrlContains('pagination');
});
await pageObjects.uptime.setStatusFilter('up');
// ensure that pagination is removed from the URL
await pageObjects.uptime.pageUrlContains('pagination', false);
await pageObjects.uptime.pageHasExpectedIds([
'0000-intermittent',
'0001-up',
Expand All @@ -82,6 +82,10 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
'0008-up',
'0009-up',
]);
await retry.tryForTime(12000, async () => {
// ensure that pagination is removed from the URL
await pageObjects.uptime.pageUrlContains('pagination', false);
});
});

describe('snapshot counts', () => {
Expand Down
4 changes: 2 additions & 2 deletions x-pack/test/functional/services/uptime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ export function UptimeProvider({ getService }: FtrProviderContext) {
await browser.pressKeys(browser.keys.ENTER);
},
async goToNextPage() {
await testSubjects.click('xpack.uptime.monitorList.nextButton');
await testSubjects.click('xpack.uptime.monitorList.nextButton', 5000);
},
async goToPreviousPage() {
await testSubjects.click('xpack.uptime.monitorList.prevButton');
await testSubjects.click('xpack.uptime.monitorList.prevButton', 5000);
},
async setStatusFilterUp() {
await testSubjects.click('xpack.uptime.filterBar.filterStatusUp');
Expand Down

0 comments on commit b0d383d

Please sign in to comment.