Giter Club home page Giter Club logo

weather-api's Introduction

Weather API Test in Playwright

API Test

This repository is an API Test in NodeJS and TypeScript using Playwright

Installation

  1. Clone this repository.
  2. Ensure your machine has nodeJS and npm installed. This was tested with node version v18.17.1 and npm version 9.6.7
  3. Run npm install to install all packages

Run Tests

Pre-requisites

Create a .env file in the project root folder (same level as package.json) to contain the api key. See env. sample for the format

Tests

All test cases

To run all the test cases:

npm test

Individual test case

For AC2:

npm test -- -g @AC2

For AC3:

npm test -- -g @AC3

Generating Reports

In List format

The test would output a test result summary in list format as such:

> [email protected] test
> npx playwright test


Running 2 tests using 2 workers

  ✓  1 weatherbit.spec.ts:41:7 › Get Weather Data › @AC3: As a frequent flyer, I want to programmatically find the current warmest capital city in Australia (776ms)
  ✓  2 weatherbit.spec.ts:9:7 › Get Weather Data › @AC2: As a frequent flyer, I want to get current weather data for the city at Latitude: -33.865143, Longitude: 151.209900 (773ms)
In Sydney, the apparent temperature is 16.7 degrees with scattered clouds.
The warmest capital city in Australia is Darwin with an apparent temperature of 29.6 degrees
While the coldest capital city in Australia is Canberra with an apparent temperature of 10.6 degrees

  2 passed (972ms)

In HTML format

To open the HTML report, run npx playwright show-report and this will launch a browser

On Test Failure:

When any of the test cases fail, it would also automatically launch the HTML reporter and provide traces of the failure for better understanding of the error.

Contributing

This repo has linting (eslint) and code formatting (prettier) rules to ensure code standards are enforced. A pre-commit hook will run and execute these checks and would throw code warnings or errors.

weather-api's People

Contributors

arcmorales avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.