diff --git a/e2e-tests/games.spec.ts b/e2e-tests/games.spec.ts index d447f1e..3d17c2a 100644 --- a/e2e-tests/games.spec.ts +++ b/e2e-tests/games.spec.ts @@ -22,6 +22,16 @@ test.describe('Game Listing and Navigation', () => { await expect(gameCards.first().getByTestId('game-title')).toBeVisible(); await expect(gameCards.first().getByTestId('game-title')).not.toBeEmpty(); }); + + await test.step('Verify every game card has a rating', async () => { + const gameCards = page.getByTestId('game-card'); + const gameCardCount = await gameCards.count(); + await expect(gameCards.getByTestId('game-rating')).toHaveCount(gameCardCount); + + for (let index = 0; index < gameCardCount; index += 1) { + await expect(gameCards.nth(index).getByTestId('game-rating')).not.toBeEmpty(); + } + }); }); test('should navigate to correct game details page when clicking on a game', async ({ page }) => { diff --git a/src/components/GameCard.astro b/src/components/GameCard.astro index da71b54..17aa824 100644 --- a/src/components/GameCard.astro +++ b/src/components/GameCard.astro @@ -1,6 +1,7 @@ --- import type { Game } from '../types/game'; import Tag from './Tag.astro'; +import StarRating from './StarRating.astro'; import ArrowRight from '../assets/icons/arrow-right.svg'; interface Props { @@ -37,6 +38,11 @@ const { game } = Astro.props; )} + {game.starRating === null + ?
No rating yet
+ :{game.description}