diff --git a/petclinic_spec.rb b/petclinic_spec.rb index 87a798a6c..79702272a 100644 --- a/petclinic_spec.rb +++ b/petclinic_spec.rb @@ -22,29 +22,47 @@ describe 'Petlinic' do end end - describe 'when homepage is available' do + describe 'when site is available' do it 'should have Find Owners page' do + # click on Find Owners menu item @driver.find_element(:class, 'icon-search').click + + # wait to see Add Owner on the page that opens @driver.find_element(:link_text, 'Add Owner') - h2 = @driver.find_element(:tag_name, 'h2') - assert h2.text == 'Find Owners' + + # grab H2 content + h2 = @driver.find_element(:tag_name, 'h2').text + + assert h2 == 'Find Owners' end end - describe 'when homepage is available' do + describe 'when site is available' do it 'should have Veterinarians page' do + # click on Veterinarian menu item @driver.find_element(:class, 'icon-th-list').click + + # wait to see View as XML on the page that opens @driver.find_element(:link_text, 'View as XML') - h2 = @driver.find_element(:tag_name, 'h2') - assert h2.text == 'Veterinarians' + + # grab H2 content + h2 = @driver.find_element(:tag_name, 'h2').text + + assert h2 == 'Veterinarians' end end - describe 'when homepage is available' do + describe 'when site is available' do it 'should have Search for Veterinarian feature' do + # click on Veterinarian menu item @driver.find_element(:class, 'icon-th-list').click + + # 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