Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data-testid to the elements missing it on Preference pages #1304

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 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 @@ -215,16 +217,17 @@ const ResetForm: React.FunctionComponent = () => {

const ConfirmClearModal = () => (
<Modal
data-testid='clear-connections-modal'
variant={ModalVariant.small}
title='Clear saved connections'
titleIconVariant='danger'
isOpen={isConfirmModalOpen}
onClose={confirmClear}
actions={[
<Button key='reset' variant='danger' onClick={clear}>
<Button key='reset' data-testid='clear-btn' variant='danger' onClick={clear}>
Clear
</Button>,
<Button key='cancel' variant='link' onClick={confirmClear}>
<Button key='cancel' data-testid='cancel-btn' variant='link' onClick={confirmClear}>
Cancel
</Button>,
]}
Expand All @@ -236,7 +239,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='clear-btn' variant='danger' onClick={confirmClear}>
Clear
</Button>
<ConfirmClearModal />
Expand Down
8 changes: 5 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 All @@ -65,16 +66,17 @@ const ResetForm: React.FunctionComponent = () => {

const ConfirmResetModal = () => (
<Modal
data-testid='reset-settings-modal'
variant={ModalVariant.small}
title='Reset settings'
titleIconVariant='danger'
isOpen={isConfirmResetOpen}
onClose={confirmReset}
actions={[
<Button key='reset' variant='danger' onClick={reset}>
<Button key='reset' data-testid='reset-btn' variant='danger' onClick={reset}>
Reset
</Button>,
<Button key='cancel' variant='link' onClick={confirmReset}>
<Button key='cancel' data-testid='cancel-btn' variant='link' onClick={confirmReset}>
Cancel
</Button>,
]}
Expand All @@ -88,7 +90,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-btn' variant='danger' onClick={confirmReset}>
mmuzikar marked this conversation as resolved.
Show resolved Hide resolved
Reset
</Button>
<FormHelperText>
Expand Down
Loading