Skip to content

Commit

Permalink
Add data-testid to the elements missing it on Preferece pages
Browse files Browse the repository at this point in the history
  • Loading branch information
jsolovjo committed Jan 20, 2025
1 parent 28569cd commit 3fc301e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 6 additions & 4 deletions packages/hawtio/src/plugins/connect/ConnectPreferences.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ const JolokiaForm: React.FunctionComponent = () => {
/>
</FormGroup>
<FormGroup fieldId='jolokia-form-apply'>
<Button onClick={applyJolokia}>Apply</Button>
<Button data-testid='apply-jolokia' onClick={applyJolokia}>
Apply
</Button>
<FormHelperText>
<HelperText>
<HelperTextItem>Restart Hawtio with the new values in effect.</HelperTextItem>
Expand Down Expand Up @@ -221,10 +223,10 @@ const ResetForm: React.FunctionComponent = () => {
isOpen={isConfirmModalOpen}
onClose={confirmClear}
actions={[
<Button key='reset' variant='danger' onClick={clear}>
<Button key='reset' data-testid='modal-reset-connections' variant='danger' onClick={clear}>
Clear
</Button>,
<Button key='cancel' variant='link' onClick={confirmClear}>
<Button key='cancel' data-testid='modal-cancel-reset-connections' variant='link' onClick={confirmClear}>
Cancel
</Button>,
]}
Expand All @@ -236,7 +238,7 @@ const ResetForm: React.FunctionComponent = () => {
return (
<FormSection title='Reset' titleElement='h2'>
<FormGroup label='Clear saved connections' fieldId='reset-form-clear'>
<Button variant='danger' onClick={confirmClear}>
<Button data-testid='reset-connections' variant='danger' onClick={confirmClear}>
Clear
</Button>
<ConfirmClearModal />
Expand Down
7 changes: 4 additions & 3 deletions packages/hawtio/src/preferences/HomePreferences.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const UIForm: React.FunctionComponent = () => {
return (
<FormGroup label='Default vertical nav state' fieldId='ui-form-vertical-nav-switch'>
<Switch
data-testid='switch-vertical-nav-state'
label='Show vertical navigation'
labelOff='Hide vertical navigation'
isChecked={showVerticalNav}
Expand Down Expand Up @@ -71,10 +72,10 @@ const ResetForm: React.FunctionComponent = () => {
isOpen={isConfirmResetOpen}
onClose={confirmReset}
actions={[
<Button key='reset' variant='danger' onClick={reset}>
<Button key='reset' data-testid='modal-reset-settings' variant='danger' onClick={reset}>
Reset
</Button>,
<Button key='cancel' variant='link' onClick={confirmReset}>
<Button key='cancel' data-testid='modal-cancel-reset-settings' variant='link' onClick={confirmReset}>
Cancel
</Button>,
]}
Expand All @@ -88,7 +89,7 @@ const ResetForm: React.FunctionComponent = () => {
return (
<React.Fragment>
<FormGroup label='Reset settings' fieldId='reset-form-reset'>
<Button variant='danger' onClick={confirmReset}>
<Button data-testid='reset-settings' variant='danger' onClick={confirmReset}>
Reset
</Button>
<FormHelperText>
Expand Down

0 comments on commit 3fc301e

Please sign in to comment.