Skip to content

Commit

Permalink
Build Transaction UI Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits committed Nov 19, 2024
1 parent a3d1a3c commit 29d6951
Show file tree
Hide file tree
Showing 9 changed files with 646 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,12 @@ export const Operations = () => {
{/* Operations */}
<>
{txnOperations.map((op, idx) => (
<Box key={`op-${idx}`} gap="lg" addlClassName="PageBody__content">
<Box
key={`op-${idx}`}
gap="lg"
addlClassName="PageBody__content"
data-testid={`build-transaction-operation-${idx}`}
>
{/* Operation label and action buttons */}
<Box
gap="lg"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ export const TransactionXdr = () => {
variant="success"
title="Success! Transaction Envelope XDR:"
response={
<Box gap="xs">
<Box gap="xs" data-testid="build-transaction-envelope-xdr">
<div>
<div>Network Passphrase:</div>
<div>{network.passphrase}</div>
Expand Down
7 changes: 5 additions & 2 deletions src/app/(sidebar)/transaction/build/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function BuildTransaction() {
<Box gap="sm">
<>
<div>Params</div>
<ul>
<ul data-testid="build-transaction-params-errors">
{paramsError.map((e, i) => (
<li key={`e-${i}`}>{e}</li>
))}
Expand All @@ -38,7 +38,10 @@ export default function BuildTransaction() {
) : null}

{operationsError.length > 0 ? (
<Box gap="sm">
<Box
gap="sm"
data-testid="build-transaction-operations-errors"
>
{operationsError.map((e, i) => (
<Box gap="sm" key={`e-${i}`}>
<>
Expand Down
1 change: 1 addition & 0 deletions src/components/FormElements/AssetMultiPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export const AssetMultiPicker = ({
<div className="RadioPicker__inset" key={`${id}-${index}`}>
<RadioPicker
id={`${id}-${index}`}
data-testid={`asset-multipicker-${index}`}
selectedOption={value.type}
label={`#${index + 1}`}
onChange={(optionId) => {
Expand Down
1 change: 1 addition & 0 deletions src/components/FormElements/AssetPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ export const AssetPicker = ({
<div className="RadioPicker__inset">
<RadioPicker
id={id}
data-testid="asset-picker"
selectedOption={value.type}
label={label}
labelSuffix={labelSuffix}
Expand Down
1 change: 1 addition & 0 deletions src/components/FormElements/MemoPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const MemoPicker = ({
<div className="RadioPicker__inset">
<RadioPicker
id={id}
data-testid="memo-picker"
selectedOption={value?.type}
label="Memo"
labelSuffix={labelSuffix}
Expand Down
3 changes: 2 additions & 1 deletion src/components/RadioPicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ export const RadioPicker = <TOptionValue,>({
infoLink,
infoText,
disabledOptions,
...props
}: RadioPickerProps<TOptionValue>) => {
const customStyle = {
...(fitContent ? { "--RadioPicker-width": "fit-content" } : {}),
} as React.CSSProperties;

return (
<div className="RadioPicker" style={customStyle}>
<div className="RadioPicker" style={customStyle} {...props}>
{label ? (
<LabelHeading
size="md"
Expand Down
32 changes: 18 additions & 14 deletions src/helpers/formatEpochToDate.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
export const formatEpochToDate = (epoch: number) => {
const date = new Date(epoch * 1000);
const dateTimeFormatter = new Intl.DateTimeFormat("en-US", {
weekday: "short",
month: "short",
day: "numeric",
year: "numeric",
hour: "numeric",
minute: "numeric",
second: "numeric",
hourCycle: "h24",
timeZone: "utc",
timeZoneName: "short",
});
try {
const date = new Date(epoch * 1000);
const dateTimeFormatter = new Intl.DateTimeFormat("en-US", {
weekday: "short",
month: "short",
day: "numeric",
year: "numeric",
hour: "numeric",
minute: "numeric",
second: "numeric",
hourCycle: "h24",
timeZone: "utc",
timeZoneName: "short",
});

return dateTimeFormatter.format(date);
return dateTimeFormatter.format(date);
} catch (e) {
return null;
}
};
Loading

0 comments on commit 29d6951

Please sign in to comment.