Skip to content

rubystar/capybara_quick_ref

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 

Repository files navigation

capybara_quick_ref

Visiting pages

  visit "/posts"

Current path

  current_path.should == "/login"

Buttons and Links

  click_link("Ads")    # Name or id of the link
  click_button("Save") # Name or id of the button
  click_on("some")     # Either link or button

Form elements

  fill_in("Name", :with => "DHH")           # Name or id of the field  # Text field
  select("Male", :from => "gender_id")      # Normal Select, Use id of the field
  select2_select("Male", "gender_id_input") # Select2 select, _input is necessory
  select2_ajax("publisher name", :from => "#publisher_id") #id of the field
  check('A Checkbox')                       # Checkbox, use id or name
  choose('Male')                            # Name or id of the Radio Button

Auto complete

fill_in_autocomplete("#advertiser_id", "adver")
choose_autocomplete("advertiser")

Page expectations

  expect(page).to have_content("Awesome Post")                 # expecting text  
  expect(page).to have_link("Edit Post")                       # expecting link
  expect(page).to have_css(".acitve")                          # expecting css
  expect(page).to have_select('Company', :options => ['RMM'])  # expecting select field with options
  expect(page).to have_field('name', with: "siva")             # expecting text field with some value

####Check alert messages

  page.driver.alert_messages.should == ["Alert Message."]

Other

find("#sites_more_actions").trigger(:mouseover)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •