fix(e2e): replace fragile .last() selector with data-testid on password form submit
The password-reset E2E test was using button[type="submit"].last() to target the password change button on the profile page. The profile page has two submit buttons with identical text, so .last() is layout-order-dependent and breaks if the form order ever changes. Add data-testid="submit-password" to PasswordChangeForm and use getByTestId() in the test. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -80,8 +80,7 @@ test.describe('Password reset', () => {
|
||||
await page.locator('input[name="currentPassword"]').fill(newPassword);
|
||||
await page.locator('input[name="newPassword"]').fill(originalPassword);
|
||||
await page.locator('input[name="confirmPassword"]').fill(originalPassword);
|
||||
// Profile page has two "Speichern" buttons — the password form is the last one
|
||||
await page.locator('button[type="submit"]').last().click();
|
||||
await page.getByTestId('submit-password').click();
|
||||
// After changing password, auth_token is stale → redirect to login
|
||||
await expect(page).toHaveURL(/\/login/);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user