|
4 | 4 | */ |
5 | 5 | import { test, expect } from '@playwright/test' |
6 | 6 | import { TEST_URLS } from '../../fixtures/test-data' |
| 7 | +import { setupConsoleErrorChecker } from '@test/e2e/helpers/console-errors' |
7 | 8 |
|
8 | 9 | test.describe('Case Studies List Page', () => { |
9 | 10 | test.beforeEach(async ({ page }) => { |
10 | 11 | await page.goto(TEST_URLS.caseStudies) |
11 | 12 | }) |
12 | 13 |
|
13 | | - test.skip('@wip page loads with correct title', async ({ page }) => { |
14 | | - // Expected: Case studies page should have descriptive title |
15 | | - // Actual: Unknown - needs testing |
| 14 | + test('@ready page loads with correct title', async ({ page }) => { |
16 | 15 | await expect(page).toHaveTitle(/Case Studies/) |
17 | 16 | }) |
18 | 17 |
|
19 | | - test.skip('@wip hero section displays', async ({ page }) => { |
20 | | - // Expected: Should have hero section with heading |
21 | | - // Actual: Unknown - needs testing |
| 18 | + test('@ready hero section displays', async ({ page }) => { |
22 | 19 | await expect(page.locator('h1')).toBeVisible() |
| 20 | + await expect(page.locator('h1')).toContainText(/Case Studies/) |
23 | 21 | }) |
24 | 22 |
|
25 | | - test.skip('@wip case studies grid displays', async ({ page }) => { |
26 | | - // Expected: Should show grid of case study cards |
27 | | - // Actual: Unknown - needs testing |
28 | | - const caseStudyCards = page.locator('article') |
29 | | - await expect(caseStudyCards.first()).toBeVisible() |
| 23 | + test('@ready case studies list displays', async ({ page }) => { |
| 24 | + const caseStudyList = page.locator('.case-study-item, article') |
| 25 | + await expect(caseStudyList.first()).toBeVisible() |
| 26 | + }) |
| 27 | + |
| 28 | + test('@ready case study cards have required elements', async ({ page }) => { |
| 29 | + const caseStudyList = page.locator('.case-study-item, article') |
| 30 | + const firstCard = caseStudyList.first() |
| 31 | + const heading = firstCard.locator('h2, h3').first() |
| 32 | + await expect(heading).toBeVisible() |
| 33 | + await expect(firstCard.locator('a').first()).toBeVisible() |
30 | 34 | }) |
31 | 35 |
|
32 | | - test.skip('@wip case study cards have required elements', async ({ page }) => { |
33 | | - // Expected: Each card should have image, title, description |
34 | | - // Actual: Unknown - needs testing |
35 | | - const firstCard = page.locator('article').first() |
36 | | - await expect(firstCard.locator('img')).toBeVisible() |
37 | | - await expect(firstCard.locator('h2, h3')).toBeVisible() |
| 36 | + test('@ready case study links are functional', async ({ page }) => { |
| 37 | + const firstLink = page.locator('.case-study-item a, article a').first() |
| 38 | + await expect(firstLink).toHaveAttribute('href', /\/case-studies\//) |
38 | 39 | }) |
39 | 40 |
|
40 | | - test.skip('@wip case study links are functional', async ({ page }) => { |
41 | | - // Expected: Clicking case study should navigate to detail page |
42 | | - // Actual: Unknown - needs testing |
43 | | - const firstLink = page.locator('article a').first() |
44 | | - await expect(firstLink).toHaveAttribute('href', /.+/) |
| 41 | + test('@ready clicking case study navigates to detail page', async ({ page }) => { |
| 42 | + const firstLink = page.locator('.case-study-item a, article a').first() |
| 43 | + await firstLink.click() |
| 44 | + await expect(page).toHaveURL(/\/case-studies\/.+/) |
45 | 45 | }) |
46 | 46 |
|
47 | | - test.skip('@wip industry/tag filtering works', async ({ page }) => { |
48 | | - // Expected: If filters exist, they should work |
49 | | - // Actual: Unknown - needs testing |
50 | | - // Check if filter UI exists |
| 47 | + test('@ready page is responsive on mobile', async ({ page }) => { |
| 48 | + await page.setViewportSize({ width: 375, height: 667 }) |
| 49 | + await expect(page.locator('h1')).toBeVisible() |
| 50 | + const caseStudyCards = page.locator('.case-study-item, article') |
| 51 | + await expect(caseStudyCards.first()).toBeVisible() |
51 | 52 | }) |
52 | 53 |
|
53 | | - test.skip('@wip page has no console errors', async ({ page }) => { |
54 | | - // Expected: No console errors on page load |
55 | | - // Actual: Unknown - needs testing |
56 | | - const errors: string[] = [] |
57 | | - page.on('console', (msg) => { |
58 | | - if (msg.type() === 'error') errors.push(msg.text()) |
59 | | - }) |
| 54 | + test('@ready page has no console errors', async ({ page }) => { |
| 55 | + const errorChecker = setupConsoleErrorChecker(page) |
60 | 56 | await page.reload() |
61 | | - expect(errors).toHaveLength(0) |
| 57 | + expect(errorChecker.getFilteredErrors()).toHaveLength(0) |
62 | 58 | }) |
63 | 59 | }) |
0 commit comments