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
Kazuhito Hokamura
January 27, 2015
Programming
0
760
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
Kotlin製のGraphQLサーバーをNode.jsでモジュラモノリス化している話
hokaccha
0
2.7k
GraphQLの負債と向き合うためにやっていること
hokaccha
2
1.2k
ユビーのアーキテクチャに対する取り組み
hokaccha
1
310
RailsエンジニアのためのNext.js入門
hokaccha
7
17k
Cookpad Summer Internship 2021 Web Frontend
hokaccha
0
6.9k
巨大なモノリシック Rails アプリケーションの マイクロサービス化戦略 / 2019 microservices in cookpad
hokaccha
3
3.6k
巨大なRailsアプリケーションを「普通」にするための取り組み
hokaccha
1
830
Web Frontend Improvement in Cookpad
hokaccha
1
900
cookpad summer internship 2018 - Git
hokaccha
1
9.4k
Other Decks in Programming
See All in Programming
VS Code をプロダクトにどう取り込むか
onomax
1
780
Ruby Pattern Matching
bkuhlmann
0
940
Going beyond Apache Parquet's default settings
xhochy
0
140
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
4
920
MicrosoftのPlatform Engineeringガイドを読んで実際になにかやってみた
ymd65536
1
530
Ruby Function Composition
bkuhlmann
1
340
Sheets API使ってみた
toshi0383
2
170
From Spring Boot 2 to Spring Boot 3 with Java 21 and Jakarta EE
ivargrimstad
0
850
Snowflakeで眠ったデータを起こそう!
estie
0
160
DMMプラットフォームがTiDB Cloudを採用した背景
pospome
9
4.3k
Next.js App Router
quramy
12
2.1k
PHPはいつから死んでいるかの調査
chiroruxx
2
430
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
165
13k
GitHub's CSS Performance
jonrohan
1025
450k
BBQ
matthewcrist
80
8.8k
Ruby is Unlike a Banana
tanoku
96
10k
A Philosophy of Restraint
colly
197
16k
Facilitating Awesome Meetings
lara
43
5.6k
Automating Front-end Workflow
addyosmani
1357
200k
How to Ace a Technical Interview
jacobian
273
22k
Designing for humans not robots
tammielis
247
25k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
155
14k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
Product Roadmaps are Hard
iamctodd
45
9.8k
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Խ
ͨͩ͠Γ͗͢Δͱ ࢮ͵ͷͰҙ