Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Selenium + Sinon.js
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Kazuhito Hokamura
January 27, 2015
Programming
0
810
Selenium + Sinon.js
http://qiita.com/hokaccha/items/9f4dc019c2ea8c6c58a3
Kazuhito Hokamura
January 27, 2015
Tweet
Share
More Decks by Kazuhito Hokamura
See All by Kazuhito Hokamura
TypeScriptとGraphQLで実現する 型安全なAPI実装 / TSKaigi 2024
hokaccha
5
5k
Kotlin製のGraphQLサーバーをNode.jsでモジュラモノリス化している話
hokaccha
0
3.8k
GraphQLの負債と向き合うためにやっていること
hokaccha
2
1.6k
ユビーのアーキテクチャに対する取り組み
hokaccha
1
470
RailsエンジニアのためのNext.js入門
hokaccha
7
21k
Cookpad Summer Internship 2021 Web Frontend
hokaccha
0
7.3k
巨大なモノリシック Rails アプリケーションの マイクロサービス化戦略 / 2019 microservices in cookpad
hokaccha
3
4.1k
巨大なRailsアプリケーションを「普通」にするための取り組み
hokaccha
1
1.1k
Web Frontend Improvement in Cookpad
hokaccha
1
1.1k
Other Decks in Programming
See All in Programming
PHP 7.4でもOpenTelemetryゼロコード計装がしたい! / PHPerKaigi 2026
arthur1
1
420
PHP でエミュレータを自作して Ubuntu を動かそう
m3m0r7
PRO
2
150
Symfony + NelmioApiDocBundle を使った スキーマ駆動開発 / Schema Driven Development with NelmioApiDocBundle
okashoi
0
240
CS教育のDX AIによる育成の効率化
niftycorp
PRO
0
170
存在論的プログラミング: 時間と存在を記述する
koriym
5
540
Claude Codeログ基盤の構築
giginet
PRO
7
3.7k
Redox OS でのネームスペース管理と chroot の実現
isanethen
0
460
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
840
PHPのバージョンアップ時にも役立ったAST(2026年版)
matsuo_atsushi
0
260
GoのDB アクセスにおける 「型安全」と「柔軟性」の両立 - Bob という選択肢
tak848
0
280
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
200
Ruby and LLM Ecosystem 2nd
koic
1
1.3k
Featured
See All Featured
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
96
Paper Plane (Part 1)
katiecoart
PRO
0
6k
Odyssey Design
rkendrick25
PRO
2
560
Balancing Empowerment & Direction
lara
5
1k
ラッコキーワード サービス紹介資料
rakko
1
2.8M
How GitHub (no longer) Works
holman
316
150k
GitHub's CSS Performance
jonrohan
1032
470k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
460
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
Building Applications with DynamoDB
mza
96
7k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
200
Transcript
Selenium + Sinon.js #template_literal_sushi #e2e_sushi
$('button').click(function() { navigator.geolocation.getCurrentPosition( function(res) { var lat = res.coords.latitude; var
lon = res.coords.longitude; $('#pos').text(lat + ':' + lon); }); });
// stub.js sinon.stub(navigator.geolocation, 'getCurrentPosition') .callsArgWith(0, { coords: { latitude: 10,
longitude: 20 } });
// sinon.jsͱstubͷεΫϦϓτΛ࣮ߦ driver.executeScript(fs.readFileSync('./sinon.js').toString()); driver.executeScript(fs.readFileSync('./stub.js').toString()); // ςετ࣮ߦ driver.findElement(By.css('button')).click(); driver.findElement(By.css('#pos')).getText().then(function(text) { assert(text
=== '10:20'); });
ଞʹ͜͏͍͏έʔεͰ͑Δ͔ • खͰ࠶ݱͮ͠Β͍ҟৗܥͷ࠶ݱ • APIϨεϙϯεͷmockԽ
ͨͩ͠Γ͗͢Δͱ ࢮ͵ͷͰҙ