Skip to content

Commit ed7fb71

Browse files
MariaAgaadamruzicka
authored andcommitted
Fixes #37213 - Add missing ouia-ids
1 parent b06991c commit ed7fb71

34 files changed

Lines changed: 107 additions & 11 deletions

.eslintrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@
66
"extends": [
77
"plugin:@theforeman/foreman/core",
88
"plugin:@theforeman/foreman/plugins"
9-
]
9+
],
10+
"rules":{
11+
"@theforeman/rules/require-ouiaid": ["error"]
12+
}
1013
}

webpack/JobWizard/Footer.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const Footer = ({ canSubmit, onSave }) => {
2626
return (
2727
<>
2828
<Button
29+
ouiaId="next-footer"
2930
variant="primary"
3031
type="submit"
3132
onClick={onNext}
@@ -36,6 +37,7 @@ export const Footer = ({ canSubmit, onSave }) => {
3637
: __('Next')}
3738
</Button>
3839
<Button
40+
ouiaId="back-footer"
3941
variant="secondary"
4042
onClick={onBack}
4143
isDisabled={
@@ -54,6 +56,7 @@ export const Footer = ({ canSubmit, onSave }) => {
5456
}
5557
>
5658
<Button
59+
ouiaId="run-on-selected-hosts-footer"
5760
variant="tertiary"
5861
onClick={onSave}
5962
isAriaDisabled={!canSubmit}
@@ -74,6 +77,7 @@ export const Footer = ({ canSubmit, onSave }) => {
7477
}
7578
>
7679
<Button
80+
ouiaId="skip-to-review-footer"
7781
variant="tertiary"
7882
onClick={() => goToStepByName(WIZARD_TITLES.review)}
7983
isAriaDisabled={!canSubmit}
@@ -82,7 +86,7 @@ export const Footer = ({ canSubmit, onSave }) => {
8286
{__('Skip to review')}
8387
</Button>
8488
</Tooltip>
85-
<Button variant="link" onClick={onClose}>
89+
<Button ouiaId="cancel-footer" variant="link" onClick={onClose}>
8690
{__('Cancel')}
8791
</Button>
8892
{isSubmitting && (

webpack/JobWizard/JobWizardPageRerun.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const JobWizardPageRerun = ({
4848
searchable={false}
4949
toolbarButtons={
5050
<Button
51+
ouiaId="job-wizard-rerun-old-form-button"
5152
variant="link"
5253
component="a"
5354
href={`/old/job_invocations/${id}/rerun${search}`}
@@ -71,6 +72,7 @@ const JobWizardPageRerun = ({
7172
<React.Fragment>
7273
{jobOrganization?.id !== currentOrganization?.id && (
7374
<Alert
75+
ouiaId="job-wizard-alert-organization"
7476
isInline
7577
className="job-wizard-alert"
7678
variant="warning"
@@ -85,6 +87,7 @@ const JobWizardPageRerun = ({
8587
)}
8688
{jobLocation?.id !== currentLocation?.id && (
8789
<Alert
90+
ouiaId="job-wizard-alert-location"
8891
isInline
8992
className="job-wizard-alert"
9093
variant="warning"

webpack/JobWizard/StartsBeforeErrorAlert.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { translate as __ } from 'foremanReact/common/I18n';
55
export const StartsBeforeErrorAlert = () => (
66
<>
77
<Alert
8+
ouiaId="starts-before-error-alert"
89
variant="danger"
910
title={__("'Starts before' date must in the future")}
1011
>

webpack/JobWizard/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const JobWizardPage = ({ location: { search } }) => {
5959
searchable={false}
6060
toolbarButtons={
6161
<Button
62+
ouiaId="legacy-form"
6263
variant="link"
6364
component="a"
6465
href={`/old/job_invocations/new${search}`}

webpack/JobWizard/steps/AdvancedFields/DescriptionField.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ export const DescriptionField = ({
5656
}
5757
fieldId="description"
5858
helperText={
59-
<Button variant="link" isInline onClick={togglePreview}>
59+
<Button
60+
ouiaId="description-preview-button"
61+
variant="link"
62+
isInline
63+
onClick={togglePreview}
64+
>
6065
{isPreview
6166
? __('Edit job description template')
6267
: __('Preview job description')}
@@ -68,6 +73,7 @@ export const DescriptionField = ({
6873
<div>
6974
{/* div wrapper so the tooltip will be shown in chrome */}
7075
<TextInput
76+
ouiaId="description-preview"
7177
aria-label="description preview"
7278
id="description-preview"
7379
value={generatedDesc}
@@ -77,6 +83,7 @@ export const DescriptionField = ({
7783
</Tooltip>
7884
) : (
7985
<TextInput
86+
ouiaId="description-edit"
8087
aria-label="description edit"
8188
type="text"
8289
autoComplete="description"

webpack/JobWizard/steps/AdvancedFields/Fields.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const EffectiveUserField = ({ value, setValue, defaultValue }) => (
1919
labelInfo={<ResetDefault setValue={setValue} defaultValue={defaultValue} />}
2020
>
2121
<TextInput
22+
ouiaId="effective-user"
2223
aria-label="effective user"
2324
autoComplete="effective-user"
2425
id="effective-user"
@@ -86,6 +87,7 @@ export const PasswordField = ({ value, setValue }) => (
8687
fieldId="job-password"
8788
>
8889
<TextInput
90+
ouiaId="job-password"
8991
aria-label="job password"
9092
autoComplete="new-password" // to prevent firefox from autofilling the user password
9193
id="job-password"
@@ -109,6 +111,7 @@ export const KeyPassphraseField = ({ value, setValue }) => (
109111
fieldId="key-passphrase"
110112
>
111113
<TextInput
114+
ouiaId="key-passphrase"
112115
aria-label="key passphrase"
113116
autoComplete="key-passphrase"
114117
id="key-passphrase"
@@ -132,6 +135,7 @@ export const EffectiveUserPasswordField = ({ value, setValue }) => (
132135
fieldId="effective-user-password"
133136
>
134137
<TextInput
138+
ouiaId="effective-user-password"
135139
aria-label="effective userpassword"
136140
autoComplete="effective-user-password"
137141
id="effective-user-password"
@@ -186,6 +190,7 @@ export const ExecutionOrderingField = ({ isRandomizedOrdering, setValue }) => (
186190
isInline
187191
>
188192
<Radio
193+
ouiaId="execution-order-alphabetical"
189194
aria-label="execution order alphabetical"
190195
isChecked={!isRandomizedOrdering}
191196
name="execution-order"
@@ -194,6 +199,7 @@ export const ExecutionOrderingField = ({ isRandomizedOrdering, setValue }) => (
194199
label={__('Alphabetical')}
195200
/>
196201
<Radio
202+
ouiaId="execution-order-randomized"
197203
aria-label="execution order randomized"
198204
isChecked={isRandomizedOrdering}
199205
name="execution-order"
@@ -216,6 +222,7 @@ export const SSHUserField = ({ value, setValue, defaultValue }) => (
216222
labelInfo={<ResetDefault setValue={setValue} defaultValue={defaultValue} />}
217223
>
218224
<TextInput
225+
ouiaId="ssh-user"
219226
aria-label="ssh user"
220227
autoComplete="ssh-user"
221228
id="ssh-user"

webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@ export const CategoryAndTemplate = ({
7171
return (
7272
<>
7373
<WizardTitle title={WIZARD_TITLES.categoryAndTemplate} />
74-
<Text component={TextVariants.p}>{__('All fields are required.')}</Text>
74+
<Text
75+
ouiaId="category-and-template-required-fields"
76+
component={TextVariants.p}
77+
>
78+
{__('All fields are required.')}
79+
</Text>
7580
<Form>
7681
<SelectField
7782
label={__('Job category')}
@@ -95,7 +100,11 @@ export const CategoryAndTemplate = ({
95100
placeholderText={allTemplatesError ? __('Not available') : ''}
96101
/>
97102
{!isEmpty(missingPermissions) && (
98-
<Alert variant="warning" title={__('Access denied')}>
103+
<Alert
104+
ouiaId="category-and-template-access-denied"
105+
variant="warning"
106+
title={__('Access denied')}
107+
>
99108
<span>
100109
{__(
101110
`Missing the required permissions: ${missingPermissions.join(
@@ -106,7 +115,11 @@ export const CategoryAndTemplate = ({
106115
</Alert>
107116
)}
108117
{isError && (
109-
<Alert variant="danger" title={__('Errors:')}>
118+
<Alert
119+
variant="danger"
120+
title={__('Errors:')}
121+
ouiaId="category-and-template-errors"
122+
>
110123
{categoryError && isEmpty(missingPermissions) && (
111124
<span>
112125
{__('Categories list failed with:')} {categoryError}

webpack/JobWizard/steps/HostsAndInputs/HostPreviewModal.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const HostPreviewModal = ({ isOpen, setIsOpen, searchQuery }) => {
1515

1616
return (
1717
<Modal
18+
ouiaId="host-preview-modal"
1819
title={__('Preview Hosts')}
1920
isOpen={isOpen}
2021
onClose={() => setIsOpen(false)}
@@ -24,6 +25,7 @@ export const HostPreviewModal = ({ isOpen, setIsOpen, searchQuery }) => {
2425
{hosts.map(host => (
2526
<ListItem key={host.name}>
2627
<Button
28+
ouiaId={`host-preview-${host}`}
2729
component="a"
2830
href={foremanUrl(`/hosts/${host.name}`)}
2931
variant="link"
@@ -38,6 +40,7 @@ export const HostPreviewModal = ({ isOpen, setIsOpen, searchQuery }) => {
3840
{hostsCount > HOSTS_TO_PREVIEW_AMOUNT && (
3941
<ListItem>
4042
<Button
43+
ouiaId="host-preview-more"
4144
component="a"
4245
href={url.addSearch({ search: searchQuery })}
4346
variant="link"

webpack/JobWizard/steps/HostsAndInputs/SelectedChips.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const SelectedChip = ({ selected, setSelected, categoryName, setLabel }) => {
1414
return (
1515
<>
1616
<ChipGroup
17+
ouiaId="hosts-chip-group"
1718
className="hosts-chip-group"
1819
categoryName={categoryName}
1920
isClosable
@@ -26,6 +27,7 @@ const SelectedChip = ({ selected, setSelected, categoryName, setLabel }) => {
2627
>
2728
{selected.map((result, index) => (
2829
<Chip
30+
ouiaId={`${categoryName}-${result.id}`}
2931
key={index}
3032
id={`${categoryName}-${result.id}`}
3133
onClick={() => deleteItem(result.id)}
@@ -93,7 +95,12 @@ export const SelectedChips = ({
9395
setLabel={setLabel}
9496
/>
9597
{showClear && (
96-
<Button variant="link" className="clear-chips" onClick={clearAll}>
98+
<Button
99+
ouiaId="clear-chips"
100+
variant="link"
101+
className="clear-chips"
102+
onClick={clearAll}
103+
>
97104
{__('Clear all filters')}
98105
</Button>
99106
)}

0 commit comments

Comments
 (0)