39 lines
1.6 KiB
TypeScript
39 lines
1.6 KiB
TypeScript
import { test, expect, type Page } from '@playwright/test';
|
|
|
|
async function login(page: Page) {
|
|
await page.goto('/login/');
|
|
await page.fill('#lg-username', 'demo');
|
|
await page.fill('#lg-password', 'demo');
|
|
await page.click('button[type=submit]');
|
|
await expect(page.getByTestId('nav-menu')).toBeVisible();
|
|
}
|
|
|
|
test('settings persist across a reload and switch the UI language', async ({ page }) => {
|
|
await login(page);
|
|
await page.getByTestId('tab-settings').click();
|
|
|
|
// Coordinate format is a display-only setting; it must survive a reload.
|
|
await page.getByTestId('set-format.coords').selectOption('dms');
|
|
await page.getByTestId('set-format.units').selectOption('imperial');
|
|
|
|
// Locale takes effect immediately (dictionaries swap in place).
|
|
await page.getByTestId('set-locale').selectOption('en');
|
|
await expect(page.getByTestId('tab-settings')).toHaveText('Settings');
|
|
|
|
await page.reload();
|
|
await page.getByTestId('tab-settings').click();
|
|
await expect(page.getByTestId('set-format.coords')).toHaveValue('dms');
|
|
await expect(page.getByTestId('set-format.units')).toHaveValue('imperial');
|
|
await expect(page.getByTestId('set-locale')).toHaveValue('en');
|
|
});
|
|
|
|
test('the comparison tab reports landing coordinates for a run scenario', async ({ page }) => {
|
|
await login(page);
|
|
await page.getByTestId('run-btn').click();
|
|
await expect(page.getByTestId('flight-time')).toBeVisible({ timeout: 15000 });
|
|
|
|
await page.getByTestId('tab-compare').click();
|
|
await expect(page.getByTestId('compare-table')).toBeVisible();
|
|
// One scenario → a row, but no spread figure yet (that needs two).
|
|
await expect(page.getByTestId('compare-spread')).toHaveCount(0);
|
|
});
|