Skip to content

DanielGilOrtiz/playwright-openweather

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automated API Testing for OpenWeather using Playwright

This project contains automated API tests for the OpenWeather API using Playwright.

Prerequisites

  • Node.js (v14 or higher)
  • NPM (Node Package Manager)
  • OpenWeatherMap API key (Get it here)

Installation

  1. Clone this repository:
git clone <repository-url>
cd open-weather-map
  1. Install dependencies:
npm install
  1. 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.

Configuration

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.

Running Tests

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

Project Structure

├── 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

Environment Variables

Variable Description Required
OPENWEATHER_API_KEY Your OpenWeatherMap API key Yes

Additional Resources

About

This project contains automated API tests for the OpenWeather API using Playwright.

Topics

Resources

License

Stars

Watchers

Forks