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
Testing Angular apps with Protractor
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Tomohiro Akutsu
June 18, 2017
Programming
0
1.4k
Testing Angular apps with Protractor
angularを使用したwebアプリケーションにおけるE2Eテストに関するスライドです。また、こちらは2017年6月16日に行われたD-cubeの資料となっています。
Tomohiro Akutsu
June 18, 2017
Tweet
Share
Other Decks in Programming
See All in Programming
AIエージェントのキホンから学ぶ「エージェンティックコーディング」実践入門
masahiro_nishimi
3
300
Patterns of Patterns
denyspoltorak
0
1.4k
なるべく楽してバックエンドに型をつけたい!(楽とは言ってない)
hibiki_cube
0
140
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
440
CSC307 Lecture 08
javiergs
PRO
0
670
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
220
AtCoder Conference 2025
shindannin
0
1k
Basic Architectures
denyspoltorak
0
660
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
110
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
SourceGeneratorのススメ
htkym
0
190
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
300
Featured
See All Featured
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
320
Game over? The fight for quality and originality in the time of robots
wayneb77
1
110
Odyssey Design
rkendrick25
PRO
1
490
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
150
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.3k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
120
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
Ruling the World: When Life Gets Gamed
codingconduct
0
140
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
400
The Curse of the Amulet
leimatthew05
1
8.2k
RailsConf 2023
tenderlove
30
1.3k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
54
Transcript
Testing ɹngular apps with Protractor June 2017 v.1.0.0 Tomohiro Akutsu
Front-end Engineer BizReach, Inc. June 16 2017 @Bizreach, Inc.
Introduce Myself - ࣗݾհ -
## Introduce Myself Tomohiro Akutsu Ѩٱஐେ @TomohiroAkutsu HRMOS Div. BizReach,
Inc. Front-end Engineer
Introduce Our Product - )3.04ͷհ -
## Introduce Our Product https://hrmos.co/
Agenda - ຊ͓͢Δ͜ͱ -
## Agenda ### E2E Testing and Protractor ### Install and
Setup ### API/Usage ### Resource of Learning 1SPUSBDUPSͷ֓ཁ 1SPUSBDUPSͷΠϯετʔϧɺ$POGKTͷهड़ ༻ҙ͞Ε͍ͯΔ"1*ه๏ ࠓޙɺΑΓࣝΛਂΊΔ͋ͨͬͯ
Do not Talk - ຊ͓͠ͳ͍͜ͱ -
## Do not Talk ### Unit Testing of Front-end ###
Comparison with Other Testing Framework ϑϩϯτΤϯυʹ͓͚ΔϢχοτςετ ଞͷςετπʔϧͱͷൺֱݕ౼
E2E Testing and Protractor - Protractorͷ֓ཁ -
## Introduce Protractor http://www.protractortest.org/#/
## Introduce Protractor https://github.com/angular/protractor
## Overview of Protractor ɾ1SPUSBDUPSثͷҙຯΛ࣋ͭ ɾͪͳΈʹBOHVMBS֯ͷ͋ΔΈ͍ͨͳҙຯ ɾBOHVMBS ֯ Λςετ ଌΔ
͢Δ1SPUSBDUPS ث ɾ/PEFKT͔Β4FMFOJVNΛѻ͏ϥΠϒϥϦͱͯ͠8FC%SJWFS+4Λར༻
## Built on top of WebDriverJS https://www.thoughtworks.com//insights/blog/testing-angularjs-apps-protractor
Install and Setup - ProtractorͷΠϯετʔϧɺConf.jsͷهड़ -
## Install OQNͰ1SPUSBDUPSΛΠϯετʔϧ npm install protractor QSPUSBDUPS XFCESJWFSNBOBHFSίϚϯυ͕͑ΔΑ͏ʹͳΔɻ 4FMFOJVN8FC%SJWFSΛϩʔΧϧڥΠϯετʔϧ webdriver-manager
update αʔόʔͷىಈ webdriver-manager start IUUQMPDBMIPTUXEIVCͷΞΫηε͕ՄೳʹͳΔɻ
## Example QBDLBHFKTPOͷTDSJQUTʹهड़ “scripts”: { … “test”: “protractor ./test/protractor/conf.js”, “webdriver”:
“webdriver-manager update && webdriver-manager start”, … } ίϚϯυͰςετͷ࣮ߦ͕Մೳɻҙͱͯͦ͠ΕͧΕผλϒͰ։͘͜ͱɻ
## Setup DPOGKTʹ֤छઃఆΛهड़ɹhttps://github.com/angular/protractor/blob/master/lib/config.ts export.config = { seleniumAddress: ‘http://localhost:4444/wd/hub’, capabilities: {
‘browserName’: ‘chrome’ }, specs: [spec.js], baseUrl: ‘http://localhost:9000/’, jasminNodeOpts: { showColors: true, defaultTimeoutInterval: 30000 } };
API/Usage - ༻ҙ͞Ε͍ͯΔAPIه๏ -
Basic Example - spec.jsͷجຊతͳߏจ -
## Basic Example spec.js describe(‘this test description is Hoge.’, function()
{ it(‘Fuga in Hoge’, function() { browser.get(‘https://angular.io/’); expect(browser.getTitle()).toEqual(‘Angular Docs’); }); it(‘Piyo in Hoge’, function() { … }); });
Global Variables - άϩʔόϧม -
## browser browser.get(‘url’) var baseUrl = ‘http://localhost:3000’; … browser.get(baseUrl +
‘/path/’); expect(browser.getTitle()).toEqual(‘This page title is Hoge’); browser.waitForAngular() browser.waitForAngular();
## element, by <p class=“name”>My name is {{person.name}}.</p> <input type=“text”
ng-model=“person.name”> var input = element(by.model(‘person.name’)); input.sendKeys(‘Tomohiro’); expect(element(by.css(‘p.name’)).getText()).toEqual(‘…is Tomohiro.’); element(by.model(‘modelName’)); <ul> <li>Blue</li> <li>Green</li> <li>Yellow</li> </ul> var yellow = element(by.cssContainingText(‘li’, ‘Yellow’)); element(by.cssContainingText(‘cssSelector’, ‘searchString’));
## element, by <ul ng-repeat=“item in items”> <li>{{item.name}}</li> </ul> element(by.repeater(‘item
in items’)).row(0).column(‘name’); element(by.repeater(‘repeatDescriptor’)); <a href=“url” class=“button”>Click</a> var button = element(by.className(‘button’)); expect(button.getText()).toEqual(‘Click’); button.click(); element(by.className(‘className’));
Handling Events - Πϕϯτͷॲཧ -
## Handling Events .click(); <button ng-click=“submit()”>submit</button> element(by.css(‘[ng-click=“submit()”]’)).click(); sendKeys(); var inputMail
= element(by.model(‘modelName’)); inputText.sendKeys(‘
[email protected]
’, protractor.Key.ENTER);
Resource of Learning - ࠓޙΑΓࣝΛਂΊΔ͋ͨͬͯ -
## Resource of Learning ɾެࣜυΩϡϝϯτ ɾ(JU)VC ɾ1SPUSBDUPS"OHVMBS+4ͷ࣍ੈ&&ςετϑϨʔϜϫʔΫ ɾ"OHVMBS+4ʹ&&ςετڥͱͯ͠1SPUSBDUPSΛಋೖ͢Δɻ
Thank You for Listening. - Let’s Work Together! -