mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 20:03:37 +00:00
refactor: address code review suggestions
- Simplify countCustomProfiles by reusing getCustomProfiles helper - Fix misleading test name and assertion for thinking level controls
This commit is contained in:
@@ -643,24 +643,23 @@ test.describe("AI Profiles View", () => {
|
||||
await waitForSuccessToast(page, "Profile created");
|
||||
});
|
||||
|
||||
test("should hide thinking level when model doesn't support it", async ({
|
||||
test("should show thinking level controls when model supports it", async ({
|
||||
page,
|
||||
}) => {
|
||||
await clickNewProfileButton(page);
|
||||
|
||||
// Select Haiku model (doesn't support thinking)
|
||||
await selectModel(page, "haiku");
|
||||
// Select a model that supports thinking (all current models do)
|
||||
await selectModel(page, "opus");
|
||||
|
||||
// Thinking level selector should not be visible
|
||||
// Verify that the thinking level section is visible
|
||||
const thinkingLevelLabel = page.locator('text="Thinking Level"');
|
||||
await expect(thinkingLevelLabel).toBeVisible();
|
||||
|
||||
// Verify thinking level options are available
|
||||
const thinkingSelector = page.locator(
|
||||
'[data-testid^="thinking-select-"]'
|
||||
);
|
||||
const count = await thinkingSelector.count();
|
||||
|
||||
// Note: Haiku supports thinking levels too, so this test may need adjustment
|
||||
// Based on the actual implementation. For now, we'll check if at least
|
||||
// some thinking options are visible
|
||||
expect(count).toBeGreaterThanOrEqual(0);
|
||||
await expect(thinkingSelector.first()).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -61,19 +61,8 @@ export async function getBuiltInProfiles(page: Page): Promise<Locator> {
|
||||
* Count the number of custom profiles
|
||||
*/
|
||||
export async function countCustomProfiles(page: Page): Promise<number> {
|
||||
// Count profiles by checking each one for the "Built-in" text
|
||||
const allCards = await page.locator('[data-testid^="profile-card-"]').all();
|
||||
let customCount = 0;
|
||||
|
||||
for (const card of allCards) {
|
||||
const builtInText = card.locator('text="Built-in"');
|
||||
const isBuiltIn = (await builtInText.count()) > 0;
|
||||
if (!isBuiltIn) {
|
||||
customCount++;
|
||||
}
|
||||
}
|
||||
|
||||
return customCount;
|
||||
const customProfiles = await getCustomProfiles(page);
|
||||
return customProfiles.count();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user