feat(falahmobile): retheme app to premium dark spatial UI, implement waqf module, and resolve testing suite config
This commit is contained in:
+22
-14
@@ -2,12 +2,16 @@ import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('Authentication Flow', () => {
|
||||
test('should handle login, registration, and logout', async ({ page }) => {
|
||||
// Visit site → home page loads → see navbar
|
||||
// Visit site → redirects to /home → see bottom nav
|
||||
await page.goto('/');
|
||||
await expect(page.locator('nav')).toBeVisible();
|
||||
|
||||
// Click Profile tab to find Login button
|
||||
await page.click('text=Profile');
|
||||
await expect(page).toHaveURL(/\/profile/);
|
||||
|
||||
// Click Login → see login form
|
||||
await page.click('text=Login');
|
||||
await page.click('a[href="/login"]');
|
||||
await expect(page.locator('form')).toBeVisible();
|
||||
|
||||
// Try invalid login → see error message
|
||||
@@ -16,23 +20,27 @@ test.describe('Authentication Flow', () => {
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page.locator('text=Invalid credentials')).toBeVisible();
|
||||
|
||||
// Navigate to registration (assuming a link exists on login page)
|
||||
await page.click('text=Register');
|
||||
// Navigate to registration
|
||||
await page.click('a[href="/register"]');
|
||||
|
||||
// Fill registration form → submit → redirect to home
|
||||
await page.fill('input[name="name"]', 'Test User');
|
||||
await page.fill('input[name="email"]', 'newuser@example.com');
|
||||
await page.fill('input[name="password"]', 'securepassword123');
|
||||
const randomEmail = `newuser_${Date.now()}_${Math.floor(Math.random() * 1000)}@example.com`;
|
||||
await page.fill('input[type="text"]', 'Test User');
|
||||
await page.fill('input[type="email"]', randomEmail);
|
||||
await page.fill('input[placeholder="Min. 8 characters"]', 'securepassword123');
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
// Check redirect and authentication state
|
||||
await expect(page).toHaveURL('/');
|
||||
// See user menu or similar in navbar when authenticated
|
||||
await expect(page.locator('nav')).toContainText('Logout');
|
||||
await expect(page).toHaveURL(/\/nur/);
|
||||
|
||||
// Click logout → redirect to home → see login button
|
||||
await page.click('text=Logout');
|
||||
await expect(page).toHaveURL('/');
|
||||
await expect(page.locator('text=Login')).toBeVisible();
|
||||
// Go to Profile tab and check authenticated state
|
||||
await page.click('text=Profile');
|
||||
await expect(page.locator('nav')).toContainText('Profile');
|
||||
await expect(page.locator('button:has-text("Logout")')).toBeVisible();
|
||||
|
||||
// Click logout → redirect to login → see login button
|
||||
await page.click('button:has-text("Logout")');
|
||||
await expect(page).toHaveURL(/\/login/);
|
||||
await expect(page.locator('button:has-text("Sign In")')).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user