Web application providing simplified preview of current and upcoming weather in user's location.
- An openweathermap API key
- Node.js
- Docker & docker compose
- Python3.6^ for Robot Framework
- Clone repository to desired directory
git clone https://github.com/adamnapieralski/weatherapp.git cd weatherapp
- Set environmental variables to desired values (in
.envande2e/.env) - Run in the root application directory:
docker-compose up
which will set up needed backend and frontend docker containers and connect them to properly run full application.
- Install required node modules
cd backend && npm install && cd ..
cd frontend && npm install && cd ..
Application run with docker-compose is ready for development with hot reload functionality.
- In backend/ run
npm startornpm run dev(for nodemon start with hot reload) - In frontend/ run
npm start
When both back and front servers are started, visit [address]:[port] defined in .env. However, geolocation functionality requires the application run without SSL to be accessed by localhost:[port], so preferably use and visit: http://localhost:8000.
Applications e2e and integration tests are contained in e2e/ directory.
Cypress automated tests
- To automatically run cypress tests using docker, in
e2e/run:
docker-compose up --exit-code-from cypress
This will run all cypress tests headlessly and view short report in console.
(To log only cypress output, uncomment logging related lines in e2e/docker-compose.yml)
(TODO: add custom reporter to generate pretty reports (e.g. allure))
-
To install required cypress testing packages run
npm installine2e/. -
Having app already running, you can run cypress headlessly in console with
npm run cy:runor open testing GUI withnpm run cy:open.
Robot-framework tests
Robot framework tests can be run with docker-compose up in e2e/robot-framework. This way [wiremock] is utilized as mock OpenWeatherMap API, providing deterministic responses data for tests.
- In e2e/robot-framework directory run:
pip install -r requirements.txt
It is advisable to use dedicated python virtual environment - e.g. virtualenv or conda.
-
Provide needed webdriver - e.g. with
webdrivermanager chrome firefox -
Start wiremock docker container (from
e2e/robot-framework/wiremock) and frontend webpack server.
Run tests with
robot tests/
(TODO [Current Robot Framework tests are just template and are not correctly runnable] - Write improved test cases and add keywords, handle env vars, fix docker-compose execution).
- current weather displayed,
- TODO: add more detailed info: temp., wind, etc.,
- geolocation based weather data (if access is denied - target location from env vars is used),
- TODO: do not ask for location permission before page load - bad UX,
- TODO: add possibility to input & select city next to toggle to use geolocation instead,
- location (
city [country]format) displayed, - forecast data for next 24 hrs (in 3 hrs intervals) with datetime displayed.
- mrako (Marko Klemetti)
- adamnapieralski (Adam Napieralski)