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:
@@ -13,10 +13,6 @@ jest.mock('@/components/theme', () => ({
|
||||
),
|
||||
}));
|
||||
|
||||
jest.mock('@/components/auth', () => ({
|
||||
AuthInitializer: () => <div data-testid="auth-initializer" />,
|
||||
}));
|
||||
|
||||
// Mock TanStack Query
|
||||
jest.mock('@tanstack/react-query', () => ({
|
||||
QueryClient: jest.fn().mockImplementation(() => ({})),
|
||||
@@ -56,16 +52,6 @@ describe('Providers', () => {
|
||||
expect(screen.getByTestId('query-provider')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders AuthInitializer', () => {
|
||||
render(
|
||||
<Providers>
|
||||
<div>Test Content</div>
|
||||
</Providers>
|
||||
);
|
||||
|
||||
expect(screen.getByTestId('auth-initializer')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders children', () => {
|
||||
render(
|
||||
<Providers>
|
||||
|
||||
Reference in New Issue
Block a user