diff --git a/packages/react-core/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadStatusItem.test.tsx.snap b/packages/react-core/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadStatusItem.test.tsx.snap index f136529574f..42f15aae2a1 100644 --- a/packages/react-core/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadStatusItem.test.tsx.snap +++ b/packages/react-core/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadStatusItem.test.tsx.snap @@ -33,6 +33,8 @@ exports[`MultipleFileUploadStatusItem renders custom aria labels 1`] = `
, 'size' | 'label' | 'title'> { +export interface ProgressProps extends Omit, 'size' | 'label' | 'title'>, OUIAProps { /** Classname for progress component. */ className?: string; /** Size variant of progress. */ @@ -50,6 +50,10 @@ export interface ProgressProps extends Omit, 'si helperText?: React.ReactNode; /** Flag indicating whether the status icon should be hidden, helpful when space is limited (such as within table cells). When set to true, you must ensure the context of the status is provided in another way, such as via the progress measure. */ hideStatusIcon?: boolean; + /** Value to overwrite the randomly generated data-ouia-component-id.*/ + ouiaId?: number | string; + /** Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */ + ouiaSafe?: boolean; } class Progress extends Component { @@ -70,7 +74,8 @@ class Progress extends Component { tooltipPosition: 'top' as 'auto' | 'top' | 'bottom' | 'left' | 'right', 'aria-label': null as string, 'aria-labelledby': null as string, - 'aria-describedby': null as string + 'aria-describedby': null as string, + ouiaSafe: true }; render() { @@ -94,6 +99,8 @@ class Progress extends Component { 'aria-describedby': ariaDescribedBy, helperText, hideStatusIcon, + ouiaId, + ouiaSafe, ...props } = this.props; @@ -147,6 +154,7 @@ class Progress extends Component { className )} id={id} + {...getOUIAProps(Progress.displayName, ouiaId, ouiaSafe)} > { - const { asFragment } = render(); + const { asFragment } = render(); expect(asFragment()).toMatchSnapshot(); }); @@ -109,6 +109,26 @@ test('Renders passed helper text', () => { expect(screen.getByText('Test helper text')).toBeVisible(); }); +test('Renders with custom ouiaId', () => { + render(); + expect(document.getElementById('progress-ouia-id')).toHaveAttribute('data-ouia-component-id', 'test-id'); +}); + +test('Renders with expected ouia component type', () => { + render(); + expect(document.getElementById('progress-ouia-type')).toHaveAttribute('data-ouia-component-type', 'PF6/Progress'); +}); + +test('Renders with ouiaSafe defaulting to true', () => { + render(); + expect(document.getElementById('progress-ouia-safe')).toHaveAttribute('data-ouia-safe', 'true'); +}); + +test('Renders with ouiaSafe=false when specified', () => { + render(); + expect(document.getElementById('progress-ouia-unsafe')).toHaveAttribute('data-ouia-safe', 'false'); +}); + describe('hideStatusIcon prop behavior', () => { test('shows status icon by default when hideStatusIcon is not set', () => { render(); diff --git a/packages/react-core/src/components/Progress/__tests__/__snapshots__/Progress.test.tsx.snap b/packages/react-core/src/components/Progress/__tests__/__snapshots__/Progress.test.tsx.snap index 9ca69338fcd..dd726271d35 100644 --- a/packages/react-core/src/components/Progress/__tests__/__snapshots__/Progress.test.tsx.snap +++ b/packages/react-core/src/components/Progress/__tests__/__snapshots__/Progress.test.tsx.snap @@ -4,6 +4,8 @@ exports[`Progress measure location inside 1`] = `