This is a simple Tic Tac Toe game built with React, where a player competes against an AI opponent. Below is the detailed documentation of instructions how to use repository and key test scenarios.
- Play against AI: The AI plays optimally, making the game challenging.
- Winning and Tie Detection: Displays the winner or a tie at the end of the game.
- Reset Functionality: Restart the game at any time.
- Testability: Elements are tagged with
data-testid
attributes for seamless Cypress testing.
- Clone the repository: https://github.com/viktorijabrun/React-app-tic-tac-toe-test.git
- Install dependencies:
npm install
- Open cypress:
npm run cypress-ui
or run cypress in terminal:npm run cypress-cli
The project includes End-to-End (E2E) tests written with Cypress to ensure reliable functionality.
Key Test Scenarios:
- Initial State: Verify the board loads with 9 empty cells.
- Player vs AI Gameplay:
- Player can make moves, and the AI responds dynamically.
- AI blocks winning moves and tries to win when possible.
- Winning Scenarios: Ensure the game detects winners correctly for both the player and AI.
- Tie Scenarios: Ensure the game detects a tie when the board is full without a winner.
- Reset Functionality: Verify the board and game state reset correctly.