Files
line-of-sight/frontend/e2e/app.spec.js
T
(jenkins) bd9e92f304
Tests / frontend-test (pull_request) Has been cancelled
Tests / e2e-test (pull_request) Has been cancelled
Tests / backend-test (pull_request) Has been cancelled
Configure Playwright for headless CI and add Gitea workflow with container support
2026-03-17 00:29:39 +00:00

41 lines
1.5 KiB
JavaScript

import { test, expect } from '@playwright/test';
test.describe('Line of Sight Application', () => {
test('should load the home page and show settings', async ({ page }) => {
await page.goto('/');
await expect(page.locator('text=Line of Sight Settings')).toBeVisible();
await expect(page.locator('text=Direction')).toBeVisible();
});
test('should be able to toggle map style', async ({ page }) => {
await page.goto('/');
const darkButton = page.locator('button:text("Dark")');
await darkButton.click();
await expect(darkButton).toHaveClass(/active-style/);
});
test('should show results when clicking the search button', async ({ page }) => {
await page.goto('/');
// Mock the API response to avoid dependency on backend for E2E if desired,
// but here we let it hit the real backend if it's up.
// For a robust E2E in CI, we usually mock.
await page.route('**/api/line-of-sight*', async route => {
const json = {
success: true,
data: {
conurbations: [
{ id: 1, name: 'Test City', population: 100000, country: 'TS', lat: 0, lon: 0, distance_km: 10, off_line_km: 1 }
],
line_coordinates: [{ lat: 0, lon: 0 }, { lat: 1, lon: 1 }]
}
};
await route.fulfill({ json });
});
await page.click('button:text("Show Line of Sight")');
await expect(page.locator('text=Conurbations Found')).toBeVisible();
await expect(page.locator('text=Test City')).toBeVisible();
});
});