Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Testovanie web aplikácií s CasperJS (WebElement...
Search
Vladimír Kriška
September 06, 2012
Programming
300
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Testovanie web aplikácií s CasperJS (WebElement #11)
Vladimír Kriška
September 06, 2012
More Decks by Vladimír Kriška
See All by Vladimír Kriška
Twelve-Factor app with Docker
ujovlado
0
200
Design a REST API you will love to work with
ujovlado
0
830
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
540
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
450
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
210
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
160
CSS Flexbox (WebElement #35)
ujovlado
0
220
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
220
Don't underestimate CSS (WebElement #30)
ujovlado
0
660
Other Decks in Programming
See All in Programming
Event is what happens
moro
2
4k
SODA - FACT BOOK(JP)
sodainc
1
40k
Claude Code ハーネスDeep Dive – 君はどこまで制御する? -
takateeen_knj
6
4.6k
React Native에 현대적인 빌드 도구 더하기: Rollipop 구현기
leegeunhyeok
0
180
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
15
11k
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
130
Modernizing iOS Apps
seyfoyun
0
150
Getting Started with Vibe Coding
miccheng
0
190
AIが生成したコードは読むべきか?抽象化設計とコードの品質保証 / abstraction-design-and-quality
minodriven
16
8.9k
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
170
AIが実装を担う時代の「技術設計」と「チームマネジメント」
kamina_zzz
2
240
Goコンパイラを作ってGoをもっと理解する / Build a Go compiler to better understand Go
ikura_hamu
0
130
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
34
9.8k
Navigating Team Friction
lara
192
16k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
630
Marketing to machines
jonoalderson
1
6k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Crafting Experiences
bethany
1
430
Accessibility Awareness
sabderemane
1
290
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
How to train your dragon (web standard)
notwaldorf
96
6.9k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
380
Game over? The fight for quality and originality in the time of robots
wayneb77
1
330
Deep Space Network (abreviated)
tonyrice
0
410
Transcript
CasperJS Vladimír Kriška (@ujovlado) WebElement #11
Čo je CasperJS? Navigation scripting & testing utility CasperJS je
postavený na PhantomJS - náhrada browsera využívajúca Webkit.
Čo všetko vie? • Browsovať • Vypĺňať formuláre • Klikať
• Robiť screenshoty • Sťahovať content • Testovať • ...
A ešte • Vykonávať kód na klientskej strane • Pracovať
s viewportom • ...
Inštalácia • Stiahnúť PhantomJS a CasperJS • Vytvoriť symlinky vlado@pc:~$
ln -s casper_path/bin/casperjs /usr/local/bin/casperjs vlado@pc:~$ casperjs javascript.js
Command Line Interface casper.cli.has(); casper.cli.get(); Dva prístupy. // pre options
casper.cli.has("arg"); // casper.cli.get("arg"); // pre args casper.cli.has(0); // casper.cli.get(0);
Selektory // CSS3 casper.test.assertExists('#main', 'existuje'); // XPath casper.test.assertExists({ type: 'xpath',
path: '//*[@id="main"]' }, 'existuje');
HTTP Status Codes Nezačnem testovať keď nastala chyba. casper.on('http.status.404', function()
{ this.echo('404').exit(); }); casper.start('http://localhost/404', function() { this.echo('vsetko v poriadku'); });
Verbose (debug) mode Chcem vedieť, čo sa deje var casper
= require('casper').create({ verbose: true, logLevel: "debug" }); // logovanie casper.log('debug message', 'debug');
Eventy casper.on("meno.eventu", function(resource) { // nieco sprav }); • http.status.[code]
• remote.alert • fill • start, exit • click • ...
Vlastné eventy casper.on("webelement.presentation", function (status) { this.echo("WebElement prednaska " +
status); }); casper.start("http://localhost/casperjs", function() { var presentationStatus = 'bezi'; this.emit("webelement.presentation", presentationStatus); });
Testovanie Metódy: • assert() • assertEval() • assertExists() • assertNot()
• ... this.test.assertExists('.form', 'Form existuje');
Príklady ...
Ďakujem vlado@pc:~$ casperjs presentation.js PASS Odprezentovane PASS 1 tests executed,
1 passed, 0 failed. vlado@pc:~$