Przeglądaj źródła

test(e2e): cover Alpine modern frontend settings

sstidl 1 dzień temu
rodzic
commit
54179567ac

+ 2 - 0
Dockerfile.alpine

@@ -46,6 +46,8 @@ COPY index.html /speedtest/
 COPY index-classic.html /speedtest/
 COPY index-modern.html /speedtest/
 COPY config.json /speedtest/
+COPY settings.json /speedtest/
+COPY server-list.json /speedtest/
 COPY stability.html /speedtest/
 COPY favicon.ico /speedtest/
 COPY manifest.webmanifest /speedtest/

+ 11 - 0
tests/docker-compose-playwright.yml

@@ -31,6 +31,17 @@ services:
     ports:
       - "18185:8080"
 
+  standalone-alpine:
+    build:
+      context: ..
+      dockerfile: Dockerfile.alpine
+    environment:
+      - MODE=standalone
+      - WEBPORT=8080
+      - USE_NEW_DESIGN=true
+    ports:
+      - "18187:8080"
+
   standalone-apostrophe:
     build:
       context: ..

+ 1 - 0
tests/e2e/global-setup.js

@@ -68,6 +68,7 @@ module.exports = async () => {
   const timeoutMs = 180_000;
   await waitForReady('standalone', 'http://127.0.0.1:18180/index.html', timeoutMs);
   await waitForReady('standalone-new', 'http://127.0.0.1:18185/index.html', timeoutMs);
+  await waitForReady('standalone-alpine', 'http://127.0.0.1:18187/index.html', timeoutMs);
   await waitForReady('backend', 'http://127.0.0.1:18181/empty.php', timeoutMs);
   await waitForReady('frontend', 'http://127.0.0.1:18182/index-modern.html', timeoutMs);
   await waitForReady('dual', 'http://127.0.0.1:18183/index-modern.html', timeoutMs);

+ 1 - 0
tests/e2e/helpers/env.js

@@ -5,6 +5,7 @@ const baseUrls = {
   dual: 'http://127.0.0.1:18183',
   standaloneNew: 'http://127.0.0.1:18185',
   standaloneApostrophe: 'http://127.0.0.1:18186',
+  standaloneAlpine: 'http://127.0.0.1:18187',
 };
 
 module.exports = {

+ 9 - 0
tests/e2e/modes.spec.js

@@ -23,6 +23,15 @@ test.describe('Runtime mode smoke coverage', () => {
     await expect(page.locator('main > p.tagline')).toHaveText(defaultTagline);
   });
 
+  test('Alpine standalone serves modern frontend settings', async ({ page, request }) => {
+    const settings = await request.get(`${baseUrls.standaloneAlpine}/settings.json`);
+    expect(settings.ok()).toBeTruthy();
+    await expect(settings.json()).resolves.toMatchObject({ telemetry_level: 'off', time_dl_max: 12 });
+
+    await page.goto(`${baseUrls.standaloneAlpine}/index-modern.html`);
+    await expect(modernStartButton(page)).toBeVisible();
+  });
+
   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}`);