Meetup AngularJS Rio - Testes e2e para apps AngularJS com Protractor

Post on 23-Jan-2018

814 views 1 download

Transcript of Meetup AngularJS Rio - Testes e2e para apps AngularJS com Protractor

Testes e2e para apps AngularJS com

Protractor

Stefan Teixeira @stefan_teixeira

stefanfk@gmail.com stefanteixeira.com.br

stefanteixeira.com Meetup AngularJS Rio de Janeiro

About me

Stefan Teixeira

• QA Engineer @ M4U • Automação de Testes, Agile Testing e DevOps • Blogs técnicos: stefanteixeira.com.br (pt-br) /

stefanteixeira.com (en)

Contatos: • E-mail: stefanfk@gmail.com • Twitter: twitter.com/stefan_teixeira • Facebook: facebook.com/stefan.teixeira • LinkedIn: linkedin.com/in/stefanteixeira • GitHub: github.com/stefanteixeira • SlideShare: slideshare.net/stefanteixeira

O que é?

• Framework para testes e2e (end-to-end)

O que é?

• Framework para testes e2e (end-to-end)

• Usa o Selenium WebDriver

O que é?

• Framework para testes e2e (end-to-end)

• Usa o Selenium WebDriver

• Criado pela equipe do AngularJS

O que é?

• Framework para testes e2e (end-to-end)

• Usa o Selenium WebDriver

• Criado pela equipe do AngularJS

• Também funciona com apps não-Angular

Arquitetura

Fonte: https://www.thoughtworks.com/pt/insights/blog/testing-angularjs-apps-protractor

Config file

https://github.com/angular/protractor/blob/master/docs/referenceConf.js

Locators (alguns dos)

• by.model

• by.binding

• by.repeater

• by.optionshttp://angular.github.io/protractor/#/api?

view=ProtractorByhttp://angular.github.io/protractor/#/api?

view=webdriver.By

• by.id

• by.name

• by.css

• by.xpath

Actions (algumas das)

• el.click()

• el.clear()

• el.sendKeys(‘texto')

• el.getAttribute(‘value')

• el.getText()

• el.isDisplayed()

• el.isEnabled()

• el.isSelected()

Actions: IPC

➡ Actions retornam promises

https://github.com/SeleniumHQ/selenium/wiki/WebDriverJs#promises

Page Object Pattern

Fonte: http://martinfowler.com/bliki/PageObject.html

E com apps não-Angular?

Testes na Nuvem

Sauce Labs: Dashboard

Sauce Labs: Test Reports

Sauce Labs: Config

+

Protractor + Grunt

Demo

• Protractor + app AngularJS: • https://github.com/stefanteixeira/

fav-organizer/tree/master/test/ui

• Protractor + app não-AngularJS: • https://github.com/stefanteixeira/

github-tests

Demo

• API Docs: • http://angular.github.io/protractor/#/api

• Posts do Daniel Amorim no blog da ThoughtWorks:

• https://www.thoughtworks.com/pt/insights/blog/testing-angularjs-apps-protractor

• https://www.thoughtworks.com/pt/insights/blog/hands-protractor-3-steps

• Posts/vídeos sobre Protractor do Walmyr Filho: • http://talkingabouttesting.com/tag/protractor/

Links recomendados

Obrigado!

Meetup AngularJS Rio de Janeiro

Stefan Teixeira @stefan_teixeira

stefanfk@gmail.com stefanteixeira.com.br

stefanteixeira.com