Sha256: f21830ca076cecc1170aae964b2ad8d3f623db9f37d4adbae9ffcc697f785db4

Contents?: true

Size: 1.62 KB

Versions: 1

Compression:

Stored size: 1.62 KB

Contents

module Taza
  # Flows provide a way to write and manage common actions on a site.
  # For instance, on an e-commerce site you may have multiple tests where a user is supposed to create a 
  # new account and add a product to the shopping bag. In this case you could have two flows. create_an_account 
  # and add_product_to_bag.
  #
  # Here's how you would get this started where your site is called Widgets of the Future:
  #   $ ./script/generate flow create_an_account widgets_of_the_future
  #   $ ./script/generate flow add_product_to_bag widgets_of_the_future
  #
  #   This will generate flows for you in lib/sites/widgets_of_the_future/flows/
  #
  #   From here you can create the logic needed to perform these flows without ever referencing a browser object:
  #
  #   class CreateAnAccount < Taza::Flow
  #     alias :widgets_of_the_future :site
  #
  #     def run(params={})
  #       widgets_of_the_future.home_page.create_an_account_link.click
  #       widgets_of_the_future.create_an_account_page do |cap|
  #         cap.email.set params[:email]
  #         cap.password.set params[:password]
  #         cap.submit.click
  #       end
  #     end
  #   end
  #
  #
  #   Then inside a spec or test you could run this flow like:
  #
  #   describe "Widgets of the Future" do
  #     it "should do widgety things so that we can make more monies" do
  #       WidgetsOfTheFuture.new do |w|
  #         w.flow :create_an_account, :email => "i.am@the.widget.store.com", :password => "secret"
  #       end
  #     end
  #   end
  class Flow
    attr_reader :site

    def initialize(site_instance)
      @site = site_instance
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
taza-0.8.0 lib/taza/flow.rb