Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Functional testing with capybara
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
koffeinfrei
August 22, 2012
Programming
240
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Functional testing with capybara
Functional testing with capybara, shown by examples from the metaflop project.
koffeinfrei
August 22, 2012
More Decks by koffeinfrei
See All by koffeinfrei
Volt Showcase - Planning Poker
koffeinfrei
0
59
Other Decks in Programming
See All in Programming
Kiroで創り、AgentCoreで繋ぐ!AWSで実践する「AI-DLC」から「AIエージェント統合」までの最新地図
licux
4
700
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
620
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
150
TiDB Cloudのカスタムコントローラーによるオートスケール対応
takaidohigasi
0
130
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
220
Go × SIMDで高速化するベクトル検索 ~ルーフラインモデルでSIMDが効く境界を探れ! ~
po3rin
1
2.1k
AI活用は、個人から組織へ|マルチプレイヤーエージェントハーネス「QM」の社内活用事例 / AI use is moving from individuals to orgs
rkaga
1
120
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
2.3k
wkhtmltopdfの次どうするか問題2026
willnet
2
1.5k
GKE で Pod の見方を変えたら、スケールアウト時の挙動を真に捉えられた話
stkk
0
130
Are APIs Still Relevant in the AI Era?
soyuka
0
270
海上で動くGoサーバー: goroutineとchannelでさばく航行データストリーム
atsuki_seo
0
730
Featured
See All Featured
The browser strikes back
jonoalderson
0
1.7k
Building the Perfect Custom Keyboard
takai
2
880
ラッコキーワード サービス紹介資料
rakko
1
4.9M
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Producing Creativity
orderedlist
PRO
348
41k
Everyday Curiosity
cassininazir
0
320
Raft: Consensus for Rubyists
vanstee
142
7.7k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
BBQ
matthewcrist
89
10k
A Modern Web Designer's Workflow
chriscoyier
699
190k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Transcript
capybara
None
overview automated user interaction automatically waits for asynchronous tasks driver
agnostic high level access to ui elements
test frameworks cucumber rspec test::unit minitest::spec
drivers
rack_test default fast, no server no js mechanize rack_test with
remote server
selenium 2.0 aka webdriver firefox, chrome, ie, ...
webkit headless QtWebKitk logging / messages screenshots cookies resizing the
window
poltergeist headless phantomjs screenshots resizing the window remote debugging (web
inspector) no X (CI integration)
dsl
navigating visit('/projects') visit(post_comments_path(post))
clicking links and buttons click_link('id-of-link') click_link('Link Text') click_button('Save') click_on('Link Text')
# links or buttons
interacting with forms fill_in('Username', :with => 'user') choose('A Radio Button')
check('A Checkbox') attach_file('Image', '/path/to/image.jpg') select('Option', :from => 'Select Box')
querying (rspec matchers) page.should have_selector('table tr') page.should have_selector( :xpath, '//table/tr')
page.should have_xpath('//table/tr') page.should have_css('table tr.foo') page.should have_content('foo')
finding find_field('First Name').value find_link('Hello').visible? find_button('Send').click find("#overlay").find("h1").click all('a').each { |a| a[:href]
}
scoping within("li#employee") do fill_in 'Name', :with => 'Jimmy' end
scripting page.execute_script("$('body').empty()") result = page.evaluate_script('4 + 4');
debugging save_and_open_page # snapshot print page.html
setup
Capybara.default_driver = :selenium # sinatra Capybara.app = App # remote
app Capybara.app_host = 'http://www.google.com'
per spec Capybara.javascript_driver = :selenium # ... describe 'requires js',
:js => true do it 'will use the default js driver' it 'will switch to one specific driver', :driver => :webkit end
set browser Capybara.register_driver :selenium do |app| Capybara::Selenium::Driver.new( app, :browser =>
:chrome ) end
in the wild
metaflop web based platform for metafonts and related type projects
modulator experimental font generation export as otf, webfont
spec sample 1 context 'when i change the unit width'
do it 'should show the loading indicator' do fill_in 'param-unit-width', :with => 2 page.should have_selector( '.preview-loading-text') end end
spec sample 2 context 'when i enable anatomy' do it
'shows the anatomy image' do within '#menu' do click_link 'on' end page.should have_selector '#info-panel' end end
spec sample 3 context 'when i click the "webfont" link'
do it 'should call the font generator url' do click_link('webfont') current_url.should include 'modulator/export/font/web' end end
problems
general dialogs (downloads) new openend windows driver specialties
selenium slow, startup slow, random errors no http response no
.trigger() (e.g. mouse over) installation
solution avoid selenium use headless test visual concerns manually
links capybara homepage webkit poltergeist selenium chrome driver metaflop
@alexisreigel koffeinfrei koffeinfrei.org