1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-06-25 18:56:25 +02:00
blog/test/e2e/post.spec.ts

31 lines
981 B
TypeScript

import { test, expect } from '@playwright/test'
import siteConfig from '@config/blog.config'
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.'
)
})