Adds hundreds of unit/integration/e2e tests, fixes WS bcrypt auth, config merge, fleet analytics, agent schedule/log tail, and documents stale PROBLEMS items. Updates PROBLEMS.md, README, and test scripts; ignores local spread-kits and coverage dirs.
73 lines
2.5 KiB
TypeScript
73 lines
2.5 KiB
TypeScript
import { expect, test } from '@playwright/test';
|
|
import { loginToDashboard } from './fixtures';
|
|
|
|
const OFFLINE_AGENT = {
|
|
id: 'e2e-offline-agent',
|
|
name: 'Offline Node',
|
|
wallet: '4' + 'A'.repeat(94),
|
|
ip: '192.168.1.99',
|
|
version: '1.0.0',
|
|
status: 'offline',
|
|
cpu_cores: 4,
|
|
memory_gb: 8,
|
|
last_seen: new Date(Date.now() - 3600_000).toISOString(),
|
|
created_at: new Date().toISOString(),
|
|
hashrate_15s: 0,
|
|
hashrate_1m: 0,
|
|
hashrate_15m: 0,
|
|
shares_total: 0,
|
|
shares_good: 0,
|
|
shares_bad: 0,
|
|
cpu_usage_pct: 0,
|
|
memory_usage_pct: 0,
|
|
uptime_seconds: 0,
|
|
platform: 'windows',
|
|
arch: 'amd64',
|
|
};
|
|
|
|
test.describe('Remote actions UI', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.route('**/api/v1/agents', async (route) => {
|
|
if (route.request().method() === 'GET' && route.request().url().endsWith('/agents')) {
|
|
await route.fulfill({ json: [OFFLINE_AGENT] });
|
|
return;
|
|
}
|
|
await route.continue();
|
|
});
|
|
await page.route('**/api/v1/agents/*/stats*', async (route) => {
|
|
await route.fulfill({ json: [] });
|
|
});
|
|
await page.route('**/api/v1/builds', async (route) => {
|
|
await route.fulfill({ json: [] });
|
|
});
|
|
await page.route('**/api/v1/server/info', async (route) => {
|
|
await route.fulfill({
|
|
json: {
|
|
version: 'test',
|
|
suggested_url: 'http://127.0.0.1:8989',
|
|
agent_count: 1,
|
|
online_count: 0,
|
|
},
|
|
});
|
|
});
|
|
await loginToDashboard(page);
|
|
await page.getByRole('link', { name: /Fleet Roster/i }).click();
|
|
await expect(page.getByRole('heading', { name: 'Fleet Roster' })).toBeVisible({ timeout: 10_000 });
|
|
await expect(page.getByText('Offline Node')).toBeVisible({ timeout: 10_000 });
|
|
});
|
|
|
|
test('detail panel disables remote actions for offline agent', async ({ page }) => {
|
|
await page.getByText('Offline Node').click();
|
|
const detail = page.locator('.agent-detail');
|
|
await expect(detail.getByRole('heading', { name: 'Remote Control' })).toBeVisible({ timeout: 10_000 });
|
|
await expect(detail.getByRole('button', { name: 'Screenshot' })).toBeDisabled();
|
|
await expect(detail.getByRole('button', { name: 'Pause' })).toBeDisabled();
|
|
});
|
|
|
|
test('compact row remote actions disabled when offline', async ({ page }) => {
|
|
await page.getByText('Offline Node').click();
|
|
const compact = page.locator('.agent-list-item.expanded');
|
|
await expect(compact.getByRole('button', { name: 'Pause' })).toBeDisabled();
|
|
});
|
|
});
|