1
0
mirror of https://github.com/kremalicious/blog.git synced 2025-02-14 21:10:25 +01:00
blog/test/e2e/post.spec.ts
Matthias Kretschmann c123dd9d68
Switch to astro-redirect-from (#830)
* astro-redirect-from prototype

* move out plugin

* switch to astro-redirect-from

* fixes

* new post: astro-redirect-from

* fix dependency

* test fixes

* downgrade and lock astro

* until fix for https://github.com/withastro/astro/issues/8649 has been released

* mention debug json file

* fix e2e test
2023-09-23 21:32:18 +01:00

31 lines
979 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.'
)
})