-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into upgrade-aci-to-0.1.7
- Loading branch information
Showing
59 changed files
with
893 additions
and
396 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
frontend/__tests__/components/shared/modals/settings/runtime-size-selector.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { screen } from "@testing-library/react"; | ||
import { describe, it, expect } from "vitest"; | ||
import { renderWithProviders } from "test-utils"; | ||
import { RuntimeSizeSelector } from "#/components/shared/modals/settings/runtime-size-selector"; | ||
|
||
const renderRuntimeSizeSelector = () => | ||
renderWithProviders(<RuntimeSizeSelector isDisabled={false} />); | ||
|
||
describe("RuntimeSizeSelector", () => { | ||
it("should show both runtime size options", () => { | ||
renderRuntimeSizeSelector(); | ||
// The options are in the hidden select element | ||
const select = screen.getByRole("combobox", { hidden: true }); | ||
expect(select).toHaveValue("1"); | ||
expect(select).toHaveDisplayValue("1x (2 core, 8G)"); | ||
expect(select.children).toHaveLength(3); // Empty option + 2 size options | ||
}); | ||
|
||
it("should show the full description text for disabled options", async () => { | ||
renderRuntimeSizeSelector(); | ||
|
||
// Click the button to open the dropdown | ||
const button = screen.getByRole("button", { | ||
name: "1x (2 core, 8G) SETTINGS_FORM$RUNTIME_SIZE_LABEL", | ||
}); | ||
button.click(); | ||
|
||
// Wait for the dropdown to open and find the description text | ||
const description = await screen.findByText( | ||
"Runtime sizes over 1 are disabled by default, please contact [email protected] to get access to larger runtimes.", | ||
); | ||
expect(description).toBeInTheDocument(); | ||
expect(description).toHaveClass("whitespace-normal", "break-words"); | ||
}); | ||
}); |
45 changes: 45 additions & 0 deletions
45
frontend/__tests__/components/shared/modals/settings/settings-form.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { screen, fireEvent } from "@testing-library/react"; | ||
import { describe, it, expect, vi } from "vitest"; | ||
import { renderWithProviders } from "test-utils"; | ||
import { createRoutesStub } from "react-router"; | ||
import { DEFAULT_SETTINGS } from "#/services/settings"; | ||
import { SettingsForm } from "#/components/shared/modals/settings/settings-form"; | ||
import OpenHands from "#/api/open-hands"; | ||
|
||
describe("SettingsForm", () => { | ||
const getConfigSpy = vi.spyOn(OpenHands, "getConfig"); | ||
getConfigSpy.mockResolvedValue({ | ||
APP_MODE: "saas", | ||
GITHUB_CLIENT_ID: "123", | ||
POSTHOG_CLIENT_KEY: "123", | ||
}); | ||
|
||
const RouterStub = createRoutesStub([ | ||
{ | ||
Component: () => ( | ||
<SettingsForm | ||
settings={DEFAULT_SETTINGS} | ||
models={[]} | ||
agents={[]} | ||
securityAnalyzers={[]} | ||
onClose={() => {}} | ||
/> | ||
), | ||
path: "/", | ||
}, | ||
]); | ||
|
||
it("should not show runtime size selector by default", () => { | ||
renderWithProviders(<RouterStub />); | ||
expect(screen.queryByText("Runtime Size")).not.toBeInTheDocument(); | ||
}); | ||
|
||
it("should show runtime size selector when advanced options are enabled", async () => { | ||
renderWithProviders(<RouterStub />); | ||
const advancedSwitch = screen.getByRole("switch", { | ||
name: "SETTINGS_FORM$ADVANCED_OPTIONS_LABEL", | ||
}); | ||
fireEvent.click(advancedSwitch); | ||
await screen.findByText("SETTINGS_FORM$RUNTIME_SIZE_LABEL"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.