fix: use specific data-testid selectors in project switcher assertions

Replace generic getByRole('button', { name: /.../ }) selectors with specific
getByTestId('project-switcher-project-') to avoid strict mode
violations where the selector resolves to multiple elements (project switcher
button and sidebar button).

Fixes failing E2E tests:
- feature-manual-review-flow.spec.ts
- new-project-creation.spec.ts
- open-existing-project.spec.ts
This commit is contained in:
DhanushSantosh
2026-01-17 14:53:06 +05:30
parent bac5e1c220
commit a0471098fa
3 changed files with 6 additions and 6 deletions

View File

@@ -130,8 +130,8 @@ test.describe('Feature Manual Review Flow', () => {
await page.waitForTimeout(300);
}
// Verify we're on the correct project (project name appears in sidebar button)
await expect(page.getByRole('button', { name: new RegExp(projectName) })).toBeVisible({
// Verify we're on the correct project (project switcher button shows project name)
await expect(page.getByTestId(`project-switcher-project-${projectName}`)).toBeVisible({
timeout: 10000,
});

View File

@@ -77,8 +77,8 @@ test.describe('Project Creation', () => {
}
// Wait for project to be set as current and visible on the page
// The project name appears in the sidebar project selector button
await expect(page.getByRole('button', { name: new RegExp(projectName) })).toBeVisible({
// The project name appears in the project switcher button
await expect(page.getByTestId(`project-switcher-project-${projectName}`)).toBeVisible({
timeout: 15000,
});

View File

@@ -156,9 +156,9 @@ test.describe('Open Project', () => {
}
// Wait for a project to be set as current and visible on the page
// The project name appears in the sidebar project selector button
// The project name appears in the project switcher button
if (targetProjectName) {
await expect(page.getByRole('button', { name: new RegExp(targetProjectName) })).toBeVisible({
await expect(page.getByTestId(`project-switcher-project-${targetProjectName}`)).toBeVisible({
timeout: 15000,
});
}