Skip to content

Commit

Permalink
Attempt to fix AlertSummaryWidget flaky test (elastic#212107)
Browse files Browse the repository at this point in the history
Fixes elastic#198102

## Summary

The check that fails is related to status:All
[here](https://github.com/elastic/kibana/blob/main/x-pack/test/observability_functional/apps/observability/pages/rule_details_page.ts#L191):

```
expect(url.includes('status%3Aall')).to.be(true);
```

It seems the status is active from the previous step:

<img
src="https://github.com/user-attachments/assets/8fa33035-d54a-4bfd-9e06-fff696767598"
width=500 />


This PR adds a retry to accommodate a delay in changing URLs.

Co-authored-by: Dominique Clarke <dominique.clarke@elastic.co>
  • Loading branch information
maryam-saeidi and dominiqueclarke authored Feb 25, 2025
1 parent 1ee97c3 commit 3b1c352
Showing 1 changed file with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,29 +168,33 @@ export default ({ getService }: FtrProviderContext) => {
await observability.components.alertSummaryWidget.getActiveAlertSelector();
await activeAlerts.click();

const url = await browser.getCurrentUrl();
const from = 'rangeFrom:now-30d';
const to = 'rangeTo:now';
await retry.try(async () => {
const url = await browser.getCurrentUrl();
const from = 'rangeFrom:now-30d';
const to = 'rangeTo:now';

expect(url.includes('tabId=alerts')).to.be(true);
expect(url.includes('status%3Aactive')).to.be(true);
expect(url.includes(from.replaceAll(':', '%3A'))).to.be(true);
expect(url.includes(to.replaceAll(':', '%3A'))).to.be(true);
expect(url.includes('tabId=alerts')).to.be(true);
expect(url.includes('status%3Aactive')).to.be(true);
expect(url.includes(from.replaceAll(':', '%3A'))).to.be(true);
expect(url.includes(to.replaceAll(':', '%3A'))).to.be(true);
});
});

it('handles clicking on total alerts correctly', async () => {
const totalAlerts =
await observability.components.alertSummaryWidget.getTotalAlertSelector();
await totalAlerts.click();

const url = await browser.getCurrentUrl();
const from = 'rangeFrom:now-30d';
const to = 'rangeTo:now';
await retry.try(async () => {
const url = await browser.getCurrentUrl();
const from = 'rangeFrom:now-30d';
const to = 'rangeTo:now';

expect(url.includes('tabId=alerts')).to.be(true);
expect(url.includes('status%3Aall')).to.be(true);
expect(url.includes(from.replaceAll(':', '%3A'))).to.be(true);
expect(url.includes(to.replaceAll(':', '%3A'))).to.be(true);
expect(url.includes('tabId=alerts')).to.be(true);
expect(url.includes('status%3Aall')).to.be(true);
expect(url.includes(from.replaceAll(':', '%3A'))).to.be(true);
expect(url.includes(to.replaceAll(':', '%3A'))).to.be(true);
});
});
});

Expand Down

0 comments on commit 3b1c352

Please sign in to comment.