test: improvement of icon and manifest

This commit is contained in:
oe.kazuma 2022-10-26 15:47:46 +09:00
parent 9cc2c5ef9c
commit e33fbfaff1
5 changed files with 10 additions and 7 deletions

View File

@ -364,7 +364,7 @@ additionalLinkTags={[
},
{
rel: 'manifest',
href: '/manifest.json'
href: 'https://www.test.ie/manifest.json'
}
]}
```
@ -374,7 +374,7 @@ it will result in this being rendered:
```html
<link rel="icon" href="https://www.test.ie/favicon.ico" />
<link rel="apple-touch-icon" href="https://www.test.ie/touch-icon-ipad.jpg" sizes="76x76" />
<link rel="manifest" href="/manifest.json" />
<link rel="manifest" href="https://www.test.ie/manifest.json" />
```
## Open Graph

View File

@ -38,7 +38,7 @@
additionalLinkTags={[
{
rel: 'icon',
href: 'https://www.test.ie/favicon.ico'
href: '/favicon.ico'
},
{
rel: 'apple-touch-icon',
@ -57,7 +57,7 @@
},
{
rel: 'manifest',
href: '/manifest.json'
href: 'https://www.test.ie/manifest.json'
}
]}
/>

BIN
static/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

3
static/robots.txt Normal file
View File

@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

View File

@ -1,6 +1,6 @@
import { test, expect } from '@playwright/test';
test('Normal SEO loads correctly', async ({ page }) => {
test('Normal SEO loads correctly', async ({ page, baseURL }) => {
await page.goto('/');
await expect(page).toHaveTitle('Normal | Svelte Meta Tags');
await expect(page.locator('h1')).toContainText('Normal SEO');
@ -41,7 +41,7 @@ test('Normal SEO loads correctly', async ({ page }) => {
'https://www.example.ie/twitter-image.jpg'
);
await expect(page.locator('head meta[name="twitter:image:alt"]')).toHaveAttribute('content', 'Twitter image alt');
await expect(page.locator('head link[rel="icon"]')).toHaveAttribute('href', 'https://www.test.ie/favicon.ico');
await expect(page.locator('head link[rel="icon"]')).toHaveAttribute('href', `${baseURL}/favicon.ico`);
const appleTouchIcon = page.locator('head link[rel="apple-touch-icon"]');
await expect(appleTouchIcon).toHaveCount(2);
await expect(appleTouchIcon.nth(0)).toHaveAttribute('sizes', '76x76');
@ -49,5 +49,5 @@ test('Normal SEO loads correctly', async ({ page }) => {
const maskIcon = page.locator('head link[rel="mask-icon"]');
await expect(maskIcon).toHaveAttribute('href', 'https://www.test.ie/safari-pinned-tab.svg');
await expect(maskIcon).toHaveAttribute('color', '#193860');
await expect(page.locator('head link[rel="manifest"]')).toHaveAttribute('href', '/manifest.json');
await expect(page.locator('head link[rel="manifest"]')).toHaveAttribute('href', 'https://www.test.ie/manifest.json');
});