Skip to content

Commit 798ad69

Browse files
fix flaky test: alert details error page timeout (elastic#260302)
## Summary Fixes the flaky test reported in elastic#250046. **Root cause:** \`toBeVisible()\` would start checking while the component was in its loading state (spinner), missing the brief initial render of the error panel and timing out before the async API call for the non-existent alert completed. **Fix:** Wrap navigate+assert in \`.toPass({ timeout: 30_000, intervals: [2_000] })\`. I also fixed a data-test-subj and a `goto` method that changed during Rules page unification **Test type:** Scout (Playwright) **Test file:** \`x-pack/solutions/observability/plugins/observability/test/scout/ui/parallel_tests/alert_details_page.spec.ts\` **Config:** \`x-pack/solutions/observability/plugins/observability/test/scout/ui/parallel.playwright.config.ts\` ## Validation - [ ] CI flaky test runner (50 + 150 runs) ## Checklist - [x] Flaky Test Runner was used on any tests changed
1 parent 0d79a1e commit 798ad69

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

x-pack/solutions/observability/plugins/observability/test/scout/ui/fixtures/page_objects/alert_page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class AlertPage {
3030

3131
await expandAlertButtons[0].click();
3232

33-
const alertDetailsLink = this.page.testSubj.locator('alertsFlyoutAlertDetailsButton');
33+
const alertDetailsLink = this.page.testSubj.locator('alertFlyoutAlertDetailsButton');
3434
await expect(alertDetailsLink).toBeVisible();
3535
await alertDetailsLink.click();
3636

x-pack/solutions/observability/plugins/observability/test/scout/ui/fixtures/page_objects/rules_page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class RulesPage {
2424
* Navigates to the rules list page (Observability)
2525
*/
2626
async goto(ruleId: string = '') {
27-
await this.page.gotoApp(`rules/${ruleId}`);
27+
await this.page.gotoApp(ruleId ? `rules/rule/${ruleId}` : 'rules');
2828
if (!ruleId) {
2929
await this.page.testSubj.waitForSelector(RULES_SETTINGS_TEST_SUBJECTS.RULE_PAGE_TAB, {
3030
timeout: BIGGER_TIMEOUT,

x-pack/solutions/observability/plugins/observability/test/scout/ui/parallel_tests/alert_details_page.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import { expect } from '@kbn/scout-oblt/ui';
1010
import { test } from '../fixtures';
1111
import { GENERATED_METRICS } from '../fixtures/constants';
1212

13-
// Failing: See https://github.com/elastic/kibana/issues/250046
14-
test.describe.skip(
13+
test.describe(
1514
'Alert Details Page',
1615
{ tag: [...tags.stateful.classic, ...tags.serverless.observability.complete] },
1716
() => {
@@ -58,13 +57,16 @@ test.describe.skip(
5857
})) as { data: { id: string } };
5958
ruleId = createdRule.data.id;
6059
});
60+
6161
test.beforeEach(async ({ browserAuth }) => {
6262
await browserAuth.loginAsAdmin();
6363
});
6464

6565
test('should show an error when the alert does not exist', async ({ page, pageObjects }) => {
66-
await pageObjects.alertPage.goto('non-existent-alert-id');
67-
await expect(page.testSubj.locator('alertDetailsError')).toBeVisible();
66+
await expect(async () => {
67+
await pageObjects.alertPage.goto('non-existent-alert-id');
68+
await expect(page.testSubj.locator('alertDetailsError')).toBeVisible();
69+
}).toPass({ timeout: 30_000, intervals: [2_000] });
6870
});
6971

7072
test('should show a tabbed view', async ({ page, pageObjects }) => {

0 commit comments

Comments
 (0)