Skip to content

Commit 057e7f7

Browse files
committed
Test improvements
1 parent 52d53a4 commit 057e7f7

16 files changed

Lines changed: 649 additions & 491 deletions

File tree

frontend/src/assets/connectors/component-logo-map.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ import {
5757
Package,
5858
PlusSquare,
5959
Radio,
60-
Regex,
6160
RefreshCw,
61+
Regex,
6262
Repeat,
6363
Replace,
6464
Reply,

frontend/src/components/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export const FEATURE_FLAGS = {
99
enableKnowledgeBaseInConsoleUi: false,
1010
enableRemoteMcpInConsole: false,
1111
enableRpcnTiles: false,
12+
enableRpcnTemplateGallery: false,
1213
enableServerlessOnboardingWizard: false,
13-
enableConnectTemplateGallery: false,
1414
enableApiKeyConfigurationAgent: false,
1515
enableDataplaneObservabilityServerless: false,
1616
enableDataplaneObservability: false,

frontend/src/components/debug-helper/connect-config-fixtures.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,8 @@ export const CONNECT_CONFIG_FIXTURES: ConnectConfigFixture[] = [
734734
{
735735
id: 'edge-secrets-heavy',
736736
name: 'Edge — many secret references',
737-
description: 'Stress-test the ${secrets.X} parser/detector with brokers, SASL, TLS, headers, and S3 creds all interpolated.',
737+
description:
738+
'Stress-test the ${secrets.X} parser/detector with brokers, SASL, TLS, headers, and S3 creds all interpolated.',
738739
yaml: secretsHeavy,
739740
tags: ['edge-case'],
740741
},

frontend/src/components/debug-helper/debug-dialog.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ function ConfigFixtureRow({ fixture }: { fixture: ConnectConfigFixture }) {
111111
</div>
112112
</div>
113113
{previewing && (
114-
<pre className="mt-2.5 max-h-64 overflow-auto rounded border bg-muted p-2.5 font-mono text-xs">{fixture.yaml}</pre>
114+
<pre className="mt-2.5 max-h-64 overflow-auto rounded border bg-muted p-2.5 font-mono text-xs">
115+
{fixture.yaml}
116+
</pre>
115117
)}
116118
</div>
117119
);
@@ -638,9 +640,7 @@ export function DebugDialog({ open, onOpenChange }: { open: boolean; onOpenChang
638640
<Bug className="h-4 w-4" />
639641
Debug helpers
640642
</DialogTitle>
641-
<DialogDescription>
642-
Connect-app debugging tools — configs, simulators, storage, flags.
643-
</DialogDescription>
643+
<DialogDescription>Connect-app debugging tools — configs, simulators, storage, flags.</DialogDescription>
644644
</DialogHeader>
645645

646646
<DialogBody padding="none" scrollShadow={false}>

frontend/src/components/misc/user-preferences.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const UserPreferencesDialog: FC<{ isOpen: boolean; onClose: () => void }>
7070
))}
7171
</TabsList>
7272
{tabEntries.map(([key, { component: TabComponent }]) => (
73-
<TabsContent key={key} value={key} className="p-4">
73+
<TabsContent className="p-4" key={key} value={key}>
7474
<TabComponent />
7575
</TabsContent>
7676
))}

frontend/src/components/pages/rp-connect/onboarding/add-user-step.tsx

Lines changed: 437 additions & 440 deletions
Large diffs are not rendered by default.

frontend/src/components/pages/rp-connect/pipeline/index.test.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,10 @@ describe('PipelinePage', () => {
537537

538538
render(<PipelinePage />, { transport: createTransport() });
539539

540-
// The toolbar should show the displayName from the pipeline response, not the pipeline ID
541-
expect(await screen.findByText('Test Pipeline')).toBeInTheDocument();
542-
expect(screen.queryByText('test-pipeline')).not.toBeInTheDocument();
540+
// The toolbar title (level-1 heading) should show the displayName from the pipeline
541+
// response, not the pipeline ID. The ID is shown separately in the Configuration section.
542+
expect(await screen.findByRole('heading', { level: 1, name: 'Test Pipeline' })).toBeInTheDocument();
543+
expect(screen.queryByRole('heading', { level: 1, name: 'test-pipeline' })).not.toBeInTheDocument();
543544
});
544545

545546
it('hydrates the flow diagram with pipeline configYaml in view mode', async () => {

frontend/src/components/pages/rp-connect/pipeline/index.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { isSystemTag } from 'components/constants';
1818
import { Alert, AlertDescription, AlertTitle } from 'components/redpanda-ui/components/alert';
1919
import { Banner, BannerClose, BannerContent } from 'components/redpanda-ui/components/banner';
2020
import { Button } from 'components/redpanda-ui/components/button';
21-
import { Card, CardContent, CardHeader, CardTitle } from 'components/redpanda-ui/components/card';
2221
import { CopyButton } from 'components/redpanda-ui/components/copy-button';
2322
import { CountDot } from 'components/redpanda-ui/components/count-dot';
2423
import {
@@ -118,7 +117,6 @@ import {
118117
tryPatchRedpandaYaml,
119118
} from '../utils/yaml';
120119

121-
122120
function getConnectorDialogTitle(type: ConnectComponentType | 'resource' | null): string | undefined {
123121
if (type === 'input') {
124122
return 'Add an input';
@@ -139,7 +137,6 @@ function getConnectorDialogPlaceholder(type: ConnectComponentType | 'resource' |
139137
return;
140138
}
141139

142-
143140
const pipelineFormSchema = z.object({
144141
name: z
145142
.string()
@@ -163,7 +160,6 @@ const pipelineFormSchema = z.object({
163160

164161
type PipelineFormValues = z.infer<typeof pipelineFormSchema>;
165162

166-
167163
function buildUserTags(formTags: PipelineFormValues['tags']): Record<string, string> {
168164
const userTags: Record<string, string> = {};
169165
for (const { key, value } of formTags) {
@@ -232,7 +228,6 @@ function parseYamlEditorSchema(configSchema: string | undefined) {
232228
}
233229
}
234230

235-
236231
function usePipelineLint(yamlContent: string, errorLintHints: Record<string, LintHint>, enabled: boolean) {
237232
const debouncedYamlContent = useDebouncedValue(yamlContent, 500);
238233
const { data: lintResponse, isPending: isLintPending } = useLintPipelineConfigQuery(debouncedYamlContent, {
@@ -450,7 +445,6 @@ function useDiagramDialogs(yamlContent: string, handleConnectorYamlChange: (yaml
450445
};
451446
}
452447

453-
454448
function EditorSkeleton() {
455449
return (
456450
<div className="flex flex-col gap-3 p-4">
@@ -730,7 +724,6 @@ function SidebarPanel({
730724
);
731725
}
732726

733-
734727
export default function PipelinePage() {
735728
const { mode, pipelineId } = usePipelineMode();
736729
const navigate = useNavigate();
@@ -751,7 +744,7 @@ export default function PipelinePage() {
751744
const [addConnectorType, setAddConnectorType] = useState<ConnectComponentType | 'resource' | null>(null);
752745
const [slashTipVisible, setSlashTipVisible] = useState(isSlashMenuEnabled && mode !== 'view');
753746
const [isTemplateDialogOpen, setIsTemplateDialogOpen] = useState(false);
754-
const isTemplateGalleryEnabled = isFeatureFlagEnabled('enableConnectTemplateGallery');
747+
const isTemplateGalleryEnabled = isFeatureFlagEnabled('enableRpcnTemplateGallery');
755748

756749
const form = useForm<PipelineFormValues>({
757750
resolver: zodResolver(pipelineFormSchema) as Resolver<PipelineFormValues>,
@@ -770,7 +763,6 @@ export default function PipelinePage() {
770763
[slashCommand]
771764
);
772765

773-
774766
const { data: pipelineResponse, isLoading: isPipelineLoading } = useGetPipelineQuery(
775767
{ id: pipelineId || '' },
776768
{ enabled: mode !== 'create' && !!pipelineId }
@@ -789,12 +781,10 @@ export default function PipelinePage() {
789781
const formName = useWatch({ control: form.control, name: 'name' });
790782
const pipelineName = mode === 'view' ? pipeline?.displayName : formName;
791783

792-
793784
const { handleSave, handleDelete, clearWizardStore, errorLintHints, clearErrorLintHints, isSaving, isDeleting } =
794785
usePipelineSave({ form, yamlContent, mode, pipelineId, pipeline, isPipelineDiagramsEnabled });
795786
const { lintHints, isLintPending } = usePipelineLint(yamlContent, errorLintHints, mode !== 'view');
796787

797-
798788
const handleYamlChange = useCallback(
799789
(value: string) => {
800790
clearErrorLintHints();
@@ -872,7 +862,6 @@ export default function PipelinePage() {
872862
onResolved: setYamlContent,
873863
});
874864

875-
876865
const handleCancel = useCallback(() => {
877866
if (mode === 'create') {
878867
clearWizardStore();
@@ -888,7 +877,6 @@ export default function PipelinePage() {
888877

889878
const handleNameChange = useCallback((name: string) => form.setValue('name', name, { shouldValidate: true }), [form]);
890879

891-
892880
return (
893881
<div
894882
className={cn(

frontend/src/components/pages/rp-connect/pipeline/pipeline-flow-diagram.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ export const PipelineFlowDiagram = ({
263263
// scrolls through. Mid-range events fall through to React Flow's pan.
264264
useEffect(() => {
265265
const el = containerRef.current;
266-
if (!el || !contentOverflows || !translateExtent || !containerSize) {
266+
if (!(el && contentOverflows && translateExtent && containerSize)) {
267267
return;
268268
}
269269
const [[, minBoundY], [, maxBoundY]] = translateExtent;
@@ -294,9 +294,7 @@ export const PipelineFlowDiagram = ({
294294
}
295295

296296
// Section labels and `none` placeholders don't count as user content.
297-
const isPipelineEmpty = !nodes.some(
298-
(n) => n.kind === 'group' || (n.kind === 'leaf' && n.label !== 'none')
299-
);
297+
const isPipelineEmpty = !nodes.some((n) => n.kind === 'group' || (n.kind === 'leaf' && n.label !== 'none'));
300298
const showTemplateFab = Boolean(onBrowseTemplates) && isPipelineEmpty;
301299

302300
return (

frontend/src/components/pages/rp-connect/pipeline/pipeline-flow-nodes.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,7 @@ const TreeLeafNode = ({ data }: { data: TreeNodeData }) => {
176176
>
177177
<Handle className={invisibleHandle} position={Position.Left} type="target" />
178178
<div className="flex items-center gap-1.5">
179-
{!isPlaceholder ? (
180-
<ConnectorLogo className="size-4" fallback={Box} name={data.label as ComponentName} />
181-
) : null}
179+
{isPlaceholder ? null : <ConnectorLogo className="size-4" fallback={Box} name={data.label as ComponentName} />}
182180
<Text
183181
as="span"
184182
className={cn('min-w-0 truncate', isPlaceholder ? 'text-muted-foreground' : 'text-foreground')}

0 commit comments

Comments
 (0)