Git Product home page Git Product logo

lettuce_webdriver's Introduction

Lettuce steps for Web Testing with Selenium 2

lettuce_webdriver provides a set of steps for use with the Cucumber BDD Python port lettuce using the selenium 2.8 or higher Python package.

The included matchers and syntax is inspired heavily by cucumber_watir.

Requirements

Setting Up lettuce_webdriver

In your lettuce terrain.py file, add an include statement for lettuce to learn about the additional step definitions provided by lettuce_webdriver and a setup that creates the selenium browser desired:

from lettuce import before, world
from selenium import webdriver
import lettuce_webdriver.webdriver

@before.all
def setup_browser():
    world.browser = webdriver.Firefox()

Usage

lettuce stories are written in the standard Cucumber style of gherkin. For example:

Scenario: Filling out the signup form
  Given I go to "http://foo.com/signup"
   When I fill in "Name" with "Foo Bar"
    And I fill in "Email" with "[email protected]"
    And I fill in "City" with "San Jose"
    And I fill in "State" with "CA"
    And I uncheck "Send me spam!"
    And I select "Male" from "Gender"
    And I press "Sign up"
   Then I should see "Thank you for signing up!"

Included Matchers

The following lettuce step matchers are included in this package and can be used with Given/When/Then/And as desired.

# urls
I visit "http://google.com/"
I go to "http://google.com/"

# links
I click "Next page"
I should see a link with the url "http://foobar.com/"
I should see a link to "Google" with the url "http://google.com/"
I should see a link that contains the text "Foobar" and the url "http://foobar.com/"

# general
I should see "Page Content"
I see "Page Content"
I should see "Page Content" within 4 seconds
I should not see "Foobar"
I should be at "http://foobar.com/"
I should see an element with id of "http://bar.com/"
I should see an element with id of "http://bar.com/" within 2 seconds
I should not see an element with id of "http://bar.com/"
The element with id of "cs_PageModeContainer" contains "Read"
The element with id of "cs_BigDiv" does not contain "Write"

# browser
The browser's URL should be "http://bar.com/"
The browser's URL should contain "foo.com"
The browser's URL should not contain "bar.com"

# forms
I should see a form that goes to "http://bar.com/submit.html"
I press "Submit"

# checkboxes
I check "I have a car"
I uncheck "I have a bus"
The "I have a car" checkbox should be checked
The "I have a bus" checkbox should not be checked

# select
I select "Volvo" from "Car Choices"
I select the following from "Car Choices":
    """
    Volvo
    Saab
    """
The "Volvo" option from "Car Choices" should be selected
The following options from "Car Choices" should be selected:
    """
    Volvo
    Saab
    """

# radio buttons
I choose "Foobar"
The "Foobar" option should be chosen
The "Bar" option should not be chosen

# text entry fields (text, textarea, password)
I fill in "Username" with "Smith"

Support

lettuce_webdriver is considered feature-complete as the project owner (Ben Bangert) has no additional functionality or development beyond bug fixes planned. Bugs can be filed on github, should be accompanied by a test case to retain current code coverage, and should be in a Pull request when ready to be accepted into the lettuce_webdriver code-base.

lettuce_webdriver's People

Contributors

arnihermann avatar bbangert avatar dwt avatar elpargo avatar npilon avatar r1chardj0n3s avatar rbu avatar z4y4ts avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.