Skip to content

Commit 93f5185

Browse files
committed
added a test for percentile
1 parent 527640f commit 93f5185

File tree

6 files changed

+56
-8
lines changed

6 files changed

+56
-8
lines changed

x-pack/plugins/apm/e2e/cypress/integration/csm_dashboard.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ Feature: CSM Dashboard
99
When a user browses the APM UI application for RUM Data
1010
Then should have correct client metrics
1111

12+
Scenario: Percentile select
13+
When the user changes the selected percentile
14+
Then it displays client metric related to that percentile
15+
1216
Scenario Outline: CSM page filters
1317
When the user filters by "<filterName>"
1418
Then it filters the client metrics "<filterName>"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { When, Then } from 'cypress-cucumber-preprocessor/steps';
8+
import { verifyClientMetrics } from './client_metrics_helper';
9+
import { getDataTestSubj } from './utils';
10+
11+
When('the user changes the selected percentile', () => {
12+
// wait for all loading to finish
13+
cy.get('kbnLoadingIndicator').should('not.be.visible');
14+
15+
getDataTestSubj('uxPercentileSelect').click();
16+
17+
getDataTestSubj('p95Percentile').click();
18+
});
19+
20+
Then(`it displays client metric related to that percentile`, () => {
21+
const metrics = ['14 ms', '0.13 s', '55 '];
22+
23+
verifyClientMetrics(metrics, false);
24+
25+
// reset to median
26+
getDataTestSubj('uxPercentileSelect').click();
27+
28+
getDataTestSubj('p50Percentile').click();
29+
});

x-pack/plugins/apm/e2e/cypress/support/step_definitions/csm/url_search_filter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Then(`it displays top pages in the suggestion popover`, () => {
2424
listOfUrls.should('have.length', 5);
2525

2626
const actualUrlsText = [
27-
'http://opbeans-node:3000/dashboardPage views: 17Page load duration: 109 ms ',
27+
'http://opbeans-node:3000/dashboardPage views: 17Page load duration: 109 ms',
2828
'http://opbeans-node:3000/ordersPage views: 14Page load duration: 72 ms',
2929
];
3030

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { DEFAULT_TIMEOUT } from './csm_dashboard';
8+
9+
export function getDataTestSubj(dataTestSubj: string) {
10+
// wait for all loading to finish
11+
cy.get('kbnLoadingIndicator').should('not.be.visible');
12+
13+
return cy.get(`[data-test-subj=${dataTestSubj}]`, DEFAULT_TIMEOUT);
14+
}

x-pack/plugins/apm/public/components/app/RumDashboard/UserPercentile/index.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,27 @@ export function UserPercentile() {
4545
{
4646
value: '50',
4747
inputDisplay: 'P50 (Median)',
48-
'data-test-subj': 'p50-percentile',
48+
'data-test-subj': 'p50Percentile',
4949
},
5050
{
5151
value: '75',
5252
inputDisplay: 'P75',
53-
'data-test-subj': 'p75-percentile',
53+
'data-test-subj': 'p75Percentile',
5454
},
5555
{
5656
value: '90',
5757
inputDisplay: 'P90',
58-
'data-test-subj': 'p90-percentile',
58+
'data-test-subj': 'p90Percentile',
5959
},
6060
{
6161
value: '95',
6262
inputDisplay: 'P95',
63-
'data-test-subj': 'p95-percentile',
63+
'data-test-subj': 'p95Percentile',
6464
},
6565
{
6666
value: '99',
6767
inputDisplay: 'P99',
68-
'data-test-subj': 'p99-percentile',
68+
'data-test-subj': 'p99Percentile',
6969
},
7070
];
7171

@@ -75,6 +75,7 @@ export function UserPercentile() {
7575

7676
return (
7777
<EuiSuperSelect
78+
data-test-subj="uxPercentileSelect"
7879
style={{ width: 150 }}
7980
options={options}
8081
valueOfSelected={String(percentile ?? DEFAULT_P)}

x-pack/plugins/apm/server/routes/rum_client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const rumClientMetricsRoute = createRoute(() => ({
4545
return getClientMetrics({
4646
setup,
4747
urlQuery,
48-
percentile: Number(percentile),
48+
percentile: percentile ? Number(percentile) : undefined,
4949
});
5050
},
5151
}));
@@ -163,7 +163,7 @@ export const rumWebCoreVitals = createRoute(() => ({
163163
return getWebCoreVitals({
164164
setup,
165165
urlQuery,
166-
percentile: Number(percentile),
166+
percentile: percentile ? Number(percentile) : undefined,
167167
});
168168
},
169169
}));

0 commit comments

Comments
 (0)