Files
luci-app-zt-gateway/e2e/drain.spec.ts

44 lines
1.5 KiB
TypeScript
Raw Normal View History

import { test, expect } from '@playwright/test';
import { login, resetToAmsterdam } from './utils/auth';
const ZT_PAGE = '/cgi-bin/luci/admin/services/zt-gateway';
test.describe('drain UI', () => {
test.beforeEach(async ({ page }) => {
await login(page);
await resetToAmsterdam(page);
await page.goto(ZT_PAGE);
await page.waitForSelector('.zt-mode-select');
});
test.afterEach(async ({ page }) => {
await resetToAmsterdam(page);
});
test('selecting graceful mode shows drain timeout', async ({ page }) => {
await page.locator('.zt-mode-select').selectOption('graceful');
const timeoutRow = page.locator('.zt-drain-timeout-row');
await expect(timeoutRow).toBeVisible();
});
test('switching with graceful mode shows drain panel', async ({ page }) => {
// Select tirunelveli radio
await page.locator('input[name="zt_gateway_region"][value="tirunelveli"]').check();
// Change mode to graceful
await page.locator('.zt-mode-select').selectOption('graceful');
// Click "Switch to selected"
await page.locator('.cbi-button-positive').click();
// Wait for the drain panel to appear (may be brief if conntrack is unavailable)
const drainPanel = page.locator('.zt-drain-panel');
await expect(drainPanel).toBeVisible({ timeout: 45_000 });
await expect(drainPanel).toContainText('Graceful drain progress');
// Panel references old and new IP addresses
await expect(drainPanel).toContainText(/\d+\.\d+\.\d+\.\d+/);
});
});