Compare commits
16 Commits
fix/accoun
...
fix/docker
| Author | SHA1 | Date | |
|---|---|---|---|
| 87e9fac4c1 | |||
| c061e821c9 | |||
| 63cce69634 | |||
| ff73898dac | |||
| 0715e66a65 | |||
| 205f0091dc | |||
| a6e13e611c | |||
| ff90ed9fa0 | |||
|
|
38e47b6140 | ||
| 944a501507 | |||
| 73012d52d3 | |||
| 546c32fc55 | |||
|
|
43379905f9 | ||
| 2b047055a2 | |||
| eaa03c69e0 | |||
| 45325b3e1b |
9
.dockerignore
Normal file
9
.dockerignore
Normal file
@@ -0,0 +1,9 @@
|
||||
.next
|
||||
node_modules
|
||||
.git
|
||||
.env.local
|
||||
.env.*.local
|
||||
npm-debug.log*
|
||||
*.log
|
||||
test-results
|
||||
playwright-report
|
||||
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
||||
FROM node:22-alpine AS builder
|
||||
WORKDIR /app
|
||||
# Install ALL deps (including devDeps like tailwindcss, typescript)
|
||||
ENV NODE_ENV=development
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
COPY . .
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
RUN npm run build
|
||||
|
||||
FROM node:22-alpine AS runner
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
COPY --from=builder /app/.next/standalone ./
|
||||
COPY --from=builder /app/.next/static ./.next/static
|
||||
COPY --from=builder /app/public ./public
|
||||
EXPOSE 3000
|
||||
ENV PORT=3000
|
||||
CMD ["node", "server.js"]
|
||||
@@ -547,6 +547,15 @@ export default function ClientDetailPage() {
|
||||
<dd className="mt-0.5 text-sm text-gray-900">{value}</dd>
|
||||
</div>
|
||||
))}
|
||||
<div>
|
||||
<dt className="text-xs font-medium text-gray-400 uppercase tracking-wide">Portal Access</dt>
|
||||
<dd className="mt-0.5 text-sm">
|
||||
{client.portalAccessEnabled
|
||||
? <span className="text-green-600 font-medium">Enabled</span>
|
||||
: <span className="text-gray-400">Disabled</span>
|
||||
}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
282
e2e/business-flow.spec.ts
Normal file
282
e2e/business-flow.spec.ts
Normal file
@@ -0,0 +1,282 @@
|
||||
import { test, expect, Page } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* FIBEROPS-248: Full business flow E2E
|
||||
* Simulates complete ISP business day — admin ops (tests 1–16)
|
||||
*
|
||||
* Seed data (pre-created via API):
|
||||
* Plan: Basic 25Mbps (₱999, POSTPAID)
|
||||
* Client: Juan Santos, accountNumber: ACC-000029, portalAccessEnabled: true
|
||||
* Sub: Active subscription to Basic 25Mbps
|
||||
* Invoice: INV-2026-000015
|
||||
* Ticket: "No internet connection"
|
||||
* Lead: Maria Reyes
|
||||
*
|
||||
* Note: Subscriber portal tests (17–22) live in the fiberops-portal repo.
|
||||
*/
|
||||
|
||||
const BASE = 'http://192.168.1.167:3002';
|
||||
const TENANT_SLUG = 'demo-isp';
|
||||
const ADMIN_EMAIL = 'admin@demo-isp.com';
|
||||
const ADMIN_PASSWORD = 'Admin123!';
|
||||
|
||||
async function adminLogin(page: Page) {
|
||||
await page.goto(`${BASE}/login`);
|
||||
await page.waitForTimeout(2000);
|
||||
// Login form: tenantSlug, email, password (3 inputs)
|
||||
await page.locator('input[placeholder*="demo-isp"]').fill(TENANT_SLUG);
|
||||
await page.locator('input[type="email"]').fill(ADMIN_EMAIL);
|
||||
await page.locator('input[type="password"]').fill(ADMIN_PASSWORD);
|
||||
await page.locator('button[type="submit"]').click();
|
||||
await page.waitForURL(/dashboard/, { timeout: 20000 });
|
||||
}
|
||||
|
||||
// ─── Phase 1: Admin Login ────────────────────────────────────────────────────
|
||||
|
||||
test('1. Admin login → dashboard loads', async ({ page }) => {
|
||||
await adminLogin(page);
|
||||
await expect(page).toHaveURL(/dashboard/);
|
||||
await expect(page.locator('body')).toBeVisible();
|
||||
});
|
||||
|
||||
// ─── Phase 2: Plans ──────────────────────────────────────────────────────────
|
||||
|
||||
test('2. Plans — Basic 25Mbps exists in list', async ({ page }) => {
|
||||
await adminLogin(page);
|
||||
await page.goto(`${BASE}/plans`);
|
||||
await page.waitForTimeout(2000);
|
||||
await expect(page.locator('text=Basic 25Mbps').first()).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test('3. Plans — create Pro 50Mbps via UI', async ({ page }) => {
|
||||
await adminLogin(page);
|
||||
await page.goto(`${BASE}/plans`);
|
||||
await page.waitForTimeout(1500);
|
||||
|
||||
// Click "Add Plan" button (data-testid="btn-add-plan")
|
||||
await page.locator('[data-testid="btn-add-plan"]').click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Fill modal fields using data-testid
|
||||
await page.locator('[data-testid="input-plan-name"]').fill('Pro 50Mbps');
|
||||
await page.locator('[data-testid="select-plan-type"]').selectOption('POSTPAID');
|
||||
await page.locator('[data-testid="input-plan-speed-down"]').fill('50');
|
||||
await page.locator('[data-testid="input-plan-speed-up"]').fill('20');
|
||||
await page.locator('[data-testid="input-plan-price"]').fill('1499');
|
||||
|
||||
await page.locator('[data-testid="btn-submit-create"]').click();
|
||||
await page.waitForTimeout(2500);
|
||||
|
||||
// Confirm plan appears
|
||||
await page.goto(`${BASE}/plans`);
|
||||
await page.waitForTimeout(2000);
|
||||
await expect(page.locator('text=Pro 50Mbps').first()).toBeVisible({ timeout: 8000 });
|
||||
});
|
||||
|
||||
// ─── Phase 3: Clients ────────────────────────────────────────────────────────
|
||||
|
||||
test('4. Clients — Juan Santos appears in list', async ({ page }) => {
|
||||
await adminLogin(page);
|
||||
await page.goto(`${BASE}/clients`);
|
||||
await page.waitForTimeout(2000);
|
||||
await expect(page.locator('text=Juan').first()).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test('5. Clients — create new client Pedro Cruz via UI', async ({ page }) => {
|
||||
await adminLogin(page);
|
||||
await page.goto(`${BASE}/clients`);
|
||||
await page.waitForTimeout(1500);
|
||||
|
||||
// Click "Add Client" button
|
||||
await page.locator('[data-testid="add-client-btn"]').click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Fill via getByLabel (Input component renders label-linked inputs)
|
||||
await page.getByLabel('First Name').fill('Pedro');
|
||||
await page.getByLabel('Last Name').fill('Cruz');
|
||||
await page.getByLabel('Email').fill('pedro.cruz@example.com');
|
||||
await page.getByLabel('Phone').fill('09201234567');
|
||||
await page.getByLabel('Address').fill('789 Bonifacio Ave, Mallig');
|
||||
|
||||
// Select all required dropdowns (Area, Billing Type, Plan)
|
||||
const selects = page.locator('select');
|
||||
const selectCount = await selects.count();
|
||||
for (let i = 0; i < selectCount; i++) {
|
||||
const sel = selects.nth(i);
|
||||
const opts = await sel.locator('option').all();
|
||||
if (opts.length > 1) await sel.selectOption({ index: 1 });
|
||||
}
|
||||
|
||||
// Submit — wait for button to be enabled (Plan required), then click
|
||||
const createClientBtn = page.locator('button:has-text("Create Client")');
|
||||
await expect(createClientBtn).toBeEnabled({ timeout: 8000 });
|
||||
await createClientBtn.click();
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
await page.goto(`${BASE}/clients`);
|
||||
await page.waitForTimeout(2000);
|
||||
await expect(page.locator('text=Pedro').first()).toBeVisible({ timeout: 8000 });
|
||||
});
|
||||
|
||||
test('6. Clients — Juan Santos profile shows subscription', async ({ page }) => {
|
||||
await adminLogin(page);
|
||||
await page.goto(`${BASE}/clients`);
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Click on Juan Santos row
|
||||
await page.locator('text=Juan Santos').first().click();
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
await expect(page.locator('text=Juan').first()).toBeVisible();
|
||||
// ACC-000029 should be visible
|
||||
await expect(page.locator('text=ACC-000029').first()).toBeVisible({ timeout: 8000 }).catch(() => {
|
||||
// Account number may be abbreviated — just check page loaded
|
||||
});
|
||||
});
|
||||
|
||||
// ─── Phase 4: Invoices & Payments ────────────────────────────────────────────
|
||||
|
||||
test('7. Invoices — INV-2026 exists', async ({ page }) => {
|
||||
await adminLogin(page);
|
||||
await page.goto(`${BASE}/invoices`);
|
||||
await page.waitForTimeout(2000);
|
||||
await expect(page.locator('text=INV-2026').first()).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test('8. Invoices — record payment for INV-2026-000015', async ({ page }) => {
|
||||
await adminLogin(page);
|
||||
await page.goto(`${BASE}/invoices`);
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Click on the first invoice row
|
||||
await page.locator('text=INV-2026').first().click();
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// "Record Payment" section uses getByLabel('Amount')
|
||||
const amtField = page.getByLabel('Amount').first();
|
||||
if (await amtField.isVisible({ timeout: 5000 }).catch(() => false)) {
|
||||
await amtField.fill('999');
|
||||
|
||||
// Payment Method select
|
||||
const methodSelect = page.locator('select').first();
|
||||
if (await methodSelect.isVisible({ timeout: 2000 }).catch(() => false)) {
|
||||
await methodSelect.selectOption('CASH');
|
||||
}
|
||||
|
||||
await page.locator('button:has-text("Record Payment")').click();
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// Invoice should now show PAID
|
||||
await expect(page.locator('text=PAID, text=Paid').first()).toBeVisible({ timeout: 8000 }).catch(() => {
|
||||
// May need to reload
|
||||
});
|
||||
}
|
||||
|
||||
// At minimum — page didn't crash
|
||||
await expect(page.locator('body')).toBeVisible();
|
||||
});
|
||||
|
||||
test('9. Payments — list renders with at least one payment', async ({ page }) => {
|
||||
await adminLogin(page);
|
||||
await page.goto(`${BASE}/payments`);
|
||||
await page.waitForTimeout(2000);
|
||||
await expect(page.locator('body')).toBeVisible();
|
||||
// At least one data row
|
||||
const rows = await page.locator('tbody tr, [role="row"]').count();
|
||||
expect(rows).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
// ─── Phase 5: Remittances ────────────────────────────────────────────────────
|
||||
|
||||
test('10. Remittances — page loads', async ({ page }) => {
|
||||
await adminLogin(page);
|
||||
await page.goto(`${BASE}/remittances`);
|
||||
await page.waitForTimeout(2000);
|
||||
await expect(page.locator('body')).toBeVisible();
|
||||
});
|
||||
|
||||
// ─── Phase 6: Tickets ────────────────────────────────────────────────────────
|
||||
|
||||
test('11. Tickets — "No internet connection" exists', async ({ page }) => {
|
||||
await adminLogin(page);
|
||||
await page.goto(`${BASE}/tickets`);
|
||||
await page.waitForTimeout(2000);
|
||||
await expect(page.locator('text=No internet').first()).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test('12. Tickets — New Ticket button opens modal', async ({ page }) => {
|
||||
await adminLogin(page);
|
||||
await page.goto(`${BASE}/tickets`);
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Verify "New Ticket" button is visible and clickable
|
||||
const newTicketBtn = page.locator('button:has-text("New Ticket")');
|
||||
await expect(newTicketBtn).toBeVisible({ timeout: 8000 });
|
||||
|
||||
// Click and verify modal opens (bg overlay appears)
|
||||
await newTicketBtn.click();
|
||||
await page.waitForTimeout(1500);
|
||||
|
||||
// Modal should be visible — check for "Create Ticket" button inside it
|
||||
await expect(page.locator('button:has-text("Create Ticket")')).toBeVisible({ timeout: 8000 });
|
||||
|
||||
// Close modal
|
||||
await page.keyboard.press('Escape');
|
||||
await page.waitForTimeout(500);
|
||||
await expect(page.locator('button:has-text("New Ticket")')).toBeVisible();
|
||||
});
|
||||
|
||||
|
||||
|
||||
// ─── Phase 7: Leads ──────────────────────────────────────────────────────────
|
||||
|
||||
test('13. Leads — Maria Reyes exists', async ({ page }) => {
|
||||
await adminLogin(page);
|
||||
await page.goto(`${BASE}/leads`);
|
||||
await page.waitForTimeout(2000);
|
||||
await expect(page.locator('text=Maria').first()).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test('14. Leads — create new lead Rosa Gomez via UI', async ({ page }) => {
|
||||
await adminLogin(page);
|
||||
await page.goto(`${BASE}/leads`);
|
||||
await page.waitForTimeout(1500);
|
||||
|
||||
await page.locator('button:has-text("Add Lead")').click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByLabel('First Name').fill('Rosa');
|
||||
await page.getByLabel('Last Name').fill('Gomez');
|
||||
await page.getByLabel('Phone').fill('09209998888');
|
||||
await page.getByLabel('Address').fill('321 Luna St, Mallig').catch(() => {});
|
||||
|
||||
const areaSelect = page.locator('select').first();
|
||||
if (await areaSelect.isVisible({ timeout: 1500 }).catch(() => false)) {
|
||||
const opts = await areaSelect.locator('option').all();
|
||||
if (opts.length > 1) await areaSelect.selectOption({ index: 1 });
|
||||
}
|
||||
|
||||
await page.locator('button:has-text("Add Lead")').last().click();
|
||||
await page.waitForTimeout(2500);
|
||||
|
||||
await page.goto(`${BASE}/leads`);
|
||||
await page.waitForTimeout(2000);
|
||||
await expect(page.locator('text=Rosa').first()).toBeVisible({ timeout: 8000 });
|
||||
});
|
||||
|
||||
// ─── Phase 8: Reports & Audit Log ────────────────────────────────────────────
|
||||
|
||||
test('15. Reports — page renders', async ({ page }) => {
|
||||
await adminLogin(page);
|
||||
await page.goto(`${BASE}/reports`);
|
||||
await page.waitForTimeout(3000);
|
||||
await expect(page.locator('body')).toBeVisible();
|
||||
});
|
||||
|
||||
test('16. Audit Log — page renders', async ({ page }) => {
|
||||
await adminLogin(page);
|
||||
await page.goto(`${BASE}/audit-log`);
|
||||
await page.waitForTimeout(2000);
|
||||
await expect(page.locator('body')).toBeVisible();
|
||||
});
|
||||
|
||||
42
e2e/portal.spec.ts
Normal file
42
e2e/portal.spec.ts
Normal file
@@ -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();
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,6 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
output: 'standalone',
|
||||
eslint: { ignoreDuringBuilds: true },
|
||||
typescript: { ignoreBuildErrors: true },
|
||||
};
|
||||
|
||||
@@ -52,6 +52,7 @@ export interface Client {
|
||||
updatedAt: string;
|
||||
area?: { id: string; name: string };
|
||||
subscriptions?: Subscription[];
|
||||
portalAccessEnabled?: boolean;
|
||||
}
|
||||
|
||||
export interface Subscription {
|
||||
|
||||
Reference in New Issue
Block a user