chore: clean up repo structure

- Add node_modules/, test-results/, e2e-report/, .omp/ to .gitignore
- Remove throwaway debug scripts (debug-pw*.js, debug-login-dom.js)
- Remove empty mock-server/ directory
- Untrack harness artifact (.omp/plans/)
- Add missing project files to git (e2e tests, Dockerfiles, tooling configs)
This commit is contained in:
2026-07-12 23:42:54 +05:30
parent eb04a2597d
commit c6c5a04aca
25 changed files with 1400 additions and 1458 deletions

48
e2e/switch.spec.ts Normal file
View File

@@ -0,0 +1,48 @@
import { test, expect } from '@playwright/test';
import { login, resetToAmsterdam } from './utils/auth';
const ZT_PAGE = '/cgi-bin/luci/admin/services/zt-gateway';
test.describe('ZT Gateway switch', () => {
test.describe.configure({ mode: 'serial' });
test.beforeEach(async ({ page }) => {
await login(page);
await resetToAmsterdam(page);
await page.goto(ZT_PAGE);
await page.waitForSelector('.zt-gateway-row', { timeout: 15_000 });
});
test.afterEach(async ({ page }) => {
await resetToAmsterdam(page);
});
test('switches active gateway to tirunelveli', async ({ page }) => {
// Select tirunelveli radio button
const tirunelveliRow = page.locator('tr.zt-gateway-row[data-region="tirunelveli"]');
await tirunelveliRow.locator('input[type="radio"]').click();
// Click the "Switch to selected" button
const switchBtn = page.locator('button.cbi-button-positive', { hasText: 'Switch' });
await switchBtn.click();
// Wait for a notification to appear
await page.waitForSelector('.alert-message', { timeout: 10_000 });
// Poll for the active gateway to change — the RPC takes 12-30s
await page.waitForFunction(
() => {
const row = document.querySelector('tr.zt-gateway-row[data-region="tirunelveli"]');
return row?.textContent?.includes('active') ?? false;
},
{ timeout: 45_000, polling: 2_000 },
);
// Verify tirunelveli row now contains "active"
await expect(tirunelveliRow).toContainText('active');
// Verify amsterdam row no longer contains "active"
const amsterdamRow = page.locator('tr.zt-gateway-row[data-region="amsterdam"]');
await expect(amsterdamRow).not.toContainText('active');
});
});