mirror of
https://github.com/librespeed/speedtest.git
synced 2026-06-29 05:12:28 +00:00
* Initial plan * Add Docker TAGLINE env customization for modern UI slogan Agent-Logs-Url: https://github.com/librespeed/speedtest/sessions/e1da6e0e-5194-453d-bffb-961ed782e215 Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com> * Refine TAGLINE replacement and expand E2E coverage Agent-Logs-Url: https://github.com/librespeed/speedtest/sessions/e1da6e0e-5194-453d-bffb-961ed782e215 Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com> * Fix TAGLINE sed delimiter and add apostrophe tagline E2E test - Switch TAGLINE sed from '#' to '/' delimiter so html_escape'd apostrophes (') don't break the sed expression - Add standalone-apostrophe Docker service with TAGLINE="It'd rather be fast!" - Add standaloneApostrophe URL (port 18186) to env.js - Add E2E test asserting the apostrophe tagline renders correctly Agent-Logs-Url: https://github.com/librespeed/speedtest/sessions/ebe265a8-4b1e-49b5-959a-66133ea0ab3a Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>
59 lines
2.6 KiB
JavaScript
59 lines
2.6 KiB
JavaScript
const { test, expect } = require('@playwright/test');
|
|
const { baseUrls } = require('./helpers/env');
|
|
const { modernStartButton } = require('./helpers/ui');
|
|
|
|
const defaultTagline = 'No Flash, No Java, No Websockets, No Bullsh*t';
|
|
|
|
test.describe('Runtime mode smoke coverage', () => {
|
|
test('standalone exposes UI and local backend endpoints', async ({ page, request }) => {
|
|
const root = await request.get(`${baseUrls.standalone}/`);
|
|
expect(root.ok()).toBeTruthy();
|
|
|
|
const index = await request.get(`${baseUrls.standalone}/index.html`);
|
|
expect(index.ok()).toBeTruthy();
|
|
await expect(await index.text()).toContain('design-switch.js');
|
|
|
|
for (const endpoint of ['/backend/empty.php', '/backend/garbage.php', '/backend/getIP.php']) {
|
|
const response = await request.get(`${baseUrls.standalone}${endpoint}`);
|
|
expect(response.ok()).toBeTruthy();
|
|
}
|
|
|
|
await page.goto(`${baseUrls.standalone}/index-modern.html`);
|
|
await expect(modernStartButton(page)).toBeVisible();
|
|
await expect(page.locator('main > p.tagline')).toHaveText(defaultTagline);
|
|
});
|
|
|
|
test('backend exposes only local backend contract endpoints', async ({ request }) => {
|
|
for (const endpoint of ['/empty.php', '/garbage.php', '/getIP.php']) {
|
|
const response = await request.get(`${baseUrls.backend}${endpoint}`);
|
|
expect(response.ok()).toBeTruthy();
|
|
}
|
|
});
|
|
|
|
test('frontend serves UI and server list without local backend contract', async ({ page, request }) => {
|
|
const serverList = await request.get(`${baseUrls.frontend}/server-list.json`);
|
|
expect(serverList.ok()).toBeTruthy();
|
|
await expect(await serverList.text()).toContain('Backend testpoint');
|
|
|
|
const localBackendEndpoint = await request.get(`${baseUrls.frontend}/backend/empty.php`);
|
|
expect(localBackendEndpoint.status()).toBe(404);
|
|
|
|
await page.goto(`${baseUrls.frontend}/index-modern.html`);
|
|
await expect(modernStartButton(page)).toBeVisible();
|
|
await expect(page.locator('#selected-server')).not.toHaveText(/searching nearest server/i);
|
|
});
|
|
|
|
test('dual combines frontend and local backend availability', async ({ page, request }) => {
|
|
const serverList = await request.get(`${baseUrls.dual}/server-list.json`);
|
|
expect(serverList.ok()).toBeTruthy();
|
|
await expect(await serverList.text()).toContain('Local dual backend');
|
|
|
|
for (const endpoint of ['/backend/empty.php', '/backend/garbage.php', '/backend/getIP.php']) {
|
|
const response = await request.get(`${baseUrls.dual}${endpoint}`);
|
|
expect(response.ok()).toBeTruthy();
|
|
}
|
|
|
|
await page.goto(`${baseUrls.dual}/index-modern.html`);
|
|
await expect(modernStartButton(page)).toBeVisible();
|
|
});
|
|
});
|