Fix Playwright selector ambiguities in stundenplan.spec.ts
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 29s
CI / test-go-edu-search (push) Successful in 31s
CI / test-python-klausur (push) Failing after 2m36s
CI / test-python-agent-core (push) Successful in 20s
CI / test-nodejs-website (push) Successful in 22s

- 'Lehrer' label collided with a Sidebar entry; scope to <main nav>.
- 'Schmidt, Anna' lived in a closed <option>; assert on count via
  select.locator() instead of toBeVisible().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-05-21 22:53:10 +02:00
parent 73636f76a2
commit 4657589b89
+7 -3
View File
@@ -78,8 +78,10 @@ test.describe('Stundenplan — Page Shell', () => {
})
test('shows all 8 tabs', async ({ page }) => {
// Sidebar entries collide with tab labels for 'Lehrer' — scope to <nav> and use exact match.
const tabs = page.locator('main nav')
for (const label of ['Klassen', 'Lehrer', 'Faecher', 'Raeume', 'Zeitraster', 'Stundentafel', 'Lehrauftraege', 'Regeln (Constraints)']) {
await expect(page.getByRole('button', { name: label })).toBeVisible()
await expect(tabs.getByRole('button', { name: label, exact: true })).toBeVisible()
}
})
@@ -203,8 +205,10 @@ test.describe('Stundenplan — Constraint editor empty teacher state', () => {
const btn = page.getByRole('button', { name: '+ Neue Regel' })
await expect(btn).toBeEnabled()
await btn.click()
await expect(page.getByRole('combobox').first()).toBeVisible()
await expect(page.getByText('Schmidt, Anna')).toBeVisible()
const select = page.getByRole('combobox').first()
await expect(select).toBeVisible()
// <option> elements live inside <select>; assert on the option's text, not visibility.
await expect(select.locator('option', { hasText: 'Schmidt, Anna' })).toHaveCount(1)
})
})