Skip to content

Commit

Permalink
Fixes #37213 - Add missing ouia-ids
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaAga authored and adamruzicka committed Apr 8, 2024
1 parent b06991c commit ed7fb71
Show file tree
Hide file tree
Showing 34 changed files with 107 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
"extends": [
"plugin:@theforeman/foreman/core",
"plugin:@theforeman/foreman/plugins"
]
],
"rules":{
"@theforeman/rules/require-ouiaid": ["error"]
}
}
6 changes: 5 additions & 1 deletion webpack/JobWizard/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const Footer = ({ canSubmit, onSave }) => {
return (
<>
<Button
ouiaId="next-footer"
variant="primary"
type="submit"
onClick={onNext}
Expand All @@ -36,6 +37,7 @@ export const Footer = ({ canSubmit, onSave }) => {
: __('Next')}
</Button>
<Button
ouiaId="back-footer"
variant="secondary"
onClick={onBack}
isDisabled={
Expand All @@ -54,6 +56,7 @@ export const Footer = ({ canSubmit, onSave }) => {
}
>
<Button
ouiaId="run-on-selected-hosts-footer"
variant="tertiary"
onClick={onSave}
isAriaDisabled={!canSubmit}
Expand All @@ -74,6 +77,7 @@ export const Footer = ({ canSubmit, onSave }) => {
}
>
<Button
ouiaId="skip-to-review-footer"
variant="tertiary"
onClick={() => goToStepByName(WIZARD_TITLES.review)}
isAriaDisabled={!canSubmit}
Expand All @@ -82,7 +86,7 @@ export const Footer = ({ canSubmit, onSave }) => {
{__('Skip to review')}
</Button>
</Tooltip>
<Button variant="link" onClick={onClose}>
<Button ouiaId="cancel-footer" variant="link" onClick={onClose}>
{__('Cancel')}
</Button>
{isSubmitting && (
Expand Down
3 changes: 3 additions & 0 deletions webpack/JobWizard/JobWizardPageRerun.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const JobWizardPageRerun = ({
searchable={false}
toolbarButtons={
<Button
ouiaId="job-wizard-rerun-old-form-button"
variant="link"
component="a"
href={`/old/job_invocations/${id}/rerun${search}`}
Expand All @@ -71,6 +72,7 @@ const JobWizardPageRerun = ({
<React.Fragment>
{jobOrganization?.id !== currentOrganization?.id && (
<Alert
ouiaId="job-wizard-alert-organization"
isInline
className="job-wizard-alert"
variant="warning"
Expand All @@ -85,6 +87,7 @@ const JobWizardPageRerun = ({
)}
{jobLocation?.id !== currentLocation?.id && (
<Alert
ouiaId="job-wizard-alert-location"
isInline
className="job-wizard-alert"
variant="warning"
Expand Down
1 change: 1 addition & 0 deletions webpack/JobWizard/StartsBeforeErrorAlert.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { translate as __ } from 'foremanReact/common/I18n';
export const StartsBeforeErrorAlert = () => (
<>
<Alert
ouiaId="starts-before-error-alert"
variant="danger"
title={__("'Starts before' date must in the future")}
>
Expand Down
1 change: 1 addition & 0 deletions webpack/JobWizard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const JobWizardPage = ({ location: { search } }) => {
searchable={false}
toolbarButtons={
<Button
ouiaId="legacy-form"
variant="link"
component="a"
href={`/old/job_invocations/new${search}`}
Expand Down
9 changes: 8 additions & 1 deletion webpack/JobWizard/steps/AdvancedFields/DescriptionField.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ export const DescriptionField = ({
}
fieldId="description"
helperText={
<Button variant="link" isInline onClick={togglePreview}>
<Button
ouiaId="description-preview-button"
variant="link"
isInline
onClick={togglePreview}
>
{isPreview
? __('Edit job description template')
: __('Preview job description')}
Expand All @@ -68,6 +73,7 @@ export const DescriptionField = ({
<div>
{/* div wrapper so the tooltip will be shown in chrome */}
<TextInput
ouiaId="description-preview"
aria-label="description preview"
id="description-preview"
value={generatedDesc}
Expand All @@ -77,6 +83,7 @@ export const DescriptionField = ({
</Tooltip>
) : (
<TextInput
ouiaId="description-edit"
aria-label="description edit"
type="text"
autoComplete="description"
Expand Down
7 changes: 7 additions & 0 deletions webpack/JobWizard/steps/AdvancedFields/Fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const EffectiveUserField = ({ value, setValue, defaultValue }) => (
labelInfo={<ResetDefault setValue={setValue} defaultValue={defaultValue} />}
>
<TextInput
ouiaId="effective-user"
aria-label="effective user"
autoComplete="effective-user"
id="effective-user"
Expand Down Expand Up @@ -86,6 +87,7 @@ export const PasswordField = ({ value, setValue }) => (
fieldId="job-password"
>
<TextInput
ouiaId="job-password"
aria-label="job password"
autoComplete="new-password" // to prevent firefox from autofilling the user password
id="job-password"
Expand All @@ -109,6 +111,7 @@ export const KeyPassphraseField = ({ value, setValue }) => (
fieldId="key-passphrase"
>
<TextInput
ouiaId="key-passphrase"
aria-label="key passphrase"
autoComplete="key-passphrase"
id="key-passphrase"
Expand All @@ -132,6 +135,7 @@ export const EffectiveUserPasswordField = ({ value, setValue }) => (
fieldId="effective-user-password"
>
<TextInput
ouiaId="effective-user-password"
aria-label="effective userpassword"
autoComplete="effective-user-password"
id="effective-user-password"
Expand Down Expand Up @@ -186,6 +190,7 @@ export const ExecutionOrderingField = ({ isRandomizedOrdering, setValue }) => (
isInline
>
<Radio
ouiaId="execution-order-alphabetical"
aria-label="execution order alphabetical"
isChecked={!isRandomizedOrdering}
name="execution-order"
Expand All @@ -194,6 +199,7 @@ export const ExecutionOrderingField = ({ isRandomizedOrdering, setValue }) => (
label={__('Alphabetical')}
/>
<Radio
ouiaId="execution-order-randomized"
aria-label="execution order randomized"
isChecked={isRandomizedOrdering}
name="execution-order"
Expand All @@ -216,6 +222,7 @@ export const SSHUserField = ({ value, setValue, defaultValue }) => (
labelInfo={<ResetDefault setValue={setValue} defaultValue={defaultValue} />}
>
<TextInput
ouiaId="ssh-user"
aria-label="ssh user"
autoComplete="ssh-user"
id="ssh-user"
Expand Down
19 changes: 16 additions & 3 deletions webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ export const CategoryAndTemplate = ({
return (
<>
<WizardTitle title={WIZARD_TITLES.categoryAndTemplate} />
<Text component={TextVariants.p}>{__('All fields are required.')}</Text>
<Text
ouiaId="category-and-template-required-fields"
component={TextVariants.p}
>
{__('All fields are required.')}
</Text>
<Form>
<SelectField
label={__('Job category')}
Expand All @@ -95,7 +100,11 @@ export const CategoryAndTemplate = ({
placeholderText={allTemplatesError ? __('Not available') : ''}
/>
{!isEmpty(missingPermissions) && (
<Alert variant="warning" title={__('Access denied')}>
<Alert
ouiaId="category-and-template-access-denied"
variant="warning"
title={__('Access denied')}
>
<span>
{__(
`Missing the required permissions: ${missingPermissions.join(
Expand All @@ -106,7 +115,11 @@ export const CategoryAndTemplate = ({
</Alert>
)}
{isError && (
<Alert variant="danger" title={__('Errors:')}>
<Alert
variant="danger"
title={__('Errors:')}
ouiaId="category-and-template-errors"
>
{categoryError && isEmpty(missingPermissions) && (
<span>
{__('Categories list failed with:')} {categoryError}
Expand Down
3 changes: 3 additions & 0 deletions webpack/JobWizard/steps/HostsAndInputs/HostPreviewModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const HostPreviewModal = ({ isOpen, setIsOpen, searchQuery }) => {

return (
<Modal
ouiaId="host-preview-modal"
title={__('Preview Hosts')}
isOpen={isOpen}
onClose={() => setIsOpen(false)}
Expand All @@ -24,6 +25,7 @@ export const HostPreviewModal = ({ isOpen, setIsOpen, searchQuery }) => {
{hosts.map(host => (
<ListItem key={host.name}>
<Button
ouiaId={`host-preview-${host}`}
component="a"
href={foremanUrl(`/hosts/${host.name}`)}
variant="link"
Expand All @@ -38,6 +40,7 @@ export const HostPreviewModal = ({ isOpen, setIsOpen, searchQuery }) => {
{hostsCount > HOSTS_TO_PREVIEW_AMOUNT && (
<ListItem>
<Button
ouiaId="host-preview-more"
component="a"
href={url.addSearch({ search: searchQuery })}
variant="link"
Expand Down
9 changes: 8 additions & 1 deletion webpack/JobWizard/steps/HostsAndInputs/SelectedChips.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const SelectedChip = ({ selected, setSelected, categoryName, setLabel }) => {
return (
<>
<ChipGroup
ouiaId="hosts-chip-group"
className="hosts-chip-group"
categoryName={categoryName}
isClosable
Expand All @@ -26,6 +27,7 @@ const SelectedChip = ({ selected, setSelected, categoryName, setLabel }) => {
>
{selected.map((result, index) => (
<Chip
ouiaId={`${categoryName}-${result.id}`}
key={index}
id={`${categoryName}-${result.id}`}
onClick={() => deleteItem(result.id)}
Expand Down Expand Up @@ -93,7 +95,12 @@ export const SelectedChips = ({
setLabel={setLabel}
/>
{showClear && (
<Button variant="link" className="clear-chips" onClick={clearAll}>
<Button
ouiaId="clear-chips"
variant="link"
className="clear-chips"
onClick={clearAll}
>
{__('Clear all filters')}
</Button>
)}
Expand Down
9 changes: 7 additions & 2 deletions webpack/JobWizard/steps/HostsAndInputs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,10 @@ const HostsAndInputs = ({
clearSearch={clearSearch}
setLabel={setLabel}
/>
<Text>
<Text ouiaId="host-preview-label">
{__('Apply to')}{' '}
<Button
ouiaId="host-preview-open-button"
variant="link"
isInline
onClick={() => setHostPreviewOpen(true)}
Expand All @@ -247,7 +248,11 @@ const HostsAndInputs = ({
setValue={setTemplateValues}
/>
{!isEmpty(missingPermissions) && (
<Alert variant="warning" title={__('Access denied')}>
<Alert
ouiaId="host-access-denied"
variant="warning"
title={__('Access denied')}
>
<span>
{__(
`Missing the required permissions: ${missingPermissions.join(
Expand Down
4 changes: 4 additions & 0 deletions webpack/JobWizard/steps/ReviewDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const ReviewDetails = ({
// eslint-disable-next-line react/prop-types
const StepButton = ({ stepName, children }) => (
<Button
ouiaId={`step-button-${stepName}`}
variant="link"
isInline
onClick={() => {
Expand Down Expand Up @@ -91,6 +92,7 @@ const ReviewDetails = ({
<div>
{hostsCount} {__('hosts')}{' '}
<Button
ouiaId="view-host-names"
variant="link"
isInline
onClick={() => setHostPreviewOpen(true)}
Expand Down Expand Up @@ -140,6 +142,7 @@ const ReviewDetails = ({
),
value: isAdvancedShown ? (
<Button
ouiaId="hide-advanced-fields"
variant="link"
isInline
onClick={() => {
Expand All @@ -150,6 +153,7 @@ const ReviewDetails = ({
</Button>
) : (
<Button
ouiaId="show-advanced-fields"
variant="link"
isInline
onClick={() => {
Expand Down
1 change: 1 addition & 0 deletions webpack/JobWizard/steps/Schedule/PurposeField.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const PurposeField = ({ purpose, setPurpose }) => (
)}
>
<TextInput
ouiaId="purpose"
aria-label="purpose"
type="text"
value={purpose}
Expand Down
2 changes: 2 additions & 0 deletions webpack/JobWizard/steps/Schedule/QueryType.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const QueryType = ({ isTypeStatic, setIsTypeStatic }) => (
)}
>
<Radio
ouiaId="query-type-static"
isChecked={isTypeStatic}
name="query-type"
onChange={() => setIsTypeStatic(true)}
Expand All @@ -25,6 +26,7 @@ export const QueryType = ({ isTypeStatic, setIsTypeStatic }) => (
</FormGroup>
<FormGroup fieldId="query-type-dynamic">
<Radio
ouiaId="query-type-dynamic"
isChecked={!isTypeStatic}
name="query-type"
onChange={() => setIsTypeStatic(false)}
Expand Down
1 change: 1 addition & 0 deletions webpack/JobWizard/steps/Schedule/RepeatCron.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const RepeatCron = ({ repeatData, setRepeatData, setValid }) => {
isRequired
>
<TextInput
ouiaId="cronline"
isRequired
validated={cronline ? ValidatedOptions.noval : ValidatedOptions.error}
aria-label="cronline"
Expand Down
2 changes: 2 additions & 0 deletions webpack/JobWizard/steps/Schedule/RepeatHour.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const RepeatHour = ({ repeatData, setRepeatData }) => {
isRequired
>
<Select
ouiaId="repeat-on-hourly"
id="repeat-on-hourly"
variant={SelectVariant.typeahead}
typeAheadAriaLabel="repeat-at-minute-typeahead"
Expand Down Expand Up @@ -75,6 +76,7 @@ export const RepeatHour = ({ repeatData, setRepeatData }) => {
</Select>
{isAlertOpen && (
<Alert
ouiaId="repeat-on-hourly-alert"
variant="danger"
isInline
title={__('Minute can only be a number between 0-59')}
Expand Down
1 change: 1 addition & 0 deletions webpack/JobWizard/steps/Schedule/RepeatMonth.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const RepeatMonth = ({ repeatData, setRepeatData, setValid }) => {
<>
<FormGroup label={__('Days')} isRequired>
<TextInput
ouiaId="repeat-on-monthly-days"
isRequired
validated={days ? ValidatedOptions.noval : ValidatedOptions.error}
aria-label="days"
Expand Down
1 change: 1 addition & 0 deletions webpack/JobWizard/steps/Schedule/RepeatWeek.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const RepeatWeek = ({ repeatData, setRepeatData, setValid }) => {
<div id="repeat-on-weekly">
{days.map((day, index) => (
<Checkbox
ouiaId={`repeat-on-day-${index}`}
aria-label={`${day} checkbox`}
key={index}
isChecked={daysOfWeek?.[index]}
Expand Down
Loading

0 comments on commit ed7fb71

Please sign in to comment.