1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-11-22 09:56:51 +01:00
blog/test/e2e/post.spec.ts
Matthias Kretschmann 05ad0470c2
migrate to biome (#944)
* migrate to biome

* cleanup

* fix

* use tsx

* script tweaks

* fix test runs

* path tweaks
2024-07-27 21:15:05 +01:00

31 lines
981 B
TypeScript

import siteConfig from '@config/blog.config'
import { expect, test } from '@playwright/test'
const postSlug = 'gatsby-redirect-from'
const canonical = `${siteConfig.siteUrl}/${postSlug}/`
test.beforeEach(async ({ page }) => {
await page.goto(`/${postSlug}/`)
})
test('meta is correct', async ({ page }) => {
await expect(page).toHaveTitle(/Redirect Plugin for Markdown Pages in Gatsby/)
await expect(page.locator('meta[property="og:title"]')).toHaveAttribute(
'content',
/Redirect Plugin for Markdown Pages in Gatsby/
)
await expect(page.locator('link[rel="canonical"]')).toHaveAttribute(
'href',
canonical
)
await expect(page.locator('meta[property="og:url"]')).toHaveAttribute(
'content',
canonical
)
await expect(page.locator('meta[name="description"]')).toHaveAttribute(
'content',
'Plugin for Gatsby to create redirects based on a list in your Markdown frontmatter, mimicking the behavior of jekyll-redirect-from.'
)
})