Skip to content

Commit

Permalink
Add name properties in 'Add cert. map. data' modal
Browse files Browse the repository at this point in the history
The `name` parameters are helful to
identify some section of the DOM tree
while writing the tests.

The 'Certificate mapping data` add
modal (under user detail page) lacks of
some names, making difficult the navigation
through the HTML elements. These needs to
be assigned for all the elements where
there is no way to be identified.

Signed-off-by: Carla Martinez <[email protected]>
  • Loading branch information
carma12 committed Mar 11, 2024
1 parent b9deb55 commit 4c3fb44
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
18 changes: 13 additions & 5 deletions src/components/CertificateMappingDataOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ const CertificateMappingDataOption = (
<Flex
direction={{ default: "row" }}
key={"ipacertmapdata-" + idx + "-div"}
name="value"
name={"flex-ipacertmapdata-" + idx + "-div"}
>
<FlexItem
key={"ipacertmapdata-" + idx + "-textbox"}
flex={{ default: "flex_1" }}
name={"flexitem-ipacertmapdata-" + idx + "-div"}
>
<TextInput
id="cert-map-data"
Expand All @@ -117,6 +118,7 @@ const CertificateMappingDataOption = (
))}
</Flex>
<SecondaryButton
name={"add-ipacertmapdata"}
classname="pf-v5-u-mt-sm pf-v5-u-mb-0"
isDisabled={!props.isCertMappingDataChecked}
onClickHandler={onAddCertificateMappingDataHandler}
Expand Down Expand Up @@ -156,12 +158,12 @@ const CertificateMappingDataOption = (
{certificateListCopy.map((certificate, idx) => (
<Flex
direction={{ default: "row" }}
key={"certificate-" + idx + "-div"}
key={"flex-certificate-" + idx + "-div"}
alignItems={{ default: "alignItemsFlexEnd" }}
name="value"
name={"flex-certificate-" + idx + "-div"}
>
<FlexItem
key={"certificate-" + idx + "-textbox"}
key={"flexitem-certificate-" + idx + "-textbox"}
flex={{ default: "flex_1" }}
>
<TextArea
Expand All @@ -177,7 +179,10 @@ const CertificateMappingDataOption = (
style={{ height: "135px" }}
/>
</FlexItem>
<FlexItem key={"certificate-" + idx + "-delete-button"}>
<FlexItem
key={"certificate-" + idx + "-delete-button"}
name={"certificate-" + idx + "-delete-button"}
>
<SecondaryButton
name="remove"
onClickHandler={() => onRemoveCertificateHandler(idx)}
Expand All @@ -189,6 +194,7 @@ const CertificateMappingDataOption = (
))}
</Flex>
<SecondaryButton
name={"add-certificate"}
classname="pf-v5-u-mt-sm"
isDisabled={!props.isCertMappingDataChecked}
onClickHandler={onAddCertificateHandler}
Expand Down Expand Up @@ -220,6 +226,7 @@ const CertificateMappingDataOption = (
<FormGroup
label="Certificate mapping data"
fieldId="certificate-mapping-data-modal"
name={"certificate-mapping-data-section"}
>
<>{certificateMappingDataElement}</>
</FormGroup>
Expand All @@ -232,6 +239,7 @@ const CertificateMappingDataOption = (
hasAutoWidth={true}
/>
}
name={"certificate-section"}
>
<>{certificateElement}</>
</FormGroup>
Expand Down
8 changes: 7 additions & 1 deletion src/components/Form/IpaCertificateMappingData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,16 @@ const IpaCertificateMappingData = (props: PropsToIpaCertificateMappingData) => {
spinnerAriaValueText="Adding"
spinnerAriaLabelledBy="Adding"
spinnerAriaLabel="Adding"
name={"add-certificate-mapping-data-modal"}
>
{modalSpinning ? "Adding" : "Add"}
</SecondaryButton>,
<Button key="cancel" variant="link" onClick={onClose}>
<Button
key="cancel"
variant="link"
onClick={onClose}
name={"cancel-certificate.mapping-data-modal"}
>
Cancel
</Button>,
];
Expand Down
6 changes: 4 additions & 2 deletions src/components/IssuerAndSubjectOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const IssuerAndSubjectOption = (props: PropsToIssuerAndSubjectOption) => {
id="issuer-and-subject"
className="pf-v5-u-mb-md"
/>
<div className="pf-v5-u-ml-lg pf-v5-u-mb-md">
<div className="pf-v5-u-ml-lg pf-v5-u-mb-md" id="issuer-and-subject">
<Form>
<FormGroup
label="Issuer"
Expand All @@ -70,9 +70,10 @@ const IssuerAndSubjectOption = (props: PropsToIssuerAndSubjectOption) => {
/>
}
isRequired={props.isIssuerAndSubjectChecked}
name="issuer-formgroup"
>
<TextInput
id="issuer-textbox"
id="issuer"
value={props.issuerValue}
type="text"
name="issuer"
Expand All @@ -92,6 +93,7 @@ const IssuerAndSubjectOption = (props: PropsToIssuerAndSubjectOption) => {
/>
}
isRequired={props.isIssuerAndSubjectChecked}
name="subject-formgroup"
>
<TextInput
id="subject-textbox"
Expand Down

0 comments on commit 4c3fb44

Please sign in to comment.