Skip to content

Commit 84d47d2

Browse files
committed
Add per-format favicons, manifests, and CI workflow
- Generate favicons (16x16, 32x32, 180x180, 192x192, 512x512) for brotli (.br), deflate (.def), zlib (.zlib), and zstd (.zst) in the same blue/white style as the existing gzip favicon - Add per-format PWA manifests (manifest-{format}.json) referencing the correct icons - Swap favicon <link> hrefs and manifest href via the existing inline JS script when a non-gzip format is detected - Add Playwright webServer config so the test suite starts and stops the dev server automatically - Add favicon and manifest assertions to the per-format test blocks - Add .github/workflows/ci.yml: build, trust dev cert, install Chromium, run Playwright tests, upload HTML report as artifact
1 parent d05ea1c commit 84d47d2

29 files changed

Lines changed: 166 additions & 2 deletions

.github/workflows/ci.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v4
18+
with:
19+
dotnet-version: '10.0.x'
20+
21+
- name: Setup Node
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
cache: 'npm'
26+
cache-dependency-path: e2e/package-lock.json
27+
28+
- name: Restore .NET dependencies
29+
run: dotnet restore
30+
31+
- name: Build
32+
run: dotnet build --no-restore
33+
34+
- name: Install Playwright dependencies
35+
working-directory: e2e
36+
run: npm ci
37+
38+
- name: Trust .NET dev certificate
39+
run: dotnet dev-certs https --trust
40+
41+
- name: Install Playwright browsers
42+
working-directory: e2e
43+
run: npx playwright install --with-deps chromium
44+
45+
- name: Run E2E tests
46+
working-directory: e2e
47+
run: npx playwright test
48+
env:
49+
CI: true
50+
51+
- name: Upload Playwright report
52+
if: always()
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: playwright-report
56+
path: e2e/playwright-report/
57+
retention-days: 7

e2e/package-lock.json

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/playwright.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,11 @@ module.exports = defineConfig({
77
baseURL: 'https://localhost:5001',
88
ignoreHTTPSErrors: true,
99
},
10+
webServer: {
11+
command: 'dotnet run --project .. --urls https://localhost:5001',
12+
url: 'https://localhost:5001',
13+
timeout: 60000,
14+
reuseExistingServer: !process.env.CI,
15+
ignoreHTTPSErrors: true,
16+
},
1017
});

e2e/tests/app.spec.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,19 @@ for (const format of ['brotli', 'deflate', 'zlib', 'zstd']) {
105105
test(`intro paragraph mentions ${format}`, async ({ page }) => {
106106
await expect(page.locator('#intro-paragraph')).toContainText(new RegExp(displayName, 'i'));
107107
});
108+
109+
test(`favicons point to ${format} assets`, async ({ page }) => {
110+
const icon32 = await page.locator('link[rel="icon"][sizes="32x32"]').getAttribute('href');
111+
const icon16 = await page.locator('link[rel="icon"][sizes="16x16"]').getAttribute('href');
112+
const touch = await page.locator('link[rel="apple-touch-icon"][sizes="180x180"]').getAttribute('href');
113+
expect(icon32).toContain(`/assets/${format}/`);
114+
expect(icon16).toContain(`/assets/${format}/`);
115+
expect(touch).toContain(`/assets/${format}/`);
116+
});
117+
118+
test(`manifest points to ${format} manifest`, async ({ page }) => {
119+
const manifest = await page.locator('link[rel="manifest"]').getAttribute('href');
120+
expect(manifest).toBe(`manifest-${format}.json`);
121+
});
108122
});
109123
}

wwwroot/assets/brotli/192x192.png

2.59 KB
Loading

wwwroot/assets/brotli/512x512.png

7.67 KB
Loading
2.43 KB
Loading
246 Bytes
Loading
467 Bytes
Loading

wwwroot/assets/deflate/192x192.png

3.04 KB
Loading

0 commit comments

Comments
 (0)