Mining/ui/e2e/api/miners.api.spec.ts
snider 8460b8f3be feat: Add multi-miner dashboard support and TT-Miner implementation
Dashboard:
- Add aggregate stats across all running miners (total hashrate, shares)
- Add workers table with per-miner stats, efficiency, and controls
- Show hashrate bars and efficiency badges for each worker
- Support stopping individual workers or all at once

TT-Miner:
- Implement Install, Start, GetStats, CheckInstallation, Uninstall
- Add TT-Miner to Manager's StartMiner and ListAvailableMiners
- Support GPU-specific config options (devices, intensity, cliArgs)

Chart:
- Improve styling with WA-Pro theme variables
- Add hashrate unit formatting (H/s, kH/s, MH/s)
- Better tooltip and axis styling

Also:
- Fix XMRig download URLs (linux-static-x64, windows-x64)
- Add Playwright E2E testing infrastructure
- Add XMR pool research documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 22:48:20 +00:00

51 lines
1.8 KiB
TypeScript

import { test, expect } from '@playwright/test';
import { API_BASE } from '../fixtures/test-data';
test.describe('Miners API Endpoints', () => {
test('GET /miners - returns list of running miners', async ({ request }) => {
const response = await request.get(`${API_BASE}/miners`);
expect(response.ok()).toBeTruthy();
const body = await response.json();
expect(Array.isArray(body)).toBeTruthy();
});
test('GET /miners/available - returns available miner types', async ({ request }) => {
const response = await request.get(`${API_BASE}/miners/available`);
expect(response.ok()).toBeTruthy();
const body = await response.json();
expect(Array.isArray(body)).toBeTruthy();
expect(body.length).toBeGreaterThan(0);
// Check xmrig is in the list
const xmrig = body.find((m: { name: string }) => m.name === 'xmrig');
expect(xmrig).toBeDefined();
expect(xmrig).toHaveProperty('description');
});
test.describe('error handling', () => {
test('GET /miners/:name/stats - returns 404 for non-existent miner', async ({ request }) => {
const response = await request.get(`${API_BASE}/miners/nonexistent/stats`);
expect(response.status()).toBe(404);
});
test('DELETE /miners/:name - handles stopping non-running miner', async ({ request }) => {
const response = await request.delete(`${API_BASE}/miners/nonexistent`);
// Should return error since miner isn't running
expect(response.status()).toBeGreaterThanOrEqual(400);
});
test('GET /miners/:name/hashrate-history - returns 404 for non-existent miner', async ({
request,
}) => {
const response = await request.get(`${API_BASE}/miners/nonexistent/hashrate-history`);
expect(response.status()).toBe(404);
});
});
});