Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
harishmohanraj committed Sep 18, 2024
1 parent 99ea194 commit 26dcc5c
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/src/client/components/buildPage/DynamicForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ export const DynamicForm: React.FC<DynamicFormProps> = ({
const formFields = useMemo(() => {
if (schema && 'json_schema' in schema) {
return Object.entries(schema.json_schema.properties).map(([key, property]: [string, any]) => {
if (isDeploymentCreatedSuccessfully) {
parser?.setActiveModelObj({
json_str: successResponse,
});
}
if (key === 'uuid') {
return null;
}
Expand Down
21 changes: 21 additions & 0 deletions app/src/client/tests/UserProperty-e2e.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,19 @@ describe('UserProperty Component Tests', () => {
await user.type(screen.getByLabelText('Repo Name'), 'My Repo Name');
await user.type(screen.getByLabelText('Fly App Name'), 'My Fly App Name');

// Click the team select box and make sure weatherman and Standup Comedian team are shown in the options
await user.click(screen.getAllByRole('combobox')[0]);
const selectMenu = container.querySelector('.react-select__menu');
expect(selectMenu).toBeInTheDocument();
expect(selectMenu).toHaveTextContent('Weatherman');
expect(selectMenu).toHaveTextContent('Standup Comedian');

// Click on the Standup Comedian option
await user.click(screen.getByText('Standup Comedian'));

// Verify that Standup Comedian is now selected
expect(screen.getByText('Standup Comedian')).toBeInTheDocument();

const mockValidateFormResponse = {
name: 'My Deployment Name',
team: {
Expand Down Expand Up @@ -528,6 +541,11 @@ describe('UserProperty Component Tests', () => {
expect(screen.getByLabelText('GH Token')).toBeDisabled();
expect(screen.getByLabelText('Fly Token')).toBeDisabled();

expect(screen.getByLabelText('Team Name')).not.toBeDisabled();

// Verify that Standup Comedian is selected
expect(screen.getByText('Standup Comedian')).toBeInTheDocument();

// Click on the cancel button
await user.click(screen.getByRole('button', { name: 'Cancel' }));

Expand All @@ -540,6 +558,9 @@ describe('UserProperty Component Tests', () => {
expect(screen.getByLabelText('GH Token')).toBeDisabled();
expect(screen.getByLabelText('Fly Token')).toBeDisabled();

// Verify that Standup Comedian is now selected
expect(screen.getByText('Standup Comedian')).toBeInTheDocument();

// Check if the form submit button is enabled
expect(screen.getByTestId('form-submit-button')).toBeEnabled();
});
Expand Down
23 changes: 23 additions & 0 deletions app/src/client/tests/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1629,6 +1629,29 @@ export const deploymentUserProperties: UserProperties[] = [
created_at: '2024-09-11T09:50:34.719000Z',
updated_at: '2024-09-11T09:50:34.719000Z',
},
{
uuid: '11122233-4cd5-4437-b5d0-222e3549259f',
user_uuid: 'dae81928-8e99-48c2-be5d-61a5b422cf47',
type_name: 'team',
model_name: 'TwoAgentTeam',
json_str: {
name: 'Weatherman',
initial_agent: {
name: 'UserProxyAgent',
type: 'agent',
uuid: '2329d22e-ced3-417a-9ff6-b09964512344',
},
secondary_agent: {
name: 'AssistantAgent',
type: 'agent',
uuid: 'b36dabf6-cc06-4673-8060-68d7b58f6c4e',
},
human_input_mode: 'ALWAYS',
is_termination_msg_regex: 'TERMINATE',
},
created_at: '2024-09-11T09:50:44.674000Z',
updated_at: '2024-09-11T09:50:44.674000Z',
},
{
uuid: '31273537-4cd5-4437-b5d0-222e3549259f',
user_uuid: 'dae81928-8e99-48c2-be5d-61a5b422cf47',
Expand Down

0 comments on commit 26dcc5c

Please sign in to comment.