Skip to content

Commit c1b9f1c

Browse files
committed
refactor: address code review suggestions
- Simplify countCustomProfiles by reusing getCustomProfiles helper - Fix misleading test name and assertion for thinking level controls
1 parent 7d8670f commit c1b9f1c

2 files changed

Lines changed: 11 additions & 23 deletions

File tree

apps/app/tests/profiles-view.spec.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -643,24 +643,23 @@ test.describe("AI Profiles View", () => {
643643
await waitForSuccessToast(page, "Profile created");
644644
});
645645

646-
test("should hide thinking level when model doesn't support it", async ({
646+
test("should show thinking level controls when model supports it", async ({
647647
page,
648648
}) => {
649649
await clickNewProfileButton(page);
650650

651-
// Select Haiku model (doesn't support thinking)
652-
await selectModel(page, "haiku");
651+
// Select a model that supports thinking (all current models do)
652+
await selectModel(page, "opus");
653+
654+
// Verify that the thinking level section is visible
655+
const thinkingLevelLabel = page.locator('text="Thinking Level"');
656+
await expect(thinkingLevelLabel).toBeVisible();
653657

654-
// Thinking level selector should not be visible
658+
// Verify thinking level options are available
655659
const thinkingSelector = page.locator(
656660
'[data-testid^="thinking-select-"]'
657661
);
658-
const count = await thinkingSelector.count();
659-
660-
// Note: Haiku supports thinking levels too, so this test may need adjustment
661-
// Based on the actual implementation. For now, we'll check if at least
662-
// some thinking options are visible
663-
expect(count).toBeGreaterThanOrEqual(0);
662+
await expect(thinkingSelector.first()).toBeVisible();
664663
});
665664
});
666665

apps/app/tests/utils/views/profiles.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,8 @@ export async function getBuiltInProfiles(page: Page): Promise<Locator> {
6161
* Count the number of custom profiles
6262
*/
6363
export async function countCustomProfiles(page: Page): Promise<number> {
64-
// Count profiles by checking each one for the "Built-in" text
65-
const allCards = await page.locator('[data-testid^="profile-card-"]').all();
66-
let customCount = 0;
67-
68-
for (const card of allCards) {
69-
const builtInText = card.locator('text="Built-in"');
70-
const isBuiltIn = (await builtInText.count()) > 0;
71-
if (!isBuiltIn) {
72-
customCount++;
73-
}
74-
}
75-
76-
return customCount;
64+
const customProfiles = await getCustomProfiles(page);
65+
return customProfiles.count();
7766
}
7867

7968
/**

0 commit comments

Comments
 (0)