forked from cardosofelipe/fast-next-template
Add comprehensive E2E tests for homepage and refactor demo modal logic
- Implemented E2E tests for homepage sections: `HeroSection`, `Header`, `CTASection`, `AnimatedTerminal`, `FeatureSections`, and `Footer`, ensuring proper functionality, navigation, and accessibility. - Introduced tests for mobile menu interactions, demo credentials modal, and terminal animations. - Refactored demo modal logic to use a shared state managed in `page.tsx` for consistency across sections (`Header`, `HeroSection`, `CTASection`). - Updated `Header`, `HeroSection`, and `CTASection` to receive `onOpenDemoModal` as props for triggering the modal.
This commit is contained in:
@@ -16,8 +16,12 @@ test.describe('Admin Access Control', () => {
|
||||
await setupAuthenticatedMocks(page);
|
||||
await loginViaUI(page);
|
||||
|
||||
// Should not see admin link in navigation
|
||||
const adminLinks = page.getByRole('link', { name: /admin/i });
|
||||
// Navigate to authenticated page to test authenticated header (not homepage)
|
||||
await page.goto('/settings');
|
||||
await page.waitForSelector('h1:has-text("Settings")', { timeout: 10000 });
|
||||
|
||||
// Should not see admin link in authenticated header navigation
|
||||
const adminLinks = page.getByRole('link', { name: /^admin$/i });
|
||||
const visibleAdminLinks = await adminLinks.count();
|
||||
expect(visibleAdminLinks).toBe(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user