[9.0] [scout] fix flaky flyout test (#217153) (#217237)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[scout] fix flaky flyout test
(#217153)](https://github.com/elastic/kibana/pull/217153)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Dzmitry
Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2025-04-04T17:21:30Z","message":"[scout]
fix flaky flyout test (#217153)\n\n## Summary\n\n```\nTimeoutError:
page.waitForSelector: Timeout 10000ms exceeded.\nCall log:\n - waiting
for locator('[data-test-subj=\"globalLoadingIndicator-hidden\"]')\n\n at
Object.waitForSelector
(src/platform/packages/shared/kbn-scout/src/playwright/fixtures/test/scout_page/single_thread.ts:47:27)\n
at Page.waitForLoadingIndicatorHidden
(src/platform/packages/shared/kbn-scout/src/playwright/fixtures/test/scout_page/single_thread.ts:91:27)\n
at
x-pack/solutions/security/plugins/security_solution/ui_tests/parallel_tests/flyout/alert_details_url_sync.spec.ts:40:16\n```\n\nFailure
rate before changes: 60%\n\n<img width=\"487\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/9331f973-9337-48cf-9131-c3acbf611d9c\"\n/>\n\nFor
some reason specifically in serverless Security project
loading\nindicator is not hidden on page reload after 10 seconds.\n\nTo
unblock Teams this PR changes tests to wait for\n`detectionsAlertsPage`
to be visible instead. The follow-up is to set\nloading status directly
in Alerting Table component and wait for\n`alertsTable-loaded`
data-test-subj in UI tests before interacting with\ntable.\n\nFailure
rate with changes: 0%\n<img width=\"1592\" alt=\"Screenshot 2025-04-04
at 17 08
32\"\nsrc=\"https://github.com/user-attachments/assets/c955ed94-bc92-4328-a3b5-0194806d31b1\"\n/>","sha":"64142047fba15f52b28304b09fb78c3aa2d23b3a","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","v9.1.0","v8.19.0","v9.0.1"],"title":"[scout]
fix flaky flyout
test","number":217153,"url":"https://github.com/elastic/kibana/pull/217153","mergeCommit":{"message":"[scout]
fix flaky flyout test (#217153)\n\n## Summary\n\n```\nTimeoutError:
page.waitForSelector: Timeout 10000ms exceeded.\nCall log:\n - waiting
for locator('[data-test-subj=\"globalLoadingIndicator-hidden\"]')\n\n at
Object.waitForSelector
(src/platform/packages/shared/kbn-scout/src/playwright/fixtures/test/scout_page/single_thread.ts:47:27)\n
at Page.waitForLoadingIndicatorHidden
(src/platform/packages/shared/kbn-scout/src/playwright/fixtures/test/scout_page/single_thread.ts:91:27)\n
at
x-pack/solutions/security/plugins/security_solution/ui_tests/parallel_tests/flyout/alert_details_url_sync.spec.ts:40:16\n```\n\nFailure
rate before changes: 60%\n\n<img width=\"487\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/9331f973-9337-48cf-9131-c3acbf611d9c\"\n/>\n\nFor
some reason specifically in serverless Security project
loading\nindicator is not hidden on page reload after 10 seconds.\n\nTo
unblock Teams this PR changes tests to wait for\n`detectionsAlertsPage`
to be visible instead. The follow-up is to set\nloading status directly
in Alerting Table component and wait for\n`alertsTable-loaded`
data-test-subj in UI tests before interacting with\ntable.\n\nFailure
rate with changes: 0%\n<img width=\"1592\" alt=\"Screenshot 2025-04-04
at 17 08
32\"\nsrc=\"https://github.com/user-attachments/assets/c955ed94-bc92-4328-a3b5-0194806d31b1\"\n/>","sha":"64142047fba15f52b28304b09fb78c3aa2d23b3a"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217153","number":217153,"mergeCommit":{"message":"[scout]
fix flaky flyout test (#217153)\n\n## Summary\n\n```\nTimeoutError:
page.waitForSelector: Timeout 10000ms exceeded.\nCall log:\n - waiting
for locator('[data-test-subj=\"globalLoadingIndicator-hidden\"]')\n\n at
Object.waitForSelector
(src/platform/packages/shared/kbn-scout/src/playwright/fixtures/test/scout_page/single_thread.ts:47:27)\n
at Page.waitForLoadingIndicatorHidden
(src/platform/packages/shared/kbn-scout/src/playwright/fixtures/test/scout_page/single_thread.ts:91:27)\n
at
x-pack/solutions/security/plugins/security_solution/ui_tests/parallel_tests/flyout/alert_details_url_sync.spec.ts:40:16\n```\n\nFailure
rate before changes: 60%\n\n<img width=\"487\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/9331f973-9337-48cf-9131-c3acbf611d9c\"\n/>\n\nFor
some reason specifically in serverless Security project
loading\nindicator is not hidden on page reload after 10 seconds.\n\nTo
unblock Teams this PR changes tests to wait for\n`detectionsAlertsPage`
to be visible instead. The follow-up is to set\nloading status directly
in Alerting Table component and wait for\n`alertsTable-loaded`
data-test-subj in UI tests before interacting with\ntable.\n\nFailure
rate with changes: 0%\n<img width=\"1592\" alt=\"Screenshot 2025-04-04
at 17 08
32\"\nsrc=\"https://github.com/user-attachments/assets/c955ed94-bc92-4328-a3b5-0194806d31b1\"\n/>","sha":"64142047fba15f52b28304b09fb78c3aa2d23b3a"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
This commit is contained in:
Kibana Machine 2025-04-04 21:02:06 +02:00 committed by GitHub
parent 4e376a8d0d
commit 001bcfefcf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 8 deletions

View file

@ -486,7 +486,7 @@ const getPipeline = (filename: string, removeSteps = true) => {
/^x-pack\/solutions\/observability\/plugins\/apm/,
/^x-pack\/solutions\/observability\/plugins\/observability_onboarding/,
/^x-pack\/solutions\/security\/packages\/kbn-scout-security/,
/^x-pack\/solutions\/security\/plugins\/security_solution/,
/^x-pack\/solutions\/security\/plugins\/security_solution\/public\/flyout/,
])) ||
GITHUB_PR_LABELS.includes('ci:scout-ui-tests')
) {

View file

@ -10,21 +10,24 @@ import { ScoutPage, Locator, expect } from '@kbn/scout';
const PAGE_URL = 'security/alerts';
export class AlertsTablePage {
public detectionsAlertsContainer: Locator;
public alertRow: Locator;
public alertsTable: Locator;
public alertsTableBody: Locator;
constructor(private readonly page: ScoutPage) {
this.detectionsAlertsContainer = this.page.testSubj.locator('detectionsAlertsPage');
this.alertRow = this.page.locator('div.euiDataGridRow');
this.alertsTable = this.page.testSubj.locator('alertsTable');
this.alertsTableBody = this.page.testSubj
.locator('alertsTable')
.locator(`[data-test-subj='euiDataGridBody']`);
}
async navigate() {
return this.page.gotoApp(PAGE_URL);
await this.page.gotoApp(PAGE_URL);
}
async expandAlertDetailsFlyout(ruleName: string) {
await this.page.waitForLoadingIndicatorHidden();
await this.alertsTable.waitFor({ state: 'visible' });
await this.alertsTableBody.waitFor({ state: 'visible' });
// Filter alert by unique rule name
const row = this.alertRow.filter({ hasText: ruleName });
await expect(

View file

@ -10,7 +10,7 @@ import { CUSTOM_QUERY_RULE } from '@kbn/scout-security/src/playwright/constants/
const RIGHT = 'right';
spaceTest.describe('Expandable flyout state sync', { tag: ['@ess', '@svlSecurity '] }, () => {
spaceTest.describe('Expandable flyout state sync', { tag: ['@ess', '@svlSecurity'] }, () => {
let ruleName: string;
spaceTest.beforeEach(async ({ browserAuth, apiServices, scoutSpace }) => {
ruleName = `${CUSTOM_QUERY_RULE.name}_${scoutSpace.id}_${Date.now()}`;
@ -28,6 +28,7 @@ spaceTest.describe('Expandable flyout state sync', { tag: ['@ess', '@svlSecurity
const urlBeforeAlertDetails = page.url();
expect(urlBeforeAlertDetails).not.toContain(RIGHT);
await pageObjects.alertsTablePage.detectionsAlertsContainer.waitFor({ state: 'visible' });
await pageObjects.alertsTablePage.expandAlertDetailsFlyout(ruleName);
const urlAfterAlertDetails = page.url();
@ -37,7 +38,7 @@ spaceTest.describe('Expandable flyout state sync', { tag: ['@ess', '@svlSecurity
await expect(headerTitle).toHaveText(ruleName);
await page.reload();
await page.waitForLoadingIndicatorHidden();
await pageObjects.alertsTablePage.detectionsAlertsContainer.waitFor({ state: 'visible' });
const urlAfterReload = page.url();
expect(urlAfterReload).toContain(RIGHT);