mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-18 05:25:50 +00:00
commit
9a135f76f7
1 changed files with 40 additions and 28 deletions
|
@ -1,6 +1,5 @@
|
||||||
require 'headless'
|
require 'headless'
|
||||||
require 'selenium-webdriver'
|
require 'selenium-webdriver'
|
||||||
require 'minitest/spec'
|
|
||||||
require 'minitest/autorun'
|
require 'minitest/autorun'
|
||||||
|
|
||||||
describe 'Petlinic' do
|
describe 'Petlinic' do
|
||||||
|
@ -10,7 +9,6 @@ describe 'Petlinic' do
|
||||||
|
|
||||||
@driver = Selenium::WebDriver.for :firefox
|
@driver = Selenium::WebDriver.for :firefox
|
||||||
@driver.navigate.to 'http://tomcat:8080/petclinic'
|
@driver.navigate.to 'http://tomcat:8080/petclinic'
|
||||||
@wait = Selenium::WebDriver::Wait.new(:timeout => 30)
|
|
||||||
@driver.manage.timeouts.implicit_wait = 30
|
@driver.manage.timeouts.implicit_wait = 30
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -19,39 +17,53 @@ describe 'Petlinic' do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when homepage is available' do
|
describe 'when homepage is available' do
|
||||||
it 'I should see page title containing PetClinic' do
|
it 'should show correct page title' do
|
||||||
sleep 3
|
assert @driver.title == 'PetClinic :: a Spring Framework demonstration'
|
||||||
assert @driver.title == "PetClinic :: a Spring Framework demonstration"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when homepage is available' do
|
describe 'when site is available' do
|
||||||
it 'click the find owners link' do
|
it 'should have Find Owners page' do
|
||||||
@driver.find_element(:class, "icon-search").click
|
# click on Find Owners menu item
|
||||||
sleep 3
|
@driver.find_element(:class, 'icon-search').click
|
||||||
h2 = @driver.find_element(:tag_name, "h2")
|
|
||||||
assert h2.text == "Find Owners"
|
# wait to see Add Owner on the page that opens
|
||||||
|
@driver.find_element(:link_text, 'Add Owner')
|
||||||
|
|
||||||
|
# grab H2 content
|
||||||
|
h2 = @driver.find_element(:tag_name, 'h2').text
|
||||||
|
|
||||||
|
assert h2 == 'Find Owners'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when homepage is available' do
|
describe 'when site is available' do
|
||||||
it 'click the veterinarians link' do
|
it 'should have Veterinarians page' do
|
||||||
@driver.find_element(:class, "icon-th-list").click
|
# click on Veterinarian menu item
|
||||||
sleep 3
|
@driver.find_element(:class, 'icon-th-list').click
|
||||||
h2 = @driver.find_element(:tag_name, "h2")
|
|
||||||
assert h2.text == "Veterinarians"
|
# wait to see View as XML on the page that opens
|
||||||
end
|
@driver.find_element(:link_text, 'View as XML')
|
||||||
|
|
||||||
|
# grab H2 content
|
||||||
|
h2 = @driver.find_element(:tag_name, 'h2').text
|
||||||
|
|
||||||
|
assert h2 == 'Veterinarians'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when homepage is available' do
|
describe 'when site is available' do
|
||||||
it 'search for veterinarian' do
|
it 'should have Search for Veterinarian feature' do
|
||||||
@driver.find_element(:class, "icon-th-list").click
|
# click on Veterinarian menu item
|
||||||
search_box = @driver.find_element(:id, "vets_filter")
|
@driver.find_element(:class, 'icon-th-list').click
|
||||||
textBox = search_box.find_element(:tag_name, "input")
|
|
||||||
textBox.send_keys("Helen Leary")
|
|
||||||
vets = @driver.find_element(:id, "vets").text
|
|
||||||
assert vets.split("\n")[1] == "Helen Leary radiology"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
# type Veterinarian name in search box
|
||||||
|
@driver.find_element(:tag_name, 'input').send_keys('Helen Leary')
|
||||||
|
|
||||||
|
# grab first cell content in filtered results
|
||||||
|
result = @driver.find_element(:css, 'td.sorting_1').text
|
||||||
|
|
||||||
|
assert result == 'Helen Leary'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue