This project contains automated API tests for the OpenWeather API using Playwright.
- Node.js (v14 or higher)
- NPM (Node Package Manager)
- OpenWeatherMap API key (Get it here)
- Clone this repository:
git clone <repository-url>
cd open-weather-map
- Install dependencies:
npm install
- Install Playwright browsers:
npx playwright install
Note: While
npm install
will install the Playwright framework, the last command is required to download the browser binaries that Playwright needs to run the tests.
Add your OpenWeatherMap API key to the .env
file in the root directory:
OPENWEATHER_API_KEY = your_api_key_here
Replace your_api_key_here
with your actual OpenWeatherMap API key.
Run the tests using one of the following npm scripts:
# Run all tests
npm test
# Run tests with HTML report
npm run test:report
# Show HTML report
npm run show-report
├── constants/
│ └── weather-conditions.ts # Weather conditions mapping
├── tests/
│ └── current-weather-data.spec.ts
│ └── five-days-weather-forecast.spec.ts # TBC
├── playwright.config.ts # Playwright configuration
├── package.json # Project dependencies
└── .env # Environment variables
Variable | Description | Required |
---|---|---|
OPENWEATHER_API_KEY |
Your OpenWeatherMap API key | Yes |