Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ test.describe('filtered search', () => {
// remove score criterion
await page.keyboard.press('Shift+Tab');
await page.keyboard.press('Shift+Tab');
await expect(page.locator('.criterion-value-text', { hasText: 'Good' })).toBeFocused();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better test robustness, it's good practice to use more specific locators. Chaining locators can help scope the search and prevent potential flakiness if other elements with similar properties are added to the page in the future. You could scope this locator to the 'Score' pill to make it more specific.

Suggested change
await expect(page.locator('.criterion-value-text', { hasText: 'Good' })).toBeFocused();
await expect(page.locator('.pill-group', { hasText: 'Score' }).locator('.criterion-value-text', { hasText: 'Good' })).toBeFocused();

await page.keyboard.press('Enter');
await expect(
page.locator('.pill-group', { hasText: 'Score' }).getByRole('combobox')
Expand Down
Loading