Skip to content

Commit 3cd2ea4

Browse files
Fix Failing test: APM Service overview - header filters (elastic#250355)
Closes elastic#214673 ## Summary Re-done migration of cypress tests to scout and made a more complex validation to the kuery test. ## Running tests e2e locally #### Run server (first terminal): `node scripts/scout.js start-server --stateful` #### Run apm tests (second terminal): ` npx playwright test --project local --ui --config x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel.playwright.config.ts ` ## Checklist - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) - [(Last successful run)](elastic#250355 (comment)) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
1 parent cdc7b6a commit 3cd2ea4

2 files changed

Lines changed: 31 additions & 81 deletions

File tree

x-pack/solutions/observability/plugins/apm/ftr_e2e/cypress/e2e/service_inventory/header_filters/header_filters.cy.ts

Lines changed: 0 additions & 53 deletions
This file was deleted.

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

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
import { expect } from '@kbn/scout-oblt';
99
import { test, testData } from '../../fixtures';
10+
import { EXTENDED_TIMEOUT } from '../../fixtures/constants';
11+
12+
const specialServiceName = 'service 1 / ? # [ ] @ ! $ & ( ) * + , ; = < > % {} | ^ ` <>';
1013

1114
test.describe('Service overview - header filters', { tag: ['@ess', '@svlOblt'] }, () => {
1215
test.beforeEach(async ({ browserAuth }) => {
@@ -42,52 +45,52 @@ test.describe('Service overview - header filters', { tag: ['@ess', '@svlOblt'] }
4245
});
4346
});
4447

45-
test('Filtering by searchbar - filters by transaction.name', async ({
48+
test('Filtering by searchbar - filters by service.name with special characters', async ({
4649
page,
4750
pageObjects: { serviceDetailsPage },
4851
}) => {
49-
await test.step('Navigate to opbeans-java service overview', async () => {
52+
await test.step('Navigate to special service overview', async () => {
5053
await serviceDetailsPage.overviewTab.goToTab({
51-
serviceName: testData.SERVICE_OPBEANS_JAVA,
54+
serviceName: testData.SERVICE_OPBEANS_NODE,
5255
rangeFrom: testData.START_DATE,
5356
rangeTo: testData.END_DATE,
5457
});
5558
});
5659

5760
await test.step('Verify service name is visible', async () => {
58-
await expect(page.getByTestId('apmMainTemplateHeaderServiceName')).toHaveText('opbeans-java');
61+
await expect(page.getByTestId('apmMainTemplateHeaderServiceName')).toHaveText(
62+
testData.SERVICE_OPBEANS_NODE
63+
);
64+
await expect(page.getByTestId('instanceActionsButton_opbeans-node-prod-1')).toBeVisible({
65+
timeout: EXTENDED_TIMEOUT,
66+
});
5967
});
6068

61-
await test.step('Type transaction.n in searchbar and select autocomplete', async () => {
69+
await test.step('Filter by service.name with special characters', async () => {
6270
const searchBar = page.getByTestId('apmUnifiedSearchBar');
63-
await searchBar.fill('transaction.n');
64-
await expect(page.getByText('transaction.name', { exact: true })).toBeVisible();
65-
await page.getByTestId('autocompleteSuggestion-field-transaction.name-').click();
71+
await expect(searchBar).toBeVisible({ timeout: EXTENDED_TIMEOUT });
72+
await expect(searchBar).toHaveValue('');
73+
await searchBar.fill(`service.name: "${specialServiceName}"`);
74+
await expect(searchBar).toHaveValue(`service.name: "${specialServiceName}"`);
75+
await expect(page.getByTestId('querySubmitButton')).toHaveText('Update');
76+
await searchBar.press('Enter');
6677
});
6778

68-
await test.step('Type colon and wait for suggestions', async () => {
69-
const searchBar = page.getByTestId('apmUnifiedSearchBar');
70-
await searchBar.type(':');
71-
72-
// Wait for suggestions API call
73-
await page.waitForResponse((response) =>
74-
response.url().includes('/internal/kibana/suggestions/values/')
75-
);
76-
});
79+
await test.step('Verify URL contains special service name', async () => {
80+
await expect(page.getByTestId('querySubmitButton')).toHaveText('Refresh');
7781

78-
await test.step('Verify autocomplete suggestions and select value', async () => {
79-
await expect(page.getByTestId('autoCompleteSuggestionText')).toHaveCount(1);
80-
await page.getByTestId('autocompleteSuggestion-value-"GET-/api/product"-').click();
81-
});
82+
await expect(page.getByTestId('transactionBreakdownChart')).toHaveText('No data to display', {
83+
timeout: EXTENDED_TIMEOUT,
84+
});
8285

83-
await test.step('Submit search and verify URL contains kuery', async () => {
84-
const searchBar = page.getByTestId('apmUnifiedSearchBar');
85-
await searchBar.press('Escape');
86-
await searchBar.press('Enter');
86+
await page.waitForURL(
87+
(url) => {
88+
return url.toString().includes(encodeURIComponent(specialServiceName));
89+
},
90+
{ timeout: EXTENDED_TIMEOUT }
91+
);
8792

88-
// Wait for URL to update with kuery parameter
89-
await page.waitForURL(/kuery=transaction\.name/);
90-
expect(page.url()).toContain('&kuery=transaction.name%20:%22GET%20%2Fapi%2Fproduct%22%20');
93+
expect(page.url()).toContain(encodeURIComponent(specialServiceName));
9194
});
9295
});
9396
});

0 commit comments

Comments
 (0)