Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions e2e-tests/games.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ 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 game cards display their rating', async () => {
const gameCards = page.getByTestId('game-card');
await expect(gameCards.first().getByTestId('game-rating')).toBeVisible();
});
});

test('should navigate to correct game details page when clicking on a game', async ({ page }) => {
Expand Down
11 changes: 11 additions & 0 deletions src/components/GameCard.astro
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -37,6 +38,16 @@ const { game } = Astro.props;
</div>
)}

<div class="mb-3">
{game.starRating === null ? (
<span class="bg-blue-500/20 text-slate-300 text-sm px-3 py-1 rounded-full" data-testid="game-rating">
No rating yet
</span>
) : (
<StarRating rating={game.starRating} />
)}
</div>

<p class="text-slate-400 mb-4 text-sm line-clamp-2" data-testid="game-description">{game.description}</p>

<div class="mt-4 text-sm text-blue-400 font-medium flex items-center">
Expand Down
Loading