Exercise 1: Google Maps
- In MovieDB, add a new field “Principal filming location”.
- In a movie’s show view, geocode that location and show a Google map centered around it
- Now write a Cucumber feature that tests that the map shows the correct location.
Google Maps iframe
fetch() or AJAX.
- To implement this exercise you will need two external services: One to transform an address string to geographical coordinates ("geocoding") and one to display a map centered around given coordinates.
- Google Maps offers both geocoding and map display APIs. If you want to use Google Maps, you need to sign up for an API key.
- A free alternative for educational use is using
OpenStreetMap Tile Provider
. You can geocode an address with the
(it supports CORS requests).
- When using Unpoly,
<script> tags in page fragments will only be executed with
up.fragment.config.runScripts = true. As an alternative you may put the
<script> tag that loads mapping libraries in your application layout (not ideal, discuss with your mentor why) or load it on demand as described in a separate card.
- Your test can use
Exercise 2: Gender API
- In MovieDB, add a field "gender" to the
- For the purpose of this exercise, the field is an enum with the values
to implement the enum.
- In the actor form automatically suggest a gender as the user types a name
- Also read this card for an issue you might encounter.
- The user should be able to override the suggestion.
Write a Cucumber feature that tests the functionality above. Use two different techniques to write the test:
- Actually talk to the Gender API during tests.
- It should have the same API as your original Gender API client.
- The fixed list of names can be part of your fake implementation. If it helps your test, your fake implementation might also expose an additional API to change the list of names.
Talk with your mentor about the pros and cons of each approach.