diff --git a/e2e/portal.spec.ts b/e2e/portal.spec.ts new file mode 100644 index 0000000..4bd4b97 --- /dev/null +++ b/e2e/portal.spec.ts @@ -0,0 +1,42 @@ +import { test, expect } from '@playwright/test'; + +test.describe('Subscriber Portal', () => { + test('portal login page loads', async ({ page }) => { + await page.goto('/portal/login'); + await page.waitForTimeout(2000); + await expect(page.locator('input[type="text"], input[placeholder*="account" i]').first()).toBeVisible({ timeout: 10000 }); + }); + + test('portal login page has password field', async ({ page }) => { + await page.goto('/portal/login'); + await page.waitForTimeout(2000); + await expect(page.locator('input[type="password"]')).toBeVisible(); + }); + + test('portal login page shows FiberOps branding', async ({ page }) => { + await page.goto('/portal/login'); + await page.waitForTimeout(2000); + await expect(page.locator('text=FiberOps').first()).toBeVisible(); + }); + + test('portal login redirects to dashboard on wrong creds', async ({ page }) => { + await page.goto('/portal/login'); + await page.waitForTimeout(2000); + // Fill and submit + const inputs = page.locator('input'); + const count = await inputs.count(); + if (count >= 3) { + await inputs.nth(0).fill('demo-isp'); + await inputs.nth(1).fill('ACC-000001'); + await inputs.nth(2).fill('wrongpassword'); + } + // Should stay on login (not crash) + const btn = page.locator('button[type="submit"], button:has-text("Login"), button:has-text("Sign In")').first(); + if (await btn.isVisible()) { + await btn.click(); + await page.waitForTimeout(3000); + } + // Should not crash — still render something + await expect(page.locator('body')).toBeVisible(); + }); +});