forked from cardosofelipe/fast-next-template
Refactor E2E tests to use ID selectors and enhance mock auth injection
- Updated E2E selectors for input fields to use stable IDs instead of `name` attributes, improving reliability and alignment with form field guarantees. - Refined mock auth state injection in Playwright to establish test store state prior to page load. - Optimized test clarity and consistency by consolidating selector logic and introducing stabilization steps where necessary. - Removed redundant `AuthInitializer` mocks and refactored related tests to align with the updated `AuthContext` pattern. - Enhanced readability and maintainability across affected test suites.
This commit is contained in:
17
frontend/e2e/test-selectors.spec.ts
Normal file
17
frontend/e2e/test-selectors.spec.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { test } from '@playwright/test';
|
||||
import { setupAuthenticatedMocks } from './helpers/auth';
|
||||
|
||||
test('debug selectors', async ({ page }) => {
|
||||
await setupAuthenticatedMocks(page);
|
||||
await page.goto('/settings/profile');
|
||||
await page.waitForTimeout(2000); // Wait for render
|
||||
|
||||
// Print all input elements
|
||||
const inputs = await page.locator('input').all();
|
||||
for (const input of inputs) {
|
||||
const name = await input.getAttribute('name');
|
||||
const id = await input.getAttribute('id');
|
||||
const type = await input.getAttribute('type');
|
||||
console.log(`Input: id="${id}", name="${name}", type="${type}"`);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user