Files
ontime/e2e/tests/features/214-pwa-install.spec.ts
T
google-labs-jules[bot] 84459b06e2 feat: dynamically set PWA start_url
This commit fixes an issue where the PWA would always start at the
root of the application, regardless of the page you were on when
you installed it.

This is fixed by:
- Consolidating the two manifest files into a single file.
- Adding a new route to the server that dynamically generates the
  `start_url` in the manifest based on the current route.
- Adding an e2e test to verify the changes.
2025-07-24 17:27:02 +00:00

38 lines
1.0 KiB
TypeScript

import { test, expect } from '@playwright/test';
test('manifest start_url is correct for cuesheet', async ({ page }) => {
await page.goto('/cuesheet');
const manifestUrl = await page.evaluate(() => {
const link = document.querySelector('link[rel="manifest"]');
if (!link) {
return null;
}
return (link as HTMLLinkElement).href;
});
expect(manifestUrl).not.toBeNull();
const response = await page.request.get(manifestUrl!);
const manifest = await response.json();
expect(manifest.start_url).toContain('/cuesheet');
});
test('manifest start_url is correct for op', async ({ page }) => {
await page.goto('/op');
const manifestUrl = await page.evaluate(() => {
const link = document.querySelector('link[rel="manifest"]');
if (!link) {
return null;
}
return (link as HTMLLinkElement).href;
});
expect(manifestUrl).not.toBeNull();
const response = await page.request.get(manifestUrl!);
const manifest = await response.json();
expect(manifest.start_url).toContain('/op');
});