|
@@ -6,6 +6,7 @@ import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
|
|
|
import {t} from 'sentry/locale';
|
|
|
import {Organization} from 'sentry/types/organization';
|
|
|
import {Project} from 'sentry/types/project';
|
|
|
+import EventView from 'sentry/utils/discover/eventView';
|
|
|
import {DisplayModes} from 'sentry/utils/discover/types';
|
|
|
import {MetricsCardinalityProvider} from 'sentry/utils/performance/contexts/metricsCardinality';
|
|
|
import ChartFooter from 'sentry/views/eventsV2/chartFooter';
|
|
@@ -40,12 +41,18 @@ function metricsCardinalityWrapped(
|
|
|
describe('EventsV2 > ChartFooter', function () {
|
|
|
const features = ['discover-basic'];
|
|
|
const yAxisValue = ['count()', 'failure_count()'];
|
|
|
- const yAxisOptions = [
|
|
|
+ let yAxisOptions = [
|
|
|
{label: 'count()', value: 'count()'},
|
|
|
{label: 'failure_count()', value: 'failure_count()'},
|
|
|
];
|
|
|
-
|
|
|
const project = TestStubs.Project();
|
|
|
+ const eventView = EventView.fromSavedQuery({
|
|
|
+ id: '',
|
|
|
+ name: 'test query',
|
|
|
+ version: 2,
|
|
|
+ fields: ['transaction', 'count()'],
|
|
|
+ projects: [project.id],
|
|
|
+ });
|
|
|
|
|
|
afterEach(function () {});
|
|
|
|
|
@@ -78,6 +85,7 @@ describe('EventsV2 > ChartFooter', function () {
|
|
|
topEvents="5"
|
|
|
showBaseline={false}
|
|
|
setShowBaseline={() => undefined}
|
|
|
+ eventView={eventView}
|
|
|
/>
|
|
|
);
|
|
|
|
|
@@ -121,6 +129,7 @@ describe('EventsV2 > ChartFooter', function () {
|
|
|
topEvents="5"
|
|
|
showBaseline={false}
|
|
|
setShowBaseline={() => undefined}
|
|
|
+ eventView={eventView}
|
|
|
/>
|
|
|
);
|
|
|
|
|
@@ -156,6 +165,7 @@ describe('EventsV2 > ChartFooter', function () {
|
|
|
topEvents="5"
|
|
|
showBaseline={false}
|
|
|
setShowBaseline={() => undefined}
|
|
|
+ eventView={eventView}
|
|
|
/>
|
|
|
);
|
|
|
|
|
@@ -185,6 +195,7 @@ describe('EventsV2 > ChartFooter', function () {
|
|
|
topEvents="5"
|
|
|
showBaseline={false}
|
|
|
setShowBaseline={() => undefined}
|
|
|
+ eventView={eventView}
|
|
|
/>
|
|
|
);
|
|
|
|
|
@@ -210,11 +221,16 @@ describe('EventsV2 > ChartFooter', function () {
|
|
|
],
|
|
|
});
|
|
|
|
|
|
+ yAxisOptions = [
|
|
|
+ {label: 'count()', value: 'count()'},
|
|
|
+ {label: 'p50(measurements.lcp)', value: 'p50(measurements.lcp)'},
|
|
|
+ ];
|
|
|
+
|
|
|
const chartFooter = (
|
|
|
<ChartFooter
|
|
|
organization={organization}
|
|
|
total={100}
|
|
|
- yAxisValue={['count()']}
|
|
|
+ yAxisValue={['p50(measurements.lcp)']}
|
|
|
yAxisOptions={yAxisOptions}
|
|
|
onAxisChange={jest.fn}
|
|
|
displayMode={DisplayModes.DEFAULT}
|
|
@@ -224,6 +240,7 @@ describe('EventsV2 > ChartFooter', function () {
|
|
|
topEvents="5"
|
|
|
showBaseline={false}
|
|
|
setShowBaseline={() => undefined}
|
|
|
+ eventView={eventView}
|
|
|
/>
|
|
|
);
|
|
|
|
|
@@ -233,6 +250,51 @@ describe('EventsV2 > ChartFooter', function () {
|
|
|
expect(screen.getByTestId('processed-events-toggle')).toBeEnabled();
|
|
|
});
|
|
|
|
|
|
+ it('disables toggle if discover hits the events dataset', function () {
|
|
|
+ addMetricsDataMock({
|
|
|
+ metricsCount: 100,
|
|
|
+ nullCount: 0,
|
|
|
+ unparamCount: 1,
|
|
|
+ });
|
|
|
+
|
|
|
+ yAxisOptions = [
|
|
|
+ {label: 'count()', value: 'count()'},
|
|
|
+ {label: 'failure_count()', value: 'failure_count()'},
|
|
|
+ ];
|
|
|
+
|
|
|
+ const organization = TestStubs.Organization({
|
|
|
+ features: [
|
|
|
+ ...features,
|
|
|
+ 'discover-metrics-baseline',
|
|
|
+ 'performance-transaction-name-only-search',
|
|
|
+ 'organizations:performance-transaction-name-only-search',
|
|
|
+ ],
|
|
|
+ });
|
|
|
+
|
|
|
+ const chartFooter = (
|
|
|
+ <ChartFooter
|
|
|
+ organization={organization}
|
|
|
+ total={100}
|
|
|
+ yAxisValue={['count()']}
|
|
|
+ yAxisOptions={yAxisOptions}
|
|
|
+ onAxisChange={jest.fn}
|
|
|
+ displayMode={DisplayModes.DEFAULT}
|
|
|
+ displayOptions={[{label: DisplayModes.DEFAULT, value: DisplayModes.DEFAULT}]}
|
|
|
+ onDisplayChange={() => undefined}
|
|
|
+ onTopEventsChange={() => undefined}
|
|
|
+ topEvents="5"
|
|
|
+ showBaseline={false}
|
|
|
+ setShowBaseline={() => undefined}
|
|
|
+ eventView={eventView}
|
|
|
+ />
|
|
|
+ );
|
|
|
+
|
|
|
+ render(metricsCardinalityWrapped(chartFooter, organization, project));
|
|
|
+
|
|
|
+ expect(screen.getByText(/Processed events/i)).toBeInTheDocument();
|
|
|
+ expect(screen.getByTestId('processed-events-toggle')).toBeDisabled();
|
|
|
+ });
|
|
|
+
|
|
|
it('renders multi value y-axis dropdown selector on a non-Top display', function () {
|
|
|
const organization = TestStubs.Organization({
|
|
|
features,
|
|
@@ -253,6 +315,7 @@ describe('EventsV2 > ChartFooter', function () {
|
|
|
topEvents="5"
|
|
|
showBaseline={false}
|
|
|
setShowBaseline={() => undefined}
|
|
|
+ eventView={eventView}
|
|
|
/>
|
|
|
);
|
|
|
|