Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Selenium + Sinon.js
Kazuhito Hokamura
January 27, 2015
Programming
0
730
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
RailsエンジニアのためのNext.js入門
hokaccha
6
8.9k
Cookpad Summer Internship 2021 Web Frontend
hokaccha
0
5.7k
巨大なモノリシック Rails アプリケーションの マイクロサービス化戦略 / 2019 microservices in cookpad
hokaccha
3
3.1k
巨大なRailsアプリケーションを「普通」にするための取り組み
hokaccha
1
630
Web Frontend Improvement in Cookpad
hokaccha
1
620
cookpad summer internship 2018 - Git
hokaccha
1
9.1k
cookpad summer internship 2018 - JavaScript
hokaccha
0
9k
エンジニアのアウトプットと採用 / Engineer's output and recruiting
hokaccha
0
1.4k
ログを活用したサービス開発
hokaccha
2
6.5k
Other Decks in Programming
See All in Programming
Go API クライアントの実装 〜Go Conference に載せれなかったTIPS〜
yyoshiki41
0
190
Jetpack Compose 頑張らないPreviewParameterProvider
horie23
0
110
Android Architecture Design With Koin
agiuliani
0
240
Kotlin KSP - Intro
taehwandev
1
480
코드 품질 1% 올리기
pluu
1
990
Swift Concurrencyによる安全で快適な非同期処理
tattn
2
320
tfcon2022_Web3Dひとめぐり.pdf
emadurandal
0
1k
Groovy Roadmap
paulk
7
13k
【PHPerKaigi2022】Mongo に溜まった約1.6億件の記事データを BigQuery へ …
userkazun
0
110
【Qiita Night】新卒エンジニアによるSwift6与太予想
eiji127
0
180
Named Document って何?
harunakano
0
430
クリエイティブ系のウェブサイト制作で役立つCSS技法 / CSS for develop creative website
clockmaker
2
1.6k
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
689
180k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
498
130k
Bootstrapping a Software Product
garrettdimon
295
110k
Teambox: Starting and Learning
jrom
121
7.6k
What the flash - Photography Introduction
edds
61
10k
What's in a price? How to price your products and services
michaelherold
229
9.3k
GraphQLの誤解/rethinking-graphql
sonatard
24
6.2k
Build The Right Thing And Hit Your Dates
maggiecrowley
19
1.1k
Practical Orchestrator
shlominoach
178
8.6k
Making Projects Easy
brettharned
98
4.3k
Statistics for Hackers
jakevdp
781
210k
How to name files
jennybc
39
58k
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Խ
ͨͩ͠Γ͗͢Δͱ ࢮ͵ͷͰҙ