Source

FluidInYourEar / fluidocalypse / tests / twill_tests / functional_tests.twill

# Functional Tests for Fluid In Your Ear written with Twill
#
# These are pretty crude at the moment, but form a useful
# foundation to begin testing the core functionality of the
# application

# ############################################################
# test calls to root URL goes to genre search page
# ############################################################

# test without trailing slash
go http://127.0.0.1:8000
code 200
url http://127.0.0.1:8000/search/genre

# test with trailing slash
go http://127.0.0.1:8000
code 200
url http://127.0.0.1:8000/search/genre

# ############################################################
# test calls to genre search page
# ############################################################

# test with trailing slash
go http://127.0.0.1:8000/search/genre/
code 200

# test without trailing slash
go http://127.0.0.1:8000/search/genre
code 200

# check form - crude tests
find '<form action="" method="post" name="search_form">'
find '<select name="genre">'
find '<option value="grindcore">Grindcore</option>'
find '</select>'
find '<input type="submit" value="Show genre" />'

# test form
formvalue search_form genre grindcore
submit
code 200
url http://127.0.0.1:8000/genre/grindcore

# ############################################################
# test calls to genre pages
# ############################################################

# test missing genre
go http://127.0.0.1:8000/genre/progressive_vegetarian_grindcore/
code 404

# test with trailing slash
go http://127.0.0.1:8000/genre/jazz/
code 200

# test without trailing slash
go http://127.0.0.1:8000/genre/jazz
code 200

# check page contents
find '<h2 class="heading">Jazz</h2>'
find '<div id="related_bands">'
find '<li><a href="/band/Frank%20Zappa">Frank Zappa</a></li>'

find '<div id="related_genres">'
find '<h3 class="heading">Related Genres</h3>'
find '<span style="font-size: [.0-9]+em; white-space: nowrap; padding: [.0-9]+em;"><a href="/genre/avant_garde_music">Avant-garde music</a></span>'
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.