Skip to content
This repository was archived by the owner on Aug 26, 2025. It is now read-only.

Commit ff6f1a1

Browse files
Andrew718PLTSAndrew718PLTS
andauthored
Feat: Added locator for confirm swap button (#203)
### Description After the refactor the swap button has different states with the specified text. Therefore, we can't take this button by particular text anymore, and I added a unique locator. ### Other changes Made a new enum value for a button text. ### Tested Run any swap autotest or check the locator on the Confirm Swap state for the main button. ### Related issues - Fixes #issue number here ### Checklist before requesting a review - [ ] I have performed a self-review of my own code - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] The PR title follows the [conventions](https://www.notion.so/Git-Branching-and-Commit-Message-Conventions-18f66f7d06444cfcbac5725ffbc7c04a?pvs=4#9355048863c549ef92fe210a8a1298aa) - [ ] I have run the [regression tests](https://www.notion.so/Mento-Web-App-Regression-Tests-37bd43a7da8d4e38b65993320a33d557) Co-authored-by: Andrew718PLTS <andrew.polovets@mentolabs.xyz>
1 parent 5b6787a commit ff6f1a1

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/components/buttons/3DButton.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ type BaseButtonProps = {
88
isDisabled?: boolean
99
isWalletConnected?: boolean
1010
isBalanceLoaded?: boolean
11+
dataTestId?: string
1112
}
1213

1314
export enum Button3DText {
1415
connectWallet = 'Connect Wallet',
1516
continue = 'Continue',
1617
balanceStillLoading = 'Balance still loading...',
1718
switchToCeloNetwork = 'Switch to Celo Network',
19+
preparingSwap = 'Preparing Swap...',
1820
}
1921

2022
export const Button3D = ({
@@ -26,13 +28,15 @@ export const Button3D = ({
2628
isDisabled,
2729
isWalletConnected,
2830
isBalanceLoaded,
31+
dataTestId,
2932
}: PropsWithChildren<BaseButtonProps>) => {
3033
return (
3134
<button
3235
className={isFullWidth ? 'w-full' : ''}
3336
onClick={onClick}
3437
type={type}
3538
disabled={isDisabled}
39+
data-testId={dataTestId}
3640
>
3741
<span
3842
className={`group font-inter outline-offset-4 cursor-pointer ${getShadowButtonColor({

src/features/swap/SwapConfirm.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,12 @@ export function SwapConfirmCard({ formValues }: Props) {
246246
</div>
247247

248248
<div className="flex w-full px-6 pb-6 mt-6">
249-
<Button3D isFullWidth onClick={onSubmit} isDisabled={isButtonDisabled}>
249+
<Button3D
250+
isFullWidth
251+
onClick={onSubmit}
252+
isDisabled={isButtonDisabled}
253+
dataTestId={'confirm-button'}
254+
>
250255
{buttonText}
251256
</Button3D>
252257
</div>

src/features/swap/components/SubmitButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function SubmitButton({ isWalletConnected, isBalanceLoaded }: ISubmitButt
8484
if (!isOnCelo) return Button3DText.switchToCeloNetwork
8585
if (isWalletConnected && !isBalanceLoaded) return Button3DText.balanceStillLoading
8686
if (hasError) return errorText
87-
if (isSubmitting) return 'Preparing Swap...'
87+
if (isSubmitting) return Button3DText.preparingSwap
8888
return Button3DText.continue
8989
}, [errorText, hasError, isWalletConnected, isOnCelo, isBalanceLoaded, isSubmitting])
9090

0 commit comments

Comments
 (0)