#!/usr/bin/env ruby

# Please, when you update this file, update also http://wiki.openqa.org/display/WTR/Example+Test+Case

#-------------------------------------------------------------#
# Demo test for the Watir controller.
#
# Purpose: to demonstrate the following Watir functionality:
#   * entering text into a text field,
#   * clicking a button,
#   * checking to see if a page contains text.
# Test will search Google for the "pickaxe" Ruby book.
#-------------------------------------------------------------#

# irb

require 'rubygems'

# the Watir controller
require "watir-webdriver"
include Watir

# set a variable
test_site = "http://intforms.wildwoodclient.com"

b = Watir::Browser.new :firefox

# print some comments
puts "Beginning of test: Integreview Forms."

puts " Step 1: go to the test site: " + test_site
b.goto test_site

puts " Step 2: enter 'support@wildwoodinteractive.com' in the email field."
b.text_field(:id, "email").set 'support@wildwoodinteractive.com' # "email" is the name of the username field on this form

puts " Step 2: enter 'wild3355' in the password field."
b.text_field(:name, "password").set 'wild3355' # "password" is the name of the password field on this form

puts " Step 3: click the 'Submit' button."
if b.button(:id, "submit1").exists?
	b.form(:name, "login").submit
	# b.button(:name => "submit1").fire_event "onClick"
	# b.button(:value => 'Submit').click
	# b.send_keys :enter
	puts " Button exists"
	# b.button(:id, "submit1").click # "Submit" is the text on the Submit button
else
	puts "Button doesn't exist"
end

puts "End of test: Integreview Forms Login."
