Skip to content

Commit

Permalink
[DataUsage][Serverless] Add missing tests (elastic#198007)
Browse files Browse the repository at this point in the history
## Summary

Adds missing UX/API tests for changes added in 
- elastic#193966
- elastic#197056
- elastic#195556
- elastic#196559


### Checklist
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
ashokaditya and kibanamachine authored Nov 7, 2024
1 parent 1e38446 commit 207894e
Show file tree
Hide file tree
Showing 20 changed files with 1,344 additions and 215 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
/* eslint-disable no-console */
export const dataUsageTestQueryClientOptions = {
defaultOptions: {
queries: {
retry: false,
cacheTime: 0,
},
},
logger: {
log: console.log,
warn: console.warn,
error: () => {},
},
};
7 changes: 5 additions & 2 deletions x-pack/plugins/data_usage/public/app/components/charts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@ import { EuiFlexGroup } from '@elastic/eui';
import { MetricTypes } from '../../../common/rest_types';
import { ChartPanel } from './chart_panel';
import { UsageMetricsResponseSchemaBody } from '../../../common/rest_types';
import { useTestIdGenerator } from '../../hooks/use_test_id_generator';
interface ChartsProps {
data: UsageMetricsResponseSchemaBody;
'data-test-subj'?: string;
}

export const Charts: React.FC<ChartsProps> = ({ data }) => {
export const Charts: React.FC<ChartsProps> = ({ data, 'data-test-subj': dataTestSubj }) => {
const getTestId = useTestIdGenerator(dataTestSubj);
const [popoverOpen, setPopoverOpen] = useState<string | null>(null);
const togglePopover = useCallback((streamName: string | null) => {
setPopoverOpen((prev) => (prev === streamName ? null : streamName));
}, []);

return (
<EuiFlexGroup direction="column">
<EuiFlexGroup direction="column" data-test-subj={getTestId('charts')}>
{Object.entries(data.metrics).map(([metricType, series], idx) => (
<ChartPanel
key={metricType}
Expand Down
Loading

0 comments on commit 207894e

Please sign in to comment.