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:
Kacper
2025-12-15 15:11:15 +01:00
parent 7d8670ff1f
commit c1b9f1cb28
2 changed files with 11 additions and 23 deletions

View File

@@ -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();
}
/**