Skip to content

Instantly share code, notes, and snippets.

@tgpfeiffer
Created March 19, 2013 17:17
Show Gist options
  • Save tgpfeiffer/5198092 to your computer and use it in GitHub Desktop.
Save tgpfeiffer/5198092 to your computer and use it in GitHub Desktop.
Lettuce and Lift
Feature: Basic Appearance
Scenario: Loading Front Page
Given I go to "http://localhost:8080"
Then I should see "WorldWide Conferencing"
Scenario: Login fails
Given I go to "http://localhost:8080/user_mgt/login"
When I fill in "username" with "me@privacy.net"
And I fill in "password" with "xyz"
And I press "Anmelden"
Then I should see "Unable to login with" within 3 seconds
Scenario: Logout fails
Given I go to "http://localhost:8080/user_mgt/logout"
Then I should see "Sie müssen angemeldet sein"
Scenario: Login succeeds
Given I go to "http://localhost:8080/user_mgt/login"
When I fill in "username" with "me@privacy.net"
And I fill in "password" with "myPassword!"
And I press "Anmelden"
Then I should not see "Unable to login with"
Scenario: Logout succeeds
Given I go to "http://localhost:8080/user_mgt/logout"
Then I should not see "Sie müssen angemeldet sein"
distribute==0.6.10
fuzzywuzzy==0.1
lettuce==0.2.9
lettuce-webdriver==0.2
nose==1.2.1
selenium==2.25.0
sure==1.0.6
wsgiref==0.1.2
from selenium import webdriver
from selenium.webdriver.support.select import Select
from lettuce import before, world, step
import lettuce_webdriver.webdriver
from lettuce_webdriver.util import find_field, AssertContextManager
@before.all
def setup_browser():
world.browser = webdriver.Firefox()
@step('I do check "(.*?)"$')
def select_single_item(step, check_name):
with AssertContextManager(step):
# First, locate the select
check_box = find_field(world.browser, 'checkbox', check_name)
if not check_box.is_selected():
check_box.click()
@step('I do select "(.*?)" from "(.*?)"$')
def select_single_item(step, option_name, select_name):
with AssertContextManager(step):
# First, locate the select
select_box = find_field(world.browser, 'select', select_name)
se = Select(select_box)
se.select_by_visible_text(option_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment