Protractor training

Post on 09-Jan-2017

393 views 4 download

Transcript of Protractor training

Protractor.jsEnd to End testing

Global Logic

Lets Learn

Bad Experience

BE

Reflection

R

Theoretical Base

TB

Practice

P

Fairy Tail about karma

Huge testsNo

Agreements

No Abstractions

“Should”

Copy/Paste

How it connects

Tests

Jasmine

ProtractorWeb

DriverJS

Explorer

Mozilla

Firefox

Google

ChromeSelenium

InternetNode.js

Node.js

• Blocks execution

• Runs immediately and return result

• Good for working with data in memory

Synchronous

• Adds new event in the loop

• Runs after all synchronous operations are executed.

• Good for heavy operations like database or filesystem access

Asynchronous

Promise

asynchrony

try/catch

map

chaining

Abstraction of asynchrony

???By the way, everything is a Promise

Why does it look syncronous?

W

C O N T R O LL

F

Protractor provides...

2

3

4

5

ElemenFinder1

ElementArrayFinder

Waiters for Angular $http and $timeout

Mock modules

Search by css, xpath, repeater, etc

What E2E testing is about?

Page Object pattern

2

3

4

5

Hides implementation details1

Maintainable

Reusable

Simplify tests

Extendable

Keep in mind

If you have WebDriver APIs in your test

methods, You're Doing It Wrong

© Simon Stewart

Page decomposition

Page “primitives”

Section methods

2

3

4

5

field(name)1

hasErrorOn(fieldName)

ensure(state, expected).otherwise(act)

try(action)

errorFor(fieldName)

OK, but how to organize code?test/e2e├── config├── lib│ ├── section│ │ ├── behavior│ │ └── field│ ├── page.js│ └── section.js├── features│ ├── login│ └── channels├── shared-specs│ ├── toolbars│ └── validators└── support └── login.js

What we have learned

Simplicity is prerequisite of reliability

© Edsger Dijkstra

Sergii Stotskyisergiy.stotskiy@gmail.com

Any questions?

???