Skip to content

Commit a5a8344

Browse files
Merge pull request #296 from IntersectMBO/fix/--Proposal-budget-submission]-Missing-test-IDs-(3339)
fix/ [Proposal budget submission] Missing test IDs (3339)
2 parents 41106a5 + 8e06393 commit a5a8344

File tree

6 files changed

+77
-51
lines changed

6 files changed

+77
-51
lines changed

pdf-ui/src/components/BudgetDiscussionCard/index.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,7 @@ const BudgetDiscussionCard = ({
498498
display={'flex'}
499499
alignItems={'center'}
500500
>
501-
<IconButton
502-
// data-testid={`proposal-${proposal?.id}-comment-count`}
503-
disabled={true}
504-
>
501+
<IconButton disabled={true}>
505502
<StyledBadge
506503
badgeContent={
507504
budgetDiscussion
@@ -511,6 +508,7 @@ const BudgetDiscussionCard = ({
511508
}
512509
aria-label='comments'
513510
showZero
511+
data-testid={`budget-discussion-${budgetDiscussion?.id}-comment-count`}
514512
></StyledBadge>
515513
<IconChatAlt />
516514
</IconButton>

pdf-ui/src/components/BudgetDiscussionParts/AdministrationAndAuditing/index.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,10 @@ const AdministrationAndAuditing = ({
361361
// helperText={errors['intersect_admin_further_text']?.trim()}
362362
// error={!!errors['intersect_admin_further_text']?.trim()}
363363
sx={{ mb: 2 }}
364+
InputProps={{
365+
'data-testid':
366+
'intersect-admin-further-text',
367+
}}
364368
/>
365369
)}
366370
</Box>

pdf-ui/src/components/BudgetDiscussionParts/BudgetDiscussionReview/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,7 @@ const BudgetDiscussionReview = ({
705705
href={link.prop_link}
706706
target='_blank'
707707
rel='noopener noreferrer'
708+
data-testid={`link-${index}-label`}
708709
>
709710
<Typography
710711
style={{

pdf-ui/src/components/BudgetDiscussionParts/ProblemStatementsAndProposalBenefits/index.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,12 @@ const ProblemStatementsAndProposalBenefits = ({
335335
'explain_proposal_roadmap'
336336
)
337337
}
338+
InputProps={{
339+
inputProps: {
340+
'data-testid':
341+
'proposal-roadmap-description-input',
342+
},
343+
}}
338344
sx={{ mb: 2 }}
339345
/>
340346
) : null}

pdf-ui/src/components/BudgetDiscussionParts/ProposalOwnership/index.jsx

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -150,26 +150,33 @@ const ProposalOwnership = ({
150150
onChange={(e) => {
151151
handleSubmitedOnBehalfChange(e);
152152
}}
153-
// SelectProps={{
154-
// SelectDisplayProps: {
155-
// 'data-testid': '',
156-
// },
157-
// }}
158-
InputProps={{
159-
inputProps: {
153+
SelectProps={{
154+
SelectDisplayProps: {
160155
'data-testid': 'proposal-committee',
161156
},
162157
}}
163158
helperText='If you are submitting on behalf of an Intersect Committee, please select Group. The Group Name would be the “Name of the Committee (e.g. MCC, TSC)”. The Type of Group would be “Intersect Committee”. The Key Information to Identify the Group would be the names of the Voting members of the Committee.'
164159
sx={{ mb: 2 }}
165160
>
166-
<MenuItem key={'1'} value={'Individual'}>
161+
<MenuItem
162+
key={'1'}
163+
value={'Individual'}
164+
data-testid='individual-submission'
165+
>
167166
Individual
168167
</MenuItem>
169-
<MenuItem key={'2'} value={'Company'}>
168+
<MenuItem
169+
key={'2'}
170+
value={'Company'}
171+
data-testid='company-submission'
172+
>
170173
Company
171174
</MenuItem>
172-
<MenuItem key={'3'} value={'Group'}>
175+
<MenuItem
176+
key={'3'}
177+
value={'Group'}
178+
data-testid='group-submission'
179+
>
173180
Group
174181
</MenuItem>
175182
</TextField>
@@ -261,15 +268,11 @@ const ProposalOwnership = ({
261268
onChange={(e) =>
262269
handleDataChange(e, 'be_country')
263270
}
264-
// SelectProps={{
265-
// SelectDisplayProps: {
266-
// 'data-testid':
267-
// 'country-of-incorporation',
268-
// },
269-
// }}
270-
inputProps={{
271-
'data-testid':
272-
'country-of-incorporation',
271+
SelectProps={{
272+
SelectDisplayProps: {
273+
'data-testid':
274+
'country-of-incorporation',
275+
},
273276
}}
274277
sx={{ mb: 2 }}
275278
>

pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -281,18 +281,19 @@ const SingleGovernanceAction = ({ id }) => {
281281
}
282282
};
283283

284-
const fetchCurrentWalletBalance = async () => {
285-
try {
286-
const bal = await walletAPI.getBalance();
287-
const balance = Number('0x' + bal.match(/^1b([0-9a-fA-F]{16})$/)[1]) || 0;
288-
const normalized = balance / 1000000;
289-
setCurrentWalletBalance(normalized);
290-
return normalized;
291-
} catch (error) {
292-
console.error(error);
293-
return 0; // fallback
294-
}
295-
};
284+
const fetchCurrentWalletBalance = async () => {
285+
try {
286+
const bal = await walletAPI.getBalance();
287+
const balance =
288+
Number('0x' + bal.match(/^1b([0-9a-fA-F]{16})$/)[1]) || 0;
289+
const normalized = balance / 1000000;
290+
setCurrentWalletBalance(normalized);
291+
return normalized;
292+
} catch (error) {
293+
console.error(error);
294+
return 0; // fallback
295+
}
296+
};
296297
const handleCreateComment = async () => {
297298
setLoading(true);
298299
try {
@@ -637,24 +638,35 @@ const SingleGovernanceAction = ({ id }) => {
637638
width: 'max-content',
638639
}}
639640
onClick={async () => {
640-
const balance = await fetchCurrentWalletBalance();
641-
if (balance >= 100000.18) {
642-
await loginUserToApp({
643-
wallet: walletAPI,
644-
setUser,
645-
setOpenUsernameModal,
646-
callBackFn: () => {
647-
setOpenGASubmissionDialog(true);
641+
const balance =
642+
await fetchCurrentWalletBalance();
643+
if (
644+
balance >=
645+
100000.18
646+
) {
647+
await loginUserToApp(
648+
{
649+
wallet: walletAPI,
650+
setUser,
651+
setOpenUsernameModal,
652+
callBackFn:
653+
() => {
654+
setOpenGASubmissionDialog(
655+
true
656+
);
648657
},
649-
clearStates,
650-
addErrorAlert,
651-
addSuccessAlert,
652-
addChangesSavedAlert,
653-
});
654-
} else {
655-
setOpenAlertDialog(true);
658+
clearStates,
659+
addErrorAlert,
660+
addSuccessAlert,
661+
addChangesSavedAlert,
656662
}
657-
}}
663+
);
664+
} else {
665+
setOpenAlertDialog(
666+
true
667+
);
668+
}
669+
}}
658670
>
659671
Submit as Governance
660672
Action
@@ -2192,6 +2204,7 @@ const SingleGovernanceAction = ({ id }) => {
21922204
fontWeight={600}
21932205
color='text.black'
21942206
width={'100%'}
2207+
data-testid='insufficient-wallet-balance-title'
21952208
>
21962209
Insufficient wallet balance
21972210
</Typography>
@@ -2212,6 +2225,7 @@ const SingleGovernanceAction = ({ id }) => {
22122225
variant='contained'
22132226
fullWidth
22142227
autoFocus
2228+
data-testid='insufficient-wallet-balance-dialog-button'
22152229
>
22162230
Close
22172231
</Button>

0 commit comments

Comments
 (0)