Skip to content

Commit 6577bbd

Browse files
[APM] Service Overview - APM flakiness fixes (#248289)
## Summary This PR addresses several failed test issues in recent APM tests: #248069 #247477 #247467 And also doesn't fix but skips the problematic test in #247347 More details about resolution in the issue itself ### Checklist - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed
1 parent 80affb2 commit 6577bbd

6 files changed

Lines changed: 43 additions & 20 deletions

File tree

src/platform/packages/shared/kbn-scout/src/playwright/eui_components/data_grid.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,23 @@ export class EuiDataGridWrapper {
141141
return await this.rows.count();
142142
}
143143

144+
// Anytime the full screen button is clicked, it obtains focus. Because the button is wrapped in a tooltip,
145+
// focusing it causes the tooltip to appear, which can cover parts of the grid and interfere with other test interactions.
146+
// To prevent this, we blur the button immediately after clicking it to ensure the tooltip remains hidden.
147+
private async clickFullScreenButton() {
148+
await this.toolbarFullScreenButton.click();
149+
await this.toolbarFullScreenButton.blur();
150+
}
151+
144152
async openFullScreenMode() {
145153
await this.ensureGridVisible();
146-
await this.toolbarFullScreenButton.click();
154+
await this.clickFullScreenButton();
147155
await expect(this.dataGridWrapper).toContainClass('euiDataGrid--fullScreen');
148156
}
149157

150158
async closeFullScreenMode() {
151159
await this.ensureGridVisible();
152-
await this.toolbarFullScreenButton.click();
160+
await this.clickFullScreenButton();
153161
await expect(this.dataGridWrapper).not.toContainClass('euiDataGrid--fullScreen');
154162
}
155163

src/platform/packages/shared/kbn-scout/src/playwright/fixtures/scope/worker/apis/alerting/index.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,15 @@ export interface AlertingApiService {
107107
ruleId: string,
108108
count: number,
109109
spaceId?: string,
110-
timeoutMs?: number
110+
timeoutMs?: number,
111+
dateStart?: Date
112+
) => Promise<void>;
113+
waitForNextExecution: (
114+
ruleId: string,
115+
spaceId?: string,
116+
timeoutMs?: number,
117+
dateStart?: Date
111118
) => Promise<void>;
112-
waitForNextExecution: (ruleId: string, spaceId?: string, timeoutMs?: number) => Promise<void>;
113119
};
114120
cleanup: {
115121
deleteAllRules: (spaceId?: string) => Promise<void>;
@@ -624,7 +630,8 @@ export const getAlertingApiHelper = (
624630
ruleId: string,
625631
count: number,
626632
spaceId?: string,
627-
timeoutMs: number = 30000
633+
timeoutMs: number = 30000,
634+
dateStart: Date = new Date()
628635
) => {
629636
return await measurePerformanceAsync(
630637
log,
@@ -637,7 +644,8 @@ export const getAlertingApiHelper = (
637644
path: `${buildSpacePath(
638645
spaceId
639646
)}/internal/alerting/rule/${ruleId}/_execution_log`,
640-
retries: 1, // Lower retries for frequent polling operations
647+
retries: 1, // Lower retries for frequent polling operations,
648+
query: { date_start: dateStart.toISOString() },
641649
});
642650
const logData = executionLog.data as any;
643651
return logData.total;

x-pack/solutions/observability/plugins/apm/test/scout/ui/fixtures/page_objects/service_details/alerts_tab.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ export class AlertsTab extends ServiceDetailsTab {
3131
}
3232

3333
protected async waitForTabLoad() {
34-
await await this.page.testSubj
35-
.locator('showQueryBarMenu')
36-
.waitFor({ state: 'visible', timeout: EXTENDED_TIMEOUT });
37-
38-
await Promise.any([this.alertsTableEmptyState.waitFor(), this.alertsTable.ensureGridVisible()]);
34+
await this.page.testSubj.locator('showQueryBarMenu').waitFor({ timeout: EXTENDED_TIMEOUT });
3935
}
4036
}

x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel_tests/alerts/error_count.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ const START_DATE = 'now-15m';
1414
const END_DATE = 'now';
1515
const RULE_NAME = 'Error count threshold';
1616

17-
// Failing: See https://github.com/elastic/kibana/issues/247467
18-
test.describe.skip('Alerts', { tag: ['@ess', '@svlOblt'] }, () => {
17+
test.describe('Alerts', { tag: ['@ess', '@svlOblt'] }, () => {
1918
test.beforeEach(async ({ browserAuth }) => {
2019
await browserAuth.loginAsAdmin();
2120
});
@@ -62,11 +61,14 @@ test.describe.skip('Alerts', { tag: ['@ess', '@svlOblt'] }, () => {
6261
});
6362
const alert = foundResponse.data.data.find((obj: any) => obj.name === RULE_NAME);
6463
expect(alert).toBeDefined();
64+
const runDate = new Date();
6565
await apiServices.alerting.rules.runSoon(alert!.id);
66-
await apiServices.alerting.waiting.waitForNextExecution(
66+
await apiServices.alerting.waiting.waitForExecutionCount(
6767
alert!.id,
68+
1,
6869
undefined,
69-
EXTENDED_TIMEOUT
70+
EXTENDED_TIMEOUT,
71+
runDate
7072
);
7173
});
7274

x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel_tests/dependencies/service_dependencies.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import { test } from '../../fixtures';
1010

1111
const DEPENDENCY_NAME = 'postgresql';
1212

13-
test.describe('Service Dependencies Tab', { tag: ['@ess', '@svlOblt'] }, () => {
13+
// FLAKY: https://github.com/elastic/kibana/issues/247347
14+
test.describe.skip('Service Dependencies Tab', { tag: ['@ess', '@svlOblt'] }, () => {
1415
test.beforeEach(async ({ browserAuth }) => {
1516
await browserAuth.loginAsViewer();
1617
});

x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel_tests/service_overview/alerts_tab.spec.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import { expect } from '@kbn/scout-oblt';
88
import { test } from '../../fixtures';
99

10-
const EXPECTED_CONTROLS = ['Statusactive1', 'Rule', 'Group', 'Tags'];
10+
const EXPECTED_CONTROLS = ['Status', 'Rule', 'Group', 'Tags'];
1111

1212
test.describe('Service overview alerts tab', { tag: ['@ess', '@svlOblt'] }, () => {
1313
test.beforeEach(async ({ browserAuth }) => {
@@ -47,19 +47,27 @@ test.describe('Service overview alerts tab', { tag: ['@ess', '@svlOblt'] }, () =
4747
const controlTitles = serviceDetailsPage.alertsTab.controlTitles;
4848
await expect(controlTitles).toHaveCount(4);
4949

50-
const titles = (await controlTitles.allTextContents()).map((title: string) => title.trim());
51-
5250
for (const expectedControl of EXPECTED_CONTROLS) {
53-
expect(titles).toContain(expectedControl);
51+
await expect(controlTitles.getByText(expectedControl)).toBeVisible();
5452
}
5553
});
54+
55+
await test.step("status control has 'active' selected by default", async () => {
56+
const statusControl = serviceDetailsPage.alertsTab.controlTitles.filter({
57+
hasText: 'Status',
58+
});
59+
60+
await expect(statusControl.getByText('active')).toBeVisible();
61+
await expect(statusControl.getByText('1')).toBeVisible();
62+
});
5663
});
5764

5865
test('Has no detectable a11y violations on load', async ({
5966
page,
6067
pageObjects: { serviceDetailsPage },
6168
}) => {
6269
await serviceDetailsPage.alertsTab.goToTab();
70+
await serviceDetailsPage.alertsTab.alertsTableEmptyState.waitFor();
6371
const { violations } = await page.checkA11y({ include: ['main'] });
6472
expect(violations).toHaveLength(0);
6573
});

0 commit comments

Comments
 (0)