Skip to content

Commit 826a133

Browse files
committed
New test for blog categories click
- Add a new playwright test for blog categories click - Refactor by using same project than the other tests for blog.
1 parent 93db833 commit 826a133

File tree

9 files changed

+14
-1
lines changed

9 files changed

+14
-1
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/docs/playwright/blog/listing-search/posts/_metadata.yml renamed to tests/docs/playwright/blog/simple-blog/posts/_metadata.yml

File renamed without changes.

tests/docs/playwright/blog/listing-search/posts/post-with-code/image.jpg renamed to tests/docs/playwright/blog/simple-blog/posts/post-with-code/image.jpg

File renamed without changes.

tests/docs/playwright/blog/listing-search/posts/post-with-code/index.qmd renamed to tests/docs/playwright/blog/simple-blog/posts/post-with-code/index.qmd

File renamed without changes.

tests/docs/playwright/blog/listing-search/posts/welcome/index.qmd renamed to tests/docs/playwright/blog/simple-blog/posts/welcome/index.qmd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ This is the first post in a Quarto blog. Welcome!
99

1010
![](thumbnail.jpg)
1111

12+
## About image listing {#img-lst}
13+
1214
Since this post doesn't specify an explicit `image`, the first image in the post will be used in the listing page of posts.

tests/docs/playwright/blog/listing-search/posts/welcome/thumbnail.jpg renamed to tests/docs/playwright/blog/simple-blog/posts/welcome/thumbnail.jpg

File renamed without changes.

tests/integration/playwright/tests/blog-listing-search.spec.ts renamed to tests/integration/playwright/tests/blog-simple-blog.spec.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getUrl } from "../src/utils.js";
44

55
test('List.js is correctly patch to allow searching with lowercase and uppercase',
66
async ({ page }) => {
7-
await page.goto(getUrl('blog/listing-search/_site/'));
7+
await page.goto(getUrl('blog/simple-blog/_site/'));
88
await page.getByPlaceholder('Filter').click();
99
await page.getByPlaceholder('Filter').fill('Code');
1010
await page.getByPlaceholder('Filter').press('Enter');
@@ -21,3 +21,14 @@ test('List.js is correctly patch to allow searching with lowercase and uppercase
2121
await expect(page.getByRole('link', { name: 'Post With Code' })).toBeVisible();
2222
await expect(page.getByRole('link', { name: 'Welcome To My Blog' })).toBeHidden();
2323
});
24+
25+
test('Categories link are clickable', async ({ page }) => {
26+
await page.goto(getUrl('blog/simple-blog/_site/posts/welcome/'));
27+
await page.locator('div').filter({ hasText: /^news$/ }).click();
28+
await expect(page).toHaveURL(/_site\/index\.html#category=news$/);
29+
await expect(page.locator('div.category[data-category="news"]')).toHaveClass(/active/);
30+
await page.goto(getUrl('blog/simple-blog/_site/posts/welcome/#img-lst'));
31+
await page.locator('div').filter({ hasText: /^news$/ }).click();
32+
await expect(page).toHaveURL(/_site\/index\.html#category=news$/);
33+
await expect(page.locator('div.category[data-category="news"]')).toHaveClass(/active/);
34+
});

0 commit comments

Comments
 (0)