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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
エージェントを使い続けるためのメタワーク / Meta-work for keeping using the agent
rkaga
6
2.1k
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
1
1.9k
조합이폭발하는디자인시스템이걸눈으로도테스트하라고요
giljongyu
0
690
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
210
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
270
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
320
우리의 Nitro Modules는 당신의 Turbo Modules보다 아름답다
l2hyunwoo
0
250
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
340
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
14
11k
Apple Intelligenceとオンデバイス時代の到来
yahir0
0
190
[2026-10-14](C)Re:ゼロから始める異世界生活〜始まりの終わりと終わりの始まり〜
tosite
0
270
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
3
1.6k
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
810
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.4k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Making the Leap to Tech Lead
cromwellryan
135
10k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
320
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
KATA
mclloyd
PRO
35
16k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3.1k
Large-scale JavaScript Application Architecture
addyosmani
516
110k
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