Skip to content

Commit

Permalink
[#937] Missing Test IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
JanJaroszczak committed May 8, 2024
1 parent 18b3c51 commit 3ef72f2
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const AutomatedVotingCard = ({
mt: inProgress || isSelected ? 2 : 0,
py: 2.25,
}}
data-testid={`${testIdLabel}-card`}
>
<Box
sx={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ export const VoteActionForm = ({
? "11.5px"
: "14px",
}}
data-testid="provide-context-button"
>
{voteContextText
? t("govActions.provideNewContextAboutYourVote")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ export const AutomatedVotingOptions = ({
/>
)}
</AccordionSummary>
<AccordionDetails sx={{ p: { xxs: 2, md: 3 }, pt: { xxs: 0, md: 0 } }}>
<AccordionDetails
sx={{ p: { xxs: 2, md: 3 }, pt: { xxs: 0, md: 0 } }}
data-testid="delegation-options-dropdown"
>
<Box
sx={{
display: "flex",
Expand Down
3 changes: 2 additions & 1 deletion govtool/frontend/src/components/organisms/BgCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { BgCardProps } from "./types";

export const BgCard = ({
actionButtonLabel,
actionButtonDataTestId,
backButtonLabel,
children,
isLoadingActionButton,
Expand Down Expand Up @@ -51,7 +52,7 @@ export const BgCard = ({
const renderContinueButton = useMemo(
() => (
<Button
data-testid="retire-button"
data-testid={actionButtonDataTestId ?? "continue-button"}
disabled={isActionButtonDisabled}
isLoading={isLoadingActionButton}
onClick={onClickActionButton}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const DRepDashboardCard = ({
>
{voter?.isRegisteredAsDRep && !pendingTransaction?.retireAsDrep && (
<CopyableInfo
dataTestId="my-drep-id"
dataTestId="dRep-id-display-card-dashboard"
label={t("dashboard.cards.drep.yourDRepId")}
sx={{ mt: 1 }}
value={dRepIDBech32}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const DelegateDashboardCard = ({
buttons: [
{
children: t("dashboard.cards.delegation.noDelegationActionButton"),
dataTestId: "delegate-button",
dataTestId: "view-drep-directory-button",
onClick: () => navigate(PATHS.dashboardDRepDirectory),
variant: "contained",
},
Expand Down
2 changes: 1 addition & 1 deletion govtool/frontend/src/components/organisms/HomeCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const HomeCards = () => {
>
{/* DELEGATE CARD */}
<ActionCard
dataTestIdFirstButton="delegate-connect-wallet-button"
dataTestIdFirstButton="view-drep-directory-button"
dataTestIdSecondButton="delegate-learn-more-button"
description={t("home.cards.delegate.description")}
firstButtonAction={navigateToDRepDirecotry}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const DRepStorageInformation = ({
return (
<BgCard
actionButtonLabel={t("submit")}
actionButtonDataTestId="register-button"
backButtonLabel={t("back")}
isActionButtonDisabled={isActionButtonDisabled}
isLoadingActionButton={isRegistrationAsDRepLoading}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const RegisterAsDRepForm = ({
placeholder={Placeholders.LINK}
name={`links.${index}.link`}
rules={Rules.LINK}
data-testid="link-input"
/>
)),
[errors, links],
Expand Down Expand Up @@ -102,6 +103,7 @@ export const RegisterAsDRepForm = ({
name="dRepName"
rules={Rules.DREP_NAME}
placeholder={t("forms.registerAsDRep.dRepNamePlaceholder")}
dataTestId="name-input"
/>
<Spacer y={isMobile ? 5 : 6} />
<Box textAlign="center">
Expand All @@ -119,6 +121,7 @@ export const RegisterAsDRepForm = ({
name="email"
placeholder={t("forms.registerAsDRep.emailPlaceholder")}
rules={Rules.EMAIL}
data-testid="email-input"
/>
<Spacer y={3} />
<ControlledField.TextArea
Expand All @@ -128,6 +131,7 @@ export const RegisterAsDRepForm = ({
placeholder={t("forms.registerAsDRep.bioPlaceholder")}
helpfulText={t("forms.registerAsDRep.bioHelpfulText")}
rules={Rules.BIO}
data-testid="bio-input"
/>
<Spacer y={4} />
<p
Expand All @@ -149,7 +153,12 @@ export const RegisterAsDRepForm = ({
<Spacer y={3} />
{renderLinks()}
{links?.length < MAX_NUMBER_OF_LINKS ? (
<Button onClick={addLink} size="extraLarge" variant="text">
<Button
onClick={addLink}
size="extraLarge"
variant="text"
data-testid="add-link-button"
>
{t("addLink")}
</Button>
) : null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export const WhatRetirementMeans = ({
return (
<BgCard
actionButtonLabel={t("retirement.continue")}
actionButtonDataTestId="continue-retirement-button"
backButtonLabel={t("cancel")}
isLoadingActionButton={isRetirementLoading}
onClickActionButton={retireAsDrep}
Expand Down
1 change: 1 addition & 0 deletions govtool/frontend/src/components/organisms/TopNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export const TopNav = ({ isConnectButton = true }) => {
alt="drawer-icon"
src={ICONS.drawerIcon}
onClick={openDrawer}
data-testid="open-drawer-button"
/>
)}
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const VoteContextText = ({
{...{ control, errors }}
{...fieldProps}
isModifiedLayout
data-testid="provide-context-input"
/>
</VoteContextWrapper>
);
Expand Down
1 change: 1 addition & 0 deletions govtool/frontend/src/components/organisms/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Dispatch, SetStateAction } from "react";

export type BgCardProps = {
actionButtonLabel: string;
actionButtonDataTestId?: string;
backButtonLabel?: string;
children: React.ReactNode;
isLoadingActionButton?: boolean;
Expand Down

0 comments on commit 3ef72f2

Please sign in to comment.