Commit 7fe206a9 by JonahStanley

Sped up some Lettuce Tests

parent 62b74008
...@@ -13,9 +13,7 @@ Feature: Homepage for web users ...@@ -13,9 +13,7 @@ Feature: Homepage for web users
Scenario Outline: User can see main parts of the page Scenario Outline: User can see main parts of the page
Given I visit the homepage Given I visit the homepage
Then I should see a link with the id "<id>" called "<Link>" Then I should see the following links and ids
Examples:
| id | Link | | id | Link |
| about | About | | about | About |
| jobs | Jobs | | jobs | Jobs |
...@@ -27,9 +25,7 @@ Feature: Homepage for web users ...@@ -27,9 +25,7 @@ Feature: Homepage for web users
# TODO: test according to domain or policy # TODO: test according to domain or policy
Scenario: User can see the partner institutions Scenario: User can see the partner institutions
Given I visit the homepage Given I visit the homepage
Then I should see "<Partner>" in the Partners section Then I should see the following Partners in the Partners section
Examples:
| Partner | | Partner |
| MITx | | MITx |
| HarvardX | | HarvardX |
......
...@@ -2,11 +2,22 @@ ...@@ -2,11 +2,22 @@
#pylint: disable=W0621 #pylint: disable=W0621
from lettuce import world, step from lettuce import world, step
from nose.tools import assert_in from nose.tools import assert_in, assert_equals
@step('I should see "([^"]*)" in the Partners section$') @step(u'I should see the following Partners in the Partners section')
def i_should_see_partner(step, partner): def i_should_see_partner(step):
partners = world.browser.find_by_css(".partner .name span") partners = world.browser.find_by_css(".partner .name span")
names = set(span.text for span in partners) names = set(span.text for span in partners)
assert_in(partner, names) for partner in step.hashes:
assert_in(partner['Partner'], names)
@step(u'I should see the following links and ids')
def should_see_a_link_called(step):
for link_id_pair in step.hashes:
link_id = link_id_pair['id']
text = link_id_pair['Link']
link = world.browser.find_by_id(link_id)
assert len(link) > 0
assert_equals(link.text, text)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment