fix: use app icon across browser and chat
This commit is contained in:
@@ -5,8 +5,9 @@ describe('PWA metadata', () => {
|
||||
it('links manifest and touch icon from the client shell', () => {
|
||||
const html = readFileSync('packages/client/index.html', 'utf8')
|
||||
|
||||
expect(html).toContain('rel="icon" type="image/png" href="/app-logo.png"')
|
||||
expect(html).toContain('rel="manifest" href="/manifest.webmanifest"')
|
||||
expect(html).toContain('rel="apple-touch-icon" href="/logo.png"')
|
||||
expect(html).toContain('rel="apple-touch-icon" href="/app-logo.png"')
|
||||
expect(html).toContain('name="apple-mobile-web-app-title" content="hermes-ui"')
|
||||
})
|
||||
|
||||
@@ -18,10 +19,21 @@ describe('PWA metadata', () => {
|
||||
expect(manifest.start_url).toBe('/#/hermes/chat')
|
||||
expect(manifest.icons).toEqual(expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
src: '/logo.png',
|
||||
src: '/app-logo.png',
|
||||
type: 'image/png',
|
||||
purpose: 'any maskable',
|
||||
purpose: 'any',
|
||||
}),
|
||||
]))
|
||||
})
|
||||
|
||||
it('ships matching application and legacy icon assets', () => {
|
||||
const logo = readFileSync('packages/client/public/app-logo.png')
|
||||
const legacyLogo = readFileSync('packages/client/public/logo.png')
|
||||
const favicon = readFileSync('packages/client/public/favicon.ico')
|
||||
expect(legacyLogo.equals(logo)).toBe(true)
|
||||
expect(logo.readUInt32BE(16)).toBe(512)
|
||||
expect(logo.readUInt32BE(20)).toBe(512)
|
||||
expect(favicon.readUInt16LE(2)).toBe(1)
|
||||
expect(favicon.subarray(22, 30)).toEqual(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]))
|
||||
})
|
||||
})
|
||||
|
||||
@@ -151,7 +151,7 @@ describe('SessionListItem', () => {
|
||||
})
|
||||
|
||||
const logo = wrapper.get('.session-item-agent-logo')
|
||||
expect(logo.attributes('src')).toBe('/logo.png')
|
||||
expect(logo.attributes('src')).toBe('/app-logo.png')
|
||||
expect(logo.attributes('alt')).toBe('Hermes')
|
||||
expect(wrapper.find('.session-item-agent-name').exists()).toBe(false)
|
||||
})
|
||||
@@ -172,7 +172,7 @@ describe('SessionListItem', () => {
|
||||
})
|
||||
|
||||
const logo = wrapper.get('.session-item-agent-logo')
|
||||
expect(logo.attributes('src')).toBe('/logo.png')
|
||||
expect(logo.attributes('src')).toBe('/app-logo.png')
|
||||
expect(logo.attributes('alt')).toBe('Hermes')
|
||||
expect(wrapper.find('.session-item-agent-name').exists()).toBe(false)
|
||||
})
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { expect, test } from '@playwright/test'
|
||||
|
||||
test('serves the application icon for the browser tab', async ({ page }) => {
|
||||
await page.goto('/')
|
||||
const icon = page.locator('link[rel="icon"]')
|
||||
await expect(icon).toHaveAttribute('href', '/app-logo.png')
|
||||
await expect(icon).toHaveAttribute('type', 'image/png')
|
||||
const response = await page.request.get('/app-logo.png')
|
||||
expect(response.ok()).toBe(true)
|
||||
expect(response.headers()['content-type']).toContain('image/png')
|
||||
expect((await response.body()).subarray(0, 8)).toEqual(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]))
|
||||
})
|
||||
Reference in New Issue
Block a user