Chrysoblog/tests/post.spec.ts

20 lines
752 B
TypeScript

import { expect, test } from '@playwright/test';
test('Navigate to blog post', async ({ page }) => {
await page.goto('/post');
await page.getByText('The Perfect Math Class').click();
await expect(page).toHaveURL("/post/the-perfect-math-class/");
});
test('Navigate to page 2', async ({ page }) => {
await page.goto('/post');
await page.getByRole('link', { name: 'Next Page' }).click();
await expect(page).toHaveURL("/page/2/");
await page.getByRole('link', { name: 'Prev Page' }).click();
await expect(page).toHaveURL("/post/");
await page.getByRole('link', { name: 'Last Page' }).click();
await expect(page).toHaveURL("/page/2/");
await page.getByRole('link', { name: 'First Page' }).click();
await expect(page).toHaveURL("/post/");
});