1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-11-23 02:10:01 +01:00
blog/test/e2e/index.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

36 lines
1.1 KiB
TypeScript

import config from '@config/blog.config'
import { expect, test } from '@playwright/test'
test.beforeEach(async ({ page }) => {
await page.goto('/')
})
test('meta is correct', async ({ page }) => {
await expect(page).toHaveTitle(RegExp(`${config.siteDescription}`, 'g'))
await expect(page.locator('meta[property="og:title"]')).toHaveAttribute(
'content',
RegExp(`${config.siteDescription}`, 'g')
)
await expect(page.locator('link[rel="canonical"]')).toHaveAttribute(
'href',
config.siteUrl
)
await expect(page.locator('meta[property="og:url"]')).toHaveAttribute(
'content',
config.siteUrl
)
await expect(page.locator('meta[name="description"]')).toHaveAttribute(
'content',
config.siteDescription
)
})
test('has articles & photos heading', async ({ page }) => {
// Click the get started link.
// await page.getByRole('link', { name: 'Get started' }).click()
// Expects page to have a heading with the name of Articles & Photos.
await expect(page.getByRole('heading', { name: 'Articles' })).toBeVisible()
await expect(page.getByRole('heading', { name: 'Photos' })).toBeVisible()
})