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
780
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.2k
Kotlin製のGraphQLサーバーをNode.jsでモジュラモノリス化している話
hokaccha
0
3.4k
GraphQLの負債と向き合うためにやっていること
hokaccha
2
1.4k
ユビーのアーキテクチャに対する取り組み
hokaccha
1
380
RailsエンジニアのためのNext.js入門
hokaccha
7
20k
Cookpad Summer Internship 2021 Web Frontend
hokaccha
0
7.1k
巨大なモノリシック Rails アプリケーションの マイクロサービス化戦略 / 2019 microservices in cookpad
hokaccha
3
3.8k
巨大なRailsアプリケーションを「普通」にするための取り組み
hokaccha
1
940
Web Frontend Improvement in Cookpad
hokaccha
1
1.1k
Other Decks in Programming
See All in Programming
Drawing Heighway’s Dragon- Recursive Function Rewrite- From Imperative Style in Pascal 64 To Functional Style in Scala 3
philipschwarz
PRO
0
160
自力でTTSモデルを作った話
zgock999
0
120
Kotlinの開発でも AIをいい感じに使いたい / Making the Most of AI in Kotlin Development
kohii00
5
1.9k
Visual StudioのGitHub Copilotでいろいろやってみる
tomokusaba
1
220
Datadog Workflow Automation で圧倒的価値提供
showwin
1
310
Amazon Bedrockマルチエージェントコラボレーションを諦めてLangGraphに入門してみた
akihisaikeda
1
160
若手バックエンドエンジニアが Elasticsearch を使ってみた話
hott0mott0
1
100
dbt Pythonモデルで実現するSnowflake活用術
trsnium
0
270
Djangoにおける複数ユーザー種別認証の設計アプローチ@DjangoCongress JP 2025
delhi09
PRO
4
510
はじめての Go * WASM * OCR
sgash708
1
120
Better Code Design in PHP
afilina
0
180
Google Cloudとo11yで実現するアプリケーション開発者主体のDB改善
nnaka2992
1
120
Featured
See All Featured
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
11
540
4 Signs Your Business is Dying
shpigford
183
22k
Fireside Chat
paigeccino
35
3.2k
Measuring & Analyzing Core Web Vitals
bluesmoon
6
260
A better future with KSS
kneath
238
17k
Agile that works and the tools we love
rasmusluckow
328
21k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2.1k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.3k
The Language of Interfaces
destraynor
156
24k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
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Խ
ͨͩ͠Γ͗͢Δͱ ࢮ͵ͷͰҙ