You can learn more.....
require 'watir'
require 'test/unit'
require 'script_runner'
include Watir
class YatraFlights < Test::Unit::TestCase
script_runner = ScriptRunner.new("C:","C:","Yatra_Flights","",4,4,false)
def test_01_Homepage
$ie = IE.new
$ie.goto("http://www.yatra.com/")
$ie.maximize()
$ie.bring_to_front()
$ie.maximize()
assert($ie.text_field(:name ,"ddate").exists?)
assert($ie.link(:text,"Hotels").exists?)
#~ assert($ie.contains_text("Book your Trip!"))
end
def test_02_Flight_Book_Page
$ie.maximize()
x=(Date.today+(25)).strftime('%d/%m/%Y')
y=(Date.today+(28)).strftime('%d/%m/%Y')
$ie.radio(:name,"type","O").set
$ie.selectBox( :name ,"origin").select("Bangalore")
$ie.selectBox( :name ,"destination").select("Mumbai")
$ie.text_field(:name,'ddate').value=x
$ie.button(:id,'flightsonlybtn').click
$ie.maximize()
$ie.bring_to_front()
$ie.maximize()
#~ assert($ie.image(:src,/selectDepart.gif/).exists?)
assert($ie.contains_text("Selection Summary"))
assert($ie.image(:src,/selectDepart.gif/).exists?)
end
def test_03_Flight_Booking_Results_Page
#~ $ie.image(:src,/selectDepart.gif/).click
$ie.image(:src,/selectDepart.gif/).click
sleep 5
assert($ie.contains_text("Total Travel Price"))
assert($ie.button(:value,/Continue/).exists?)
end
def test_04_Flight_Review_Page #Yatra Flight Passenger Page
#~ $ie.div(:id,'contBooking').button(:name,'submit').click
$ie.button(:value,/Continue/).click
#~ assert($ie.checkbox(:name,'ch1').exists?)
assert($ie.contains_text(/Review Details/))
assert($ie.contains_text(/Pricing Details/))
assert($ie.button(:alt,/Continue Booking/).exists?)
end
def test_05_Flight_Passenger_Page
$ie.radio(:name,/barclay_radio/).click
$ie.checkbox(:name,'ch1').set
$ie.checkbox(:name,'ch3').set
$ie.button(:alt,/Continue Booking/).click
assert($ie.text_field(:name,'contact_first_name').exists?)
assert($ie.text_field(:name,'password').exists?)
end
No comments:
Post a Comment