mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 21:23:07 +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");
|
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,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
await clickNewProfileButton(page);
|
await clickNewProfileButton(page);
|
||||||
|
|
||||||
// Select Haiku model (doesn't support thinking)
|
// Select a model that supports thinking (all current models do)
|
||||||
await selectModel(page, "haiku");
|
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(
|
const thinkingSelector = page.locator(
|
||||||
'[data-testid^="thinking-select-"]'
|
'[data-testid^="thinking-select-"]'
|
||||||
);
|
);
|
||||||
const count = await thinkingSelector.count();
|
await expect(thinkingSelector.first()).toBeVisible();
|
||||||
|
|
||||||
// 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);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -61,19 +61,8 @@ export async function getBuiltInProfiles(page: Page): Promise<Locator> {
|
|||||||
* Count the number of custom profiles
|
* Count the number of custom profiles
|
||||||
*/
|
*/
|
||||||
export async function countCustomProfiles(page: Page): Promise<number> {
|
export async function countCustomProfiles(page: Page): Promise<number> {
|
||||||
// Count profiles by checking each one for the "Built-in" text
|
const customProfiles = await getCustomProfiles(page);
|
||||||
const allCards = await page.locator('[data-testid^="profile-card-"]').all();
|
return customProfiles.count();
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user