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
4.9k
Kotlin製のGraphQLサーバーをNode.jsでモジュラモノリス化している話
hokaccha
0
3.7k
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
4k
巨大なRailsアプリケーションを「普通」にするための取り組み
hokaccha
1
1.1k
Web Frontend Improvement in Cookpad
hokaccha
1
1.1k
Other Decks in Programming
See All in Programming
AIとペアプロして処理時間を97%削減した話 #pyconshizu
kashewnuts
1
210
PJのドキュメントを全部Git管理にしたら、一番喜んだのはAIだった
nanaism
0
240
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
9
2.6k
AI主導でFastAPIのWebサービスを作るときに 人間が構造化すべき境界線
okajun35
0
620
Unity6.3 AudioUpdate
cova8bitdots
0
110
nuget-server - あなたが必要だったNuGetサーバー
kekyo
PRO
0
200
15年目のiOSアプリを1から作り直す技術
teakun
1
610
encoding/json/v2のUnmarshalはこう変わった:内部実装で見る設計改善
kurakura0916
0
350
Claude Code の Skill で複雑な既存仕様をすっきり整理しよう
yuichirokato
1
310
CSC307 Lecture 15
javiergs
PRO
0
230
go directiveを最新にしすぎないで欲しい話──あるいは、Go 1.26からgo mod initで作られるgo directiveの値が変わる話 / Go 1.26 リリースパーティ
arthur1
2
490
CSC307 Lecture 13
javiergs
PRO
0
310
Featured
See All Featured
Writing Fast Ruby
sferik
630
63k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
620
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
88
BBQ
matthewcrist
89
10k
Abbi's Birthday
coloredviolet
2
5.2k
Documentation Writing (for coders)
carmenintech
77
5.3k
We Are The Robots
honzajavorek
0
190
Unsuck your backbone
ammeep
672
58k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
330
Site-Speed That Sticks
csswizardry
13
1.1k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
64
53k
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Խ
ͨͩ͠Γ͗͢Δͱ ࢮ͵ͷͰҙ