/** * BDD E2E Test: Drivers List Page * * Tests the main drivers page that displays: * - List of all registered drivers * - Driver search/filter functionality * - Driver sorting options * - Pagination or infinite scroll * - Driver cards with basic info (name, avatar, rating, rank) * * Focus: Final user outcomes - what the driver sees and can verify */ import { test, expect } from '@playwright/test'; test.describe('Drivers List Page', () => { test.beforeEach(async ({ page }) => { // TODO: Implement navigation to drivers page // - Navigate to /drivers page // - Verify page loads successfully }); test('User sees a list of registered drivers on the drivers page', async ({ page }) => { // TODO: Implement test // Scenario: User views the drivers list // Given I am on the "Drivers" page // Then I should see a list of drivers // And each driver card should display the driver's name // And each driver card should display the driver's avatar // And each driver card should display the driver's current rating // And each driver card should display the driver's current rank }); test('User can click on a driver card to view their profile', async ({ page }) => { // TODO: Implement test // Scenario: User navigates to a driver's profile // Given I am on the "Drivers" page // When I click on a driver card // Then I should be redirected to the driver's profile page // And the URL should contain the driver's ID }); test('User can search for drivers by name', async ({ page }) => { // TODO: Implement test // Scenario: User searches for a specific driver // Given I am on the "Drivers" page // When I enter "John" in the search field // Then I should see drivers whose names contain "John" // And I should not see drivers whose names do not contain "John" }); test('User can filter drivers by rating range', async ({ page }) => { // TODO: Implement test // Scenario: User filters drivers by rating // Given I am on the "Drivers" page // When I set the rating filter to show drivers with rating above 4.0 // Then I should only see drivers with rating >= 4.0 // And drivers with rating < 4.0 should not be visible }); test('User can sort drivers by different criteria', async ({ page }) => { // TODO: Implement test // Scenario: User sorts drivers by different attributes // Given I am on the "Drivers" page // When I select "Sort by Rating (High to Low)" // Then the drivers should be displayed in descending order by rating // When I select "Sort by Name (A-Z)" // Then the drivers should be displayed in alphabetical order by name }); test('User sees pagination controls when there are many drivers', async ({ page }) => { // TODO: Implement test // Scenario: User navigates through multiple pages of drivers // Given there are more than 20 drivers registered // And I am on the "Drivers" page // Then I should see pagination controls // And I should see the current page number // And I should be able to navigate to the next page // And I should see different drivers on the next page }); test('User sees empty state when no drivers match the search', async ({ page }) => { // TODO: Implement test // Scenario: User searches for a non-existent driver // Given I am on the "Drivers" page // When I search for "NonExistentDriver123" // Then I should see an empty state message // And I should see a message indicating no drivers were found }); test('User sees empty state when no drivers exist in the system', async ({ page }) => { // TODO: Implement test // Scenario: System has no registered drivers // Given the system has no registered drivers // And I am on the "Drivers" page // Then I should see an empty state message // And I should see a message indicating no drivers are registered }); test('User can clear search and filters to see all drivers again', async ({ page }) => { // TODO: Implement test // Scenario: User clears search and filters // Given I am on the "Drivers" page // And I have applied a search filter // When I click the "Clear Filters" button // Then I should see all drivers again // And the search field should be empty }); test('User sees driver count information', async ({ page }) => { // TODO: Implement test // Scenario: User views driver count // Given I am on the "Drivers" page // Then I should see the total number of drivers // And I should see the number of drivers currently displayed }); test('User sees driver cards with consistent information', async ({ page }) => { // TODO: Implement test // Scenario: User verifies driver card consistency // Given I am on the "Drivers" page // Then all driver cards should have the same structure // And each card should show name, avatar, rating, and rank // And all cards should be clickable to navigate to profile }); });