Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(frontend): add block tests #8804

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f4a44c8
feat: baseline tools, not working on waiting for profile to load
ntindle Nov 26, 2024
9a10604
Merge branch 'dev' into ntindle/open-2060-add-a-utility-that-enables-…
ntindle Nov 26, 2024
bf67dfe
fix: document bug (kinda)
ntindle Nov 26, 2024
20fe991
fix: linting
ntindle Nov 26, 2024
48b9983
Merge branch 'dev' into ntindle/open-2060-add-a-utility-that-enables-…
ntindle Nov 26, 2024
0fc1cf4
fix: reload more as work around
ntindle Nov 26, 2024
5ad881d
ref: document the workaround for issue
ntindle Nov 26, 2024
9ec402b
Merge branch 'dev' into ntindle/open-2060-add-a-utility-that-enables-…
ntindle Nov 27, 2024
75a533a
feat(frontend): add test ids to the nav bar
ntindle Nov 27, 2024
ace6cd3
feat(frontend): more test ids
ntindle Nov 27, 2024
9fbf52c
feat(frontend): first pass at tests
ntindle Nov 27, 2024
a84bf6d
ref: don't save it without filling the required fields
ntindle Nov 27, 2024
39646cd
fix: agent not saving in test
ntindle Nov 27, 2024
e9a6c82
Merge branch 'dev' into ntindle/open-2060-add-a-utility-that-enables-…
ntindle Nov 27, 2024
6894b33
Merge branch 'ntindle/open-2060-add-a-utility-that-enables-all-tests-…
ntindle Nov 27, 2024
aff2580
fix: linting
ntindle Nov 27, 2024
745f75a
feat(frontend): add block connecting test (#8862)
Bentlybro Dec 2, 2024
02d4339
Merge branch 'dev' into ntindle/open-2093-integration-test-build-an-a…
ntindle Dec 2, 2024
0a787ba
fix: formatting
ntindle Dec 2, 2024
383215c
fix: data ids
ntindle Dec 2, 2024
a30052e
ref: extract the specific calls to functions
ntindle Dec 2, 2024
1e4d7c9
feat: build full agents and run them via the builder
ntindle Dec 3, 2024
3e85c2a
Merge branch 'dev' into ntindle/open-2093-integration-test-build-an-a…
ntindle Dec 3, 2024
77ffe02
ref: remove dead and unuseful code
ntindle Dec 3, 2024
cc7ef5a
Merge branch 'ntindle/open-2093-integration-test-build-an-agent-with-…
ntindle Dec 3, 2024
34651ff
Merge branch 'dev' into ntindle/open-2093-integration-test-build-an-a…
ntindle Dec 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions autogpt_platform/frontend/src/components/CustomNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,17 @@ export function CustomNode({
className={`${blockClasses} ${errorClass} ${statusClass}`}
data-id={`custom-node-${id}`}
z-index={1}
data-blockid={data.block_id}
data-blockname={data.title}
data-blocktype={data.blockType}
data-nodetype={data.uiType}
data-category={data.categories[0]?.category.toLowerCase() || ""}
data-inputs={JSON.stringify(
Object.keys(data.inputSchema?.properties || {}),
)}
data-outputs={JSON.stringify(
Object.keys(data.outputSchema?.properties || {}),
)}
>
{/* Header */}
<div
Expand Down
2 changes: 2 additions & 0 deletions autogpt_platform/frontend/src/components/NodeHandle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const NodeHandle: FC<HandleProps> = ({
<div key={keyName} className="handle-container">
<Handle
type="target"
data-testid={`input-handle-${keyName}`}
position={Position.Left}
id={keyName}
className="-ml-[26px]"
Expand All @@ -76,6 +77,7 @@ const NodeHandle: FC<HandleProps> = ({
<div key={keyName} className="handle-container justify-end">
<Handle
type="source"
data-testid={`output-handle-${keyName}`}
position={Position.Right}
id={keyName}
className="group -mr-[26px]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ export const BlocksControl: React.FC<BlocksControlProps> = ({
variant="ghost"
size="icon"
data-id="blocks-control-popover-trigger"
data-testid="blocks-control-blocks-button"
name="Blocks"
>
<IconToyBrick />
</Button>
Expand All @@ -143,6 +145,7 @@ export const BlocksControl: React.FC<BlocksControlProps> = ({
htmlFor="search-blocks"
className="whitespace-nowrap text-base font-bold text-black 2xl:text-xl"
data-id="blocks-control-label"
data-testid="blocks-control-blocks-label"
>
Blocks
</Label>
Expand Down Expand Up @@ -205,6 +208,7 @@ export const BlocksControl: React.FC<BlocksControlProps> = ({
<span
className="block truncate pb-1 text-sm font-semibold"
data-id={`block-name-${block.id}`}
data-testid={`block-name-${block.id}`}
>
<TextRenderer
value={beautifyString(block.name).replace(
Expand All @@ -214,7 +218,10 @@ export const BlocksControl: React.FC<BlocksControlProps> = ({
truncateLengthLimit={45}
/>
</span>
<span className="block break-all text-xs font-normal text-gray-500">
<span
className="block break-all text-xs font-normal text-gray-500"
data-testid={`block-description-${block.id}`}
>
<TextRenderer
value={block.description}
truncateLengthLimit={165}
Expand All @@ -224,6 +231,7 @@ export const BlocksControl: React.FC<BlocksControlProps> = ({
<div
className="flex flex-shrink-0 items-center gap-1"
data-id={`block-tooltip-${block.id}`}
data-testid={`block-add`}
>
<PlusIcon className="h-6 w-6 rounded-lg bg-gray-200 stroke-black stroke-[0.5px] p-1" />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const ControlPanel = ({
size="icon"
onClick={() => control.onClick()}
data-id={`control-button-${index}`}
data-testid={`blocks-control-${control.label.toLowerCase()}-button`}
disabled={control.disabled || false}
>
{control.icon}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ export const SaveControl = ({
variant="ghost"
size="icon"
data-id="save-control-popover-trigger"
data-testid="blocks-control-save-button"
name="Save"
>
<IconSave />
</Button>
Expand All @@ -115,6 +117,7 @@ export const SaveControl = ({
value={agentName}
onChange={(e) => onNameChange(e.target.value)}
data-id="save-control-name-input"
data-testid="save-control-name-input"
maxLength={100}
/>
<Label htmlFor="description">Description</Label>
Expand All @@ -125,6 +128,7 @@ export const SaveControl = ({
value={agentDescription}
onChange={(e) => onDescriptionChange(e.target.value)}
data-id="save-control-description-input"
data-testid="save-control-description-input"
maxLength={500}
/>
{agentMeta?.version && (
Expand All @@ -136,6 +140,7 @@ export const SaveControl = ({
className="col-span-3"
value={agentMeta?.version || "-"}
disabled
data-testid="save-control-version-output"
/>
</>
)}
Expand All @@ -146,6 +151,7 @@ export const SaveControl = ({
className="w-full"
onClick={handleSave}
data-id="save-control-save-agent"
data-testid="save-control-save-agent-button"
>
Save {getType()}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export function NavBarButtons({ className }: { className?: string }) {
<Link
key={button.href}
href={button.href}
data-testid={`${button.text.toLowerCase()}-nav-link`}
className={cn(
className,
"flex items-center gap-2 rounded-xl p-3",
Expand All @@ -49,6 +50,7 @@ export function NavBarButtons({ className }: { className?: string }) {
{isCloud ? (
<Link
href="/marketplace"
data-testid="marketplace-nav-link"
className={cn(
className,
"flex items-center gap-2 rounded-xl p-3",
Expand All @@ -61,6 +63,7 @@ export function NavBarButtons({ className }: { className?: string }) {
</Link>
) : (
<MarketPopup
data-testid="marketplace-nav-link"
className={cn(
className,
"flex items-center gap-2 rounded-xl p-3 text-muted-foreground hover:text-foreground",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ export function InputBlock({
</SelectTrigger>
<SelectContent>
{placeholder_values.map((placeholder, index) => (
<SelectItem key={index} value={placeholder.toString()}>
<SelectItem
key={index}
value={placeholder.toString()}
data-testid={`run-dialog-input-${name}-${placeholder.toString()}`}
>
{placeholder.toString()}
</SelectItem>
))}
Expand All @@ -49,6 +53,7 @@ export function InputBlock({
) : (
<Input
id={`${id}-Value`}
data-testid={`run-dialog-input-${name}`}
value={value}
onChange={(e) => onInputChange(id, "value", e.target.value)}
placeholder={placeholder_values?.[0]?.toString() || "Enter value"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export function RunnerInputUI({
</div>
<DialogFooter className="px-6 py-4">
<Button
data-testid="run-dialog-run-button"
onClick={scheduledInput ? handleSchedule : handleRun}
className="px-8 py-2 text-lg"
disabled={scheduledInput ? isScheduling : isRunning}
Expand Down
Loading
Loading